Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions bench/spider2/SCHEMA_BATCH_RESULTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Spider 2.0-Lite SQLite 스키마 배치 조회 평가

## 실행 조건

- 기준군은 #275 직전 제품 커밋 `b443df4`이고 변경군은 #275 제품 커밋 `9274ff1`입니다.
- PR #260의 실행기와 공급자 코드 `24cff8cb`, Spider2 `cafb867`, SQLite 135문항과 DB 30개, 공식 채점 함수를 사용했습니다.
- 모델은 `gpt-4.1-mini-2025-04-14`와 `gpt-4.1-2025-04-14`이고, 각 조합을 문항당 한 번 평가했습니다. 4개 조합 540건을 실행·채점했습니다.
- 문항당 모델 API 호출 상한 8회, 동시성 4, 호출당 출력 상한 4,096토큰, API·문항·SQL 제한 시간은 각각 120·480·30초, 최종 결과 상한은 100,000행입니다.
- 공식 정확도의 분모는 조합당 135문항입니다. 최종 SQL 미제출과 실행 실패를 포함합니다.

- 실행기에 전달하는 제품 검증 기준 SHA를 각 워크트리의 커밋으로 지정했습니다. 실행기와 공급자 소스의 SHA256은 PR #260 기록과 일치합니다.
- 질문 순서, DB, 문서, 공식 채점 코드와 정답 데이터 해시는 [PR #260 manifest](manifest-sqlite135.json)와 일치합니다.
- Python 3.13.14, SQLite 3.53.1, LiteLLM 1.109.1, OpenAI SDK 3.51.0 환경에서 실행했습니다. mini는 기준군 → 변경군, GPT‑4.1은 변경군 → 기준군 순으로 실행했습니다.
- API 사전 점검 문항은 조합별 135문항 집계에서 제외했습니다.

## 공식 실행 정확도

| 모델 | 기준군 | 변경군 | 차이(%p) | 기준군만 정답 | 변경군만 정답 |
|---|---:|---:|---:|---:|---:|
| GPT‑4.1 mini | 28/135 (20.74%) | 21/135 (15.56%) | -5.19 | 13 | 6 |
| GPT‑4.1 | 22/135 (16.30%) | 16/135 (11.85%) | -4.44 | 13 | 7 |

## 도구 및 모델 호출

| 지표 (기준군 → 변경군) | GPT‑4.1 mini | GPT‑4.1 |
|---|---:|---:|
| 모델 API 호출 | 523 → 414 | 244 → 194 |
| 전체 도구 호출 | 406 → 294 | 109 → 59 |
| `explore_schema` 호출 | 200 → 137 | 83 → 35 |
| 다중 테이블 조회 호출 | 0 → 45 | 0 → 20 |
| 다중 테이블 조회 문항 | 0 → 39 | 0 → 18 |
| `run_sql` 호출 | 206 → 155 | 16 → 22 |
| 첫 응답에서 도구 호출 없이 최종 SQL 제출 | 37 → 53 | 113 → 114 |
| 모델 API 8회 도달 문항 | 22 → 10 | 8 → 1 |
| 입력 토큰 | 1,388,786 → 1,104,882 | 432,376 → 367,232 |
| 출력 토큰 | 125,311 → 116,257 | 66,649 → 66,184 |
| API 오류 | 0 → 0 | 0 → 0 |

## 최종 SQL 제출 및 실행

| 지표 (기준군 → 변경군) | GPT‑4.1 mini | GPT‑4.1 |
|---|---:|---:|
| 최종 SQL 제출 | 118 → 129 | 129 → 133 |
| 최종 SQL 실행 성공 | 86 → 81 | 49 → 45 |
| 최종 SQL 실행 실패 | 32 → 48 | 80 → 88 |
| 최종 SQL 미제출 | 17 → 6 | 6 → 2 |
| 모델 API 한도 소진으로 최종 SQL 미제출 | 16 → 6 | 6 → 1 |
| 최종 SQL의 SQLite `no such column` | 31 → 43 | 78 → 81 |

| 같은 문항의 최종 SQL 상태 전환 | GPT‑4.1 mini | GPT‑4.1 |
|---|---:|---:|
| 미제출 → 실행 실패 | 9 | 3 |
| 실행 성공 → 실행 실패 | 23 | 15 |
| 실행 실패 → 실행 성공 또는 미제출 | 16 | 10 |

다중 테이블 조회는 한 `explore_schema` 호출에서 서로 다른 테이블 이름을 2개 이상 요청한 경우입니다. 모델 API 호출에는 보조 추론을 포함합니다. 8회 도달에는 8번째 응답에서 최종 SQL을 제출한 문항도 포함합니다.

최종 SQL 실행 성공은 평가기가 결과 CSV를 생성한 경우입니다. 공식 채점의 정오 판정은 정확도 표에 표시했습니다. `no such column`은 실행에 실패한 제출 SQL을 같은 DB에서 SQLite `EXPLAIN QUERY PLAN`으로 다시 준비해 집계했습니다.

## 결과 파일

- [조합별 지표와 실행 조건](results/schema-275-v1/comparison.json)
- [문항별 정오, 호출 수, 최종 SQL 상태](results/schema-275-v1/paired-scores.jsonl)
252 changes: 252 additions & 0 deletions bench/spider2/results/schema-275-v1/comparison.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
{
"benchmark_commit": "24cff8cb1126fc017d1c68389b76213858e3a2e6",
"product_commits": {
"baseline": "b443df441e639aede585656aa0236e4208d0519c",
"treatment": "9274ff1f7fca3834701e1927f8c412407216f0b2"
},
"environment": {
"python": "3.13.14",
"sqlite": "3.53.1",
"litellm": "1.109.1",
"openai": "3.51.0",
"sqlalchemy": "2.0.50",
"pandas": "2.3.3"
},
"profiles": {
"openai-gpt41-mini": {
"baseline": {
"profile": "openai-gpt41-mini",
"status": "completed",
"correct": 28,
"total": 135,
"accuracy": 0.2074074074074074,
"failed_predictions": 49,
"failure_types": {
"OperationalError": 32,
"ValueError": 17
},
"api_calls": 523,
"seconds": 1316.4766454698693,
"wall_seconds": 333.50904199600336,
"prompt_tokens": 1388786,
"completion_tokens": 125311,
"usage_missing_calls": 0,
"cost_usd": null,
"tool_calls": 406,
"schema_calls": 200,
"schema_cases": 77,
"multi_table_calls": 0,
"multi_table_cases": 0,
"cases_at_call_limit": 22,
"api_errors": {},
"actual_models": {
"gpt-4.1-mini-2025-04-14": 523
},
"final_sql_submitted": 118,
"final_sql_executed": 86,
"final_sql_failed": 32,
"final_sql_missing": 17,
"no_such_column": 31,
"budget_without_final_sql": 16,
"first_response_final_sql": 37,
"run_sql_calls": 206
},
"treatment": {
"profile": "openai-gpt41-mini",
"status": "completed",
"correct": 21,
"total": 135,
"accuracy": 0.15555555555555556,
"failed_predictions": 54,
"failure_types": {
"OperationalError": 48,
"ValueError": 6
},
"api_calls": 414,
"seconds": 1324.4106361077575,
"wall_seconds": 399.03152072199737,
"prompt_tokens": 1104882,
"completion_tokens": 116257,
"usage_missing_calls": 0,
"cost_usd": null,
"tool_calls": 294,
"schema_calls": 137,
"schema_cases": 66,
"multi_table_calls": 45,
"multi_table_cases": 39,
"cases_at_call_limit": 10,
"api_errors": {},
"actual_models": {
"gpt-4.1-mini-2025-04-14": 414
},
"final_sql_submitted": 129,
"final_sql_executed": 81,
"final_sql_failed": 48,
"final_sql_missing": 6,
"no_such_column": 43,
"budget_without_final_sql": 6,
"first_response_final_sql": 53,
"run_sql_calls": 155
},
"gained": 6,
"lost": 13,
"accuracy_delta_pct_points": -5.185185185185184,
"settings": {
"profiles": [
{
"name": "openai-gpt41-mini",
"model": "openai/gpt-4.1-mini-2025-04-14",
"api_key_env": "OPENAI_API_KEY"
}
],
"max_calls": 8,
"call_timeout": 120.0,
"case_timeout": 480.0,
"sql_timeout": 30.0,
"max_rows": 100000,
"concurrency": 4,
"instruction": "\nReturn your final answer as exactly one fenced ```sql block containing the single read-only SQLite SELECT/WITH query that answers the question. Do not include exploratory SQL in the final answer. Use the supplied documentation; no user simulator is available.",
"max_output_tokens": 4096,
"runner_sha256": "0db2a6861ddd6b63d213bb709979cb3a904b4a60e38083e3ffa8a30ebe283f18",
"provider_sha256": "9a7e08a6c0a0d8e1f2f0eac8a53fcfa29221143f2cc93f11afa782b8aa77c08b"
},
"paired_final_sql_states": {
"executed->executed": 61,
"executed->execution_failed": 23,
"executed->not_submitted": 2,
"execution_failed->executed": 14,
"execution_failed->execution_failed": 16,
"execution_failed->not_submitted": 2,
"not_submitted->executed": 6,
"not_submitted->execution_failed": 9,
"not_submitted->not_submitted": 2
},
"paired_first_response": {
"tool_to_final_sql": 29,
"final_sql_to_tool": 13
}
},
"openai-gpt41": {
"baseline": {
"profile": "openai-gpt41",
"status": "completed",
"correct": 22,
"total": 135,
"accuracy": 0.16296296296296298,
"failed_predictions": 86,
"failure_types": {
"OperationalError": 80,
"ValueError": 2,
"RuntimeError": 4
},
"api_calls": 244,
"seconds": 511.24593446517247,
"wall_seconds": 131.69581339499564,
"prompt_tokens": 432376,
"completion_tokens": 66649,
"usage_missing_calls": 0,
"cost_usd": null,
"tool_calls": 109,
"schema_calls": 83,
"schema_cases": 22,
"multi_table_calls": 0,
"multi_table_cases": 0,
"cases_at_call_limit": 8,
"api_errors": {},
"actual_models": {
"gpt-4.1-2025-04-14": 244
},
"final_sql_submitted": 129,
"final_sql_executed": 49,
"final_sql_failed": 80,
"final_sql_missing": 6,
"no_such_column": 78,
"budget_without_final_sql": 6,
"first_response_final_sql": 113,
"run_sql_calls": 16
},
"treatment": {
"profile": "openai-gpt41",
"status": "completed",
"correct": 16,
"total": 135,
"accuracy": 0.11851851851851852,
"failed_predictions": 90,
"failure_types": {
"OperationalError": 88,
"ValueError": 2
},
"api_calls": 194,
"seconds": 553.2603232758411,
"wall_seconds": 139.48074963100953,
"prompt_tokens": 367232,
"completion_tokens": 66184,
"usage_missing_calls": 0,
"cost_usd": null,
"tool_calls": 59,
"schema_calls": 35,
"schema_cases": 21,
"multi_table_calls": 20,
"multi_table_cases": 18,
"cases_at_call_limit": 1,
"api_errors": {},
"actual_models": {
"gpt-4.1-2025-04-14": 194
},
"final_sql_submitted": 133,
"final_sql_executed": 45,
"final_sql_failed": 88,
"final_sql_missing": 2,
"no_such_column": 81,
"budget_without_final_sql": 1,
"first_response_final_sql": 114,
"run_sql_calls": 22
},
"gained": 7,
"lost": 13,
"accuracy_delta_pct_points": -4.4444444444444455,
"settings": {
"profiles": [
{
"name": "openai-gpt41",
"model": "openai/gpt-4.1-2025-04-14",
"api_key_env": "OPENAI_API_KEY"
}
],
"max_calls": 8,
"call_timeout": 120.0,
"case_timeout": 480.0,
"sql_timeout": 30.0,
"max_rows": 100000,
"concurrency": 4,
"instruction": "\nReturn your final answer as exactly one fenced ```sql block containing the single read-only SQLite SELECT/WITH query that answers the question. Do not include exploratory SQL in the final answer. Use the supplied documentation; no user simulator is available.",
"max_output_tokens": 4096,
"runner_sha256": "0db2a6861ddd6b63d213bb709979cb3a904b4a60e38083e3ffa8a30ebe283f18",
"provider_sha256": "9a7e08a6c0a0d8e1f2f0eac8a53fcfa29221143f2cc93f11afa782b8aa77c08b"
},
"paired_final_sql_states": {
"executed->executed": 32,
"executed->execution_failed": 15,
"executed->not_submitted": 2,
"execution_failed->executed": 10,
"execution_failed->execution_failed": 70,
"not_submitted->executed": 3,
"not_submitted->execution_failed": 3
},
"paired_first_response": {
"tool_to_final_sql": 13,
"final_sql_to_tool": 12
}
}
},
"dataset": {
"upstream_commit": "cafb867313aab4e674652054198f383cf4018943",
"cases": 135,
"databases": 30,
"manifest_sha256": "ea169d82a5473ddbdbecebe8460841502480bca63f3efbfedc955ac558e4a67a",
"official_scorer_sha256": "e93624e4ffa00e51c67bdee1d9e42b534630087cb453270c0dedc0c73e618480",
"gold_config_sha256": "5113ddaea6107492c08a898241a9f69ec99b03bc60d014e9f0b12ec59fa28970",
"seeded_case_order": 20261114,
"total_scored_runs": 540
}
}
Loading