BIRD-Persona: A Persona-Aware Benchmark for SQL and pandas Analytics Code Generation
Organizations: Optum AI
Abstract
Production text-to-code systems use large language models to turn natural-language analytics requests into executable SQL and pandas code. Existing benchmarks cover both tasks but do not isolate when performance diverges between them. We introduce BIRD-Persona, a persona-stratified extension of BIRD-Python that adds novice and expert rewrites to tasks with matched SQL and pandas ground truth, along with schema variants and task-structure annotations. Across 1,534 tasks, nine models, and 245,592 evaluations, SQL outperforms pandas for eight of nine systems. The gap varies by condition: expert, schema-explicit prompts improve both paradigms but help SQL more; schema representations have mixed, model-dependent effects; and selected-column burden widens the gap while subqueries do not. By making user phrasing a controlled benchmark dimension, BIRD-Persona supports persona-aware and paradigm-aware evaluation of natural-language analytics systems. The dataset is available at https://huggingface.co/datasets/optum-cognition-lab/BIRD-Persona.
Figures & tables
| Dimension | Novice | Expert |
|---|---|---|
| Schema/Scope | Business terms | Table and column names |
| Values | Approximate dates or values | Formats, units, constants |
| Logic | Implicit grain, ties, nulls | Explicit grain, ties, nulls |
| Output Specificity | Minimal presentation detail | Sort, limits, column order |
| Condition pair | BLEU-4 | BLEU-2 | Jaccard |
|---|---|---|---|
| Original-novice | 0.108 | 0.254 | 0.307 |
| Original-expert | 0.008 | 0.025 | 0.078 |
| Novice-expert | 0.005 | 0.018 | 0.066 |
| Feature | Mean | Median | Max | Std |
|---|---|---|---|---|
| Columns | 4.71 | 5 | 30 | 2.08 |
| Tables | 1.96 | 2 | 5 | 0.72 |
| WHERE predicates | 1.54 | 1 | 8 | 0.95 |
| Join pairs | 0.96 | 1 | 6 | 0.79 |
| Aggregations | 0.61 | 0 | 5 | 0.78 |
| Scalar functions | 1.06 | 1 | 23 | 1.76 |
| Database | Simple | Moderate | Challenging | Overall |
|---|---|---|---|---|
| california_schools | 10 | 12 | 16 | 11 |
| card_games | 8 | 12 | 13 | 9 |
| codebase_community | 8 | 11 | 14 | 9 |
| debit_card_specializing | 9 | 15 | 20 | 11 |
| european_football_2 | 9 | 12 | 16 | 11 |
| financial | 13 | 17 | 22 | 15 |
| Model | pandas | SQL |
|---|---|---|
| Gemini-2.5-Flash | 0.674 (0.004) | 0.741 (0.004) |
| Gemini-2.5-Pro | 0.714 (0.004) | 0.765 (0.004) |
| Gemma-4-26B | 0.666 (0.004) | 0.623 (0.004) |
| GPT-5-Mini | 0.612 (0.004) | 0.714 (0.004) |
| GPT-5.1 | 0.634 (0.004) | 0.721 (0.004) |
| Qwen3-14B | 0.500 (0.004) | 0.690 (0.004) |
| Factor | Condition | pandas | SQL |
|---|---|---|---|
| Persona | Expert | 0.766 (0.002) | 0.889 (0.002) |
| Novice | 0.494 (0.002) | 0.561 (0.002) | |
| Original | 0.553 (0.002) | 0.634 (0.002) | |
| Schema | Original DDL | 0.608 (0.002) | 0.704 (0.002) |
| Schema | 0.602 (0.002) | 0.691 (0.002) | |
| SchemaLLM | 0.604 (0.002) | 0.689 (0.002) |
| Main Effects | Interaction Effects | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Model | pandas | PS | SCS | Schema | SchemaLLM | pandas PS | pandas SCS | pandas Schema | pandas SchemaLLM |
| Gemini-2.5-Flash | -1.10 | 1.84 | -0.54 | 0.32 | 0.24 | -0.82 | -0.07 | -0.16 | -0.13 |
| Gemini-2.5-Pro | -1.39 | 2.02 | -0.53 | 0.05 | -0.02 | -0.63 | 0.03 | 0.30 | 0.37 |
| Gemma-4-26B | 0.02 | 0.88 | -0.50 | -0.52 | -0.47 | 0.11 | -0.06 | 0.72 | 0.71 |
| GPT-5-Mini | -1.34 | 2.22 | -0.13 | 0.07 | -0.06 | -0.52 | -0.10 | -0.22 | -0.08 |
| GPT-5.1 | -1.51 | 2.20 | -0.32 | 0.06 | 0.01 | -0.67 | 0.12 | 0.08 | 0.11 |
| Model | pandas SUBQUERY | pandas COLUMN | pandas SCALAR | pandas JOIN |
|---|---|---|---|---|
| Gemini-2.5-Flash | 1.37 | -0.18 | 0.10 | -0.01 |
| Gemini-2.5-Pro | 0.71 | -0.11 | 0.29 | -0.07 |
| Gemma-4-26B | 2.39 | -0.52 | -0.23 | 0.39 |
| GPT-5-Mini | 0.18 | -0.23 | 0.22 | -0.02 |
| GPT-5.1 | 0.85 | 0.08 | 0.26 | -0.29 |
| Qwen3-14B | 1.05 | -0.53 | -0.13 | -0.06 |
Appendix figures & tables12 assets
Supplementary material from the paper’s appendix.
Appendix
| Condition | Mean score | Median score | Mean words | Median words |
|---|---|---|---|---|
| Original | 0.635 | 0.630 | 14.5 | 14.0 |
| Novice | 0.567 | 0.570 | 14.3 | 14.0 |
| Expert | 0.960 | 0.971 | 57.6 | 56.0 |
| Model | SQL error rate | pandas error rate |
|---|---|---|
| Gemini-2.5-Pro | 0.3% | 3.6% |
| Gemini-2.5-Flash | 1.7% | 7.0% |
| GPT-5.1 | 1.9% | 4.0% |
| GPT-5-Mini | 1.9% | 2.2% |
| Qwen3-14B | 4.2% | 19.7% |
| Qwen3-8B | 5.0% | 19.1% |
| Expert | Novice | Original | ||||
|---|---|---|---|---|---|---|
| Model | pandas | SQL | pandas | SQL | pandas | SQL |
| Gemini-2.5-Flash | 0.803 (0.006) | 0.915 (0.004) | 0.576 (0.007) | 0.616 (0.007) | 0.641 (0.007) | 0.692 (0.007) |
| Gemini-2.5-Pro | 0.856 (0.005) | 0.924 (0.004) | 0.608 (0.007) | 0.647 (0.007) | 0.679 (0.007) | 0.722 (0.007) |
| Gemma-4-26B | 0.809 (0.006) | 0.766 (0.006) | 0.565 (0.007) | 0.520 (0.007) | 0.623 (0.007) | 0.581 (0.007) |
| GPT-5-Mini | 0.843 (0.005) | 0.928 (0.004) | 0.454 (0.007) | 0.568 (0.007) | 0.541 (0.007) | 0.645 (0.007) |
| GPT-5.1 | 0.831 (0.006) | 0.927 (0.004) | 0.503 (0.007) | 0.575 (0.007) | 0.569 (0.007) | 0.661 (0.007) |
| DDL (Baseline) | Schema | SchemaLLM | ||||
|---|---|---|---|---|---|---|
| Model | pandas | SQL | pandas | SQL | pandas | SQL |
| Gemini-2.5-Flash | 0.664 (0.007) | 0.726 (0.007) | 0.681 (0.007) | 0.752 (0.006) | 0.675 (0.007) | 0.745 (0.006) |
| Gemini-2.5-Pro | 0.694 (0.007) | 0.764 (0.006) | 0.725 (0.007) | 0.767 (0.006) | 0.725 (0.007) | 0.763 (0.006) |
| Gemma-4-26B | 0.649 (0.007) | 0.666 (0.007) | 0.672 (0.007) | 0.598 (0.007) | 0.677 (0.007) | 0.604 (0.007) |
| GPT-5-Mini | 0.622 (0.007) | 0.714 (0.007) | 0.607 (0.007) | 0.719 (0.007) | 0.607 (0.007) | 0.708 (0.007) |
| GPT-5.1 | 0.625 (0.007) | 0.720 (0.007) | 0.640 (0.007) | 0.724 (0.007) | 0.637 (0.007) | 0.720 (0.007) |
| Values | model_id | (Intercept) | pandas | pandas Schema | pandas SchemaLLM | pandas SCS | pandas PS | Schema | SchemaLLM | SCS | PS |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Coefficient | Gemini-2.5-Flash | 2.68 | -1.1 | -0.158 | -0.13 | -0.0727 | -0.825 | 0.321 | 0.239 | -0.54 | 1.84 |
| Gemini-2.5-Pro | 3.61 | -1.39 | 0.298 | 0.366 | 0.0252 | -0.635 | 0.0499 | -0.0155 | -0.525 | 2.02 | |
| Gemma-4-26B | 1.32 | 0.0168 | 0.721 | 0.71 | -0.0571 | 0.111 | -0.52 | -0.466 | -0.503 | 0.877 | |
| GPT-5-Mini | 2.6 | -1.34 | -0.219 | -0.0787 | -0.0958 | -0.524 | 0.0747 | -0.0635 | -0.133 | 2.22 | |
| GPT-5.1 | 2.73 | -1.51 | 0.0827 | 0.106 | 0.118 | -0.673 | 0.0604 | 0.00821 | -0.315 | 2.2 | |
| Qwen3-14B | 1.94 | -1.82 | -0.0789 | -0.109 | -0.377 | -0.887 | -0.0802 | -0.0348 | -0.401 | 1.73 |
| Model | AIC | BIC | Log Likelihood | AUROC |
|---|---|---|---|---|
| Gemini-2.5-Flash | 20988.64 | 21103.64 | -10480.32 | 0.947 |
| Gemini-2.5-Pro | 18366.91 | 18481.91 | -9169.45 | 0.960 |
| Gemma-4-26B | 25770.22 | 25885.22 | -12871.11 | 0.918 |
| GPT-5-Mini | 20927.93 | 21042.93 | -10449.97 | 0.951 |
| GPT-5.1 | 21018.84 | 21133.84 | -10495.42 | 0.951 |
| Qwen3-14B | 25589.43 | 25704.43 | -12780.71 | 0.927 |
| Model | Group | Component | Variance | SD | Correlation |
|---|---|---|---|---|---|
| Gemini-2.5-Flash | Query | Intercept | 10.26 | 3.20 | - |
| pandas | 3.67 | 1.91 | - | ||
| Intercept-pandas Covariance | - | - | -0.597 | ||
| Database | Intercept | 1.24 | 1.12 | - | |
| Gemini-2.5-Pro | Query | Intercept | 13.58 | 3.68 | - |
| pandas | 3.59 | 1.90 | - |
| Value | Model | (Intercept) | pandas | pandas Schema | pandas SchemaLLM | pandas PS | Schema | SchemaLLM | PS | SUBQUERY | COLUMN | SCALAR | JOIN | pandas SUBQUERY | pandas COLUMN | pandas SCALAR | pandas JOIN |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Coefficient | Gemini-2.5-Flash | 3.14 | -1.29 | -0.159 | -0.131 | -0.831 | 0.321 | 0.239 | 1.85 | -2.06 | -0.186 | -0.474 | -0.036 | 1.37 | -0.176 | 0.0986 | -0.00701 |
| Gemini-2.5-Pro | 4.01 | -1.63 | 0.297 | 0.365 | -0.651 | 0.05 | -0.0155 | 2.04 | -1.5 | -0.339 | -0.459 | 0.235 | 0.715 | -0.107 | 0.294 | -0.0713 | |
| Gemma-4-26B | 1.61 | -0.0729 | 0.722 | 0.71 | 0.101 | -0.52 | -0.467 | 0.884 | -2.85 | 0.0213 | -0.0621 | -0.365 | 2.39 | -0.515 | -0.227 | 0.394 | |
| GPT-5-Mini | 2.54 | -1.47 | -0.219 | -0.0785 | -0.537 | 0.0748 | -0.0636 | 2.23 | -1.03 | -0.0454 | 0.327 | -0.00685 | 0.181 | -0.234 | 0.221 | -0.0219 | |
| GPT-5.1 | 2.73 | -1.73 | 0.0827 | 0.106 | -0.695 | 0.0604 | 0.00821 | 2.21 | -1.58 | -0.28 | 0.31 | 0.141 | 0.852 | 0.0758 | 0.264 | -0.287 | |
| Qwen3-14B | 2.24 | -1.84 | -0.0791 | -0.109 | -0.899 | -0.0802 | -0.0348 | 1.74 | -1.48 | 0.0306 | -0.29 | -0.12 | 1.05 | -0.53 | -0.125 | -0.0552 |
| Model | AIC | BIC | Log Likelihood | AUROC |
|---|---|---|---|---|
| Gemini-2.5-Flash | 20964.57 | 21128.86 | -10462.29 | 0.947 |
| Gemini-2.5-Pro | 18364.25 | 18528.53 | -9162.13 | 0.960 |
| Gemma-4-26B | 25506.36 | 25670.64 | -12733.18 | 0.917 |
| GPT-5-Mini | 20897.39 | 21061.68 | -10428.70 | 0.951 |
| GPT-5.1 | 20969.93 | 21134.21 | -10464.96 | 0.951 |
| Qwen3-14B | 25547.91 | 25712.19 | -12753.95 | 0.927 |
| Model | Group | Component | Variance | SD | Correlation |
|---|---|---|---|---|---|
| Gemini-2.5-Flash | Query | Intercept | 9.96 | 3.16 | - |
| pandas | 3.48 | 1.86 | - | ||
| Intercept-pandas Covariance | - | - | -0.576 | ||
| Database | Intercept | 1.23 | 1.11 | - | |
| Gemini-2.5-Pro | Query | Intercept | 13.49 | 3.67 | - |
| pandas | 3.53 | 1.88 | - |
| Model | PS coef. | PS | LRT | LRT |
|---|---|---|---|---|
| Gemini-2.5-Flash | 1.657 | 389.5 | ||
| Gemini-2.5-Pro | 1.557 | 283.4 | ||
| Gemma-4-26B | 0.682 | 240.4 | ||
| GPT-5-Mini | 1.564 | 456.7 | ||
| GPT-5.1 | 1.361 | 432.1 | ||
| Qwen3-14B | 1.155 | 335.6 |
| ID | DB | Gold SQL | Original | Novice | Expert | PS: O/N/E |
|---|---|---|---|---|---|---|
| 916 | formula_1 | SELECT surname FROM drivers WHERE nationality = ’Italian’ | Please list the surnames of all the Italian drivers. | What are the last names of the drivers from Italy? | From the drivers table, list the surname values for every row where nationality equals Italian . | 0.833 / 0.670 / 1.000 |
| 492 | card_games | SELECT type FROM sets WHERE name LIKE ’%FROM the Vault: Lore%’ | For the set “From the Vault: Lore”, what is its expansion type? | What kind of expansion is “From the Vault: Lore”? | In the sets table, find the row where name contains FROM the Vault: Lore , and return only the type column as the expansion type. | 0.730 / 0.403 / 0.944 |
| 1377 | student_club | SELECT COUNT(member_id) FROM member WHERE position = ’President’ | How many student have the position of president? | How many students are presidents? | From the member table, count rows where position equals President , using non-null member_id values. | 0.619 / 0.425 / 0.972 |
Code Generation Evaluation
Code generation evaluation measures whether AI-produced programs are correct, reliable, secure, efficient, and faithful to their specifications.
See all 233 papers