ORCA: Evaluating LLMs on Data Science Code Translation
Organizations: The University of Hong Kong · National University of Singapore · The Chinese University of Hong Kong, Shenzhen
Abstract
Data Science Code Translation (DSCT) is the process of converting code between data science libraries while preserving functional equivalence and enabling interoperability across data science ecosystems. While Large Language Models (LLMs) have demonstrated considerable progress in Data Science Code Generation (DSCG), their performance in DSCT remains insufficiently studied. To address this gap, we introduce ORCA, a comprehensive benchmark with two complementary settings: ORCA-MAIN, which comprises 1,600 carefully curated grounding-level tasks across 3 representative domains: Data Querying, Data Manipulation, and Deep Learning; and ORCA-PROJECT, which contains 200 translation tasks over complete data science projects across 7 data science task types. Each task is accompanied by annotated reference translations and test cases for validating functional equivalence. We further incorporate a multi-stage quality verification process that thoroughly verifies task correctness and test case robustness. Experimental results demonstrate challenges in DSCT, with even frontier LLMs showing limited performance. Specifically, Claude-Opus-4.6 achieves a success rate of 56.92% on ORCA-MAIN and 33.67% on ORCA-PROJECT, indicating considerable room for improvement in DSCT. We also observe a clear directional preference in DSCT, where translation is consistently easier when the source code expresses the task through more explicit, fine-grained operations. Motivated by this, we propose an intent-augmented method, in which the model first infers source-code intent and then uses it as additional context for translation, achieving average absolute success-rate gains of 4.80% and 5.33% on ORCA-MAIN and ORCA-PROJECT, respectively.
Figures & tables
| Statistic | Main | Project |
|---|---|---|
| Total Tasks | 1,600 | 200 |
| Avg. Source-Code Tokens | 988 | 8439 |
| # Distinct Test Cases | 5598 | 2406 |
| # DS Libraries | 5 | 21 |
| # Distinct APIs | 496 | 615 |
| # Databases | 31 | 26 |
| Model | Data Querying | Data Manipulation | Deep Learning | Overall |
|---|---|---|---|---|
| Popular Open-Source Models | ||||
| Qwen2.5-Coder-7B | ||||
| Llama-3.1-8B | ||||
| Ministral-14B | ||||
| Phi-4 | ||||
| Gemma-3-27B | ||||
| ORCA-Main | ORCA-Project | |||||
|---|---|---|---|---|---|---|
| Model | Baseline | CoT-Intent | Intent | Baseline | CoT-Intent | Intent |
| Qwen2.5-Coder-32B | ||||||
| Llama-3.1-70B | ||||||
| DeepSeek-V3 | ||||||
| Kimi-K2.5 | ||||||
| Claude-Opus-4.6 | ||||||
Appendix figures & tables30 assets
Supplementary material from the paper’s appendix.
Appendix
| Benchmark | Level | # Instances | # DS Libraries | Avg. Test Cases / Task | Avg. Lines | Data Source |
| Data Science Code Generation | ||||||
| DSP [ 6 ] | Snippet | 1,119 | 8 | 2.1 | 4.5 | Notebooks |
| DS-1000 [ 25 ] | Snippet | 1,000 | 7 | 1.6 | 3.6 | Stack Overflow |
| DA-Code [ 18 ] | File | 500 | 10 | — | 85 | Kaggle / GitHub |
| InfiAgent-DABench [ 16 ] | File | 603 | 4 | — | — | GitHub (CSV) |
| DSCodeBench [ 23 ] | Snippet | 1,000 | 10 | 200 | 22.5 | GitHub |
| Library | Version | Library | Version |
|---|---|---|---|
| pandas | 2.1.4 | numpy | 1.26.4 |
| polars | 0.20.31 | pyarrow | 22.0.0 |
| torch | 2.8.0 | tensorflow | 2.15.0 |
| xgboost | 2.0.3 | lightgbm | 4.2.0 |
| scikit-learn | 1.7.2 | catboost | 1.2.2 |
| mord | 0.7 | sqlalchemy | 2.0.45 |
| Source Code | Baseline | CoT-Intent | Intent |
|---|---|---|---|
| DQ ⬇ -- (... 18 lines above ...) WITH TransplantData AS (...), CenterAverages AS (...) SELECT ... -- (... 12 lines omitted ...) Core challenge: multi-CTE + JSON + strict output schema. | ⬇ # (... 20 lines above ...) final_df = mismatch_cases . merge (...) final_df = final_df . sort_values (...) final_df = final_df . assign (... round (...)) # round # (... 8 lines omitted ...) Failed : output-format mismatch. | ⬇ # (... 18 lines above ...) def safe_json_extract (...): ... center_averages = (...). groupby (...). mean () result_df = (...). assign (... Decimal (...)) # (... 6 lines omitted ...) Passed | ⬇ # (... 15 lines above ...) result_df = result_df . rename (...) result_df [ ’avg_risk...’ ] = ... round (4) # avg_risk result_df = result_df . sort_values (...) # (... 7 lines omitted ...) Failed : format/order mismatch. |
| DM ⬇ # (... 22 lines above ...) daily_stats = groupby (...). resample ( ’D’ ). agg (...) rolling_corr = groupby (...). rolling (...). corr (...) merged_df = reset_daily_stats . merge (...) # (... 10 lines omitted ...) Core challenge: grouped time-index alignment. | ⬇ # (... 14 lines above ...) rolling_corr = np . full ((..., 31), np . nan ) ... rolling_corr [ group , ts //24] = corr # ts//24 # (... 6 lines omitted ...) Failed : fixed day-axis causes index overflow. | ⬇ # (... 14 lines above ...) daily_stats = np . zeros (..., dtype = np . float64 ) result = np . zeros (..., dtype = np . float64 ) result = np . round ( result , 4) # (... 6 lines omitted ...) Passed | ⬇ # (... 11 lines above ...) result = np . zeros (( GROUPS , 6)) rolling_corr = np . corrcoef (...) result = np . round ( result , 4) # (... 7 lines omitted ...) Passed |
| DL ⬇ # (... 16 lines above ...) class ResidualBlock ( nn . Module ): ... self . shortcut = nn . Sequential (...) class BatchSizeAware ResNet (...): ... # (... 10 lines omitted ...) Core challenge: shortcut + training-mode behavior. | ⬇ # (... 9 lines above ...) self . shortcut = layers . Sequential (...) self . shortcut = layers . Sequential ([...]) # layers.Sequential # (... 5 lines omitted ...) Failed : invalid API path. | ⬇ # (... 20 lines above ...) def call ( self , x ): out = self . bn2 ( out ) # bn2(out) out += self . shortcut ( identity ) # (... 15 lines omitted ...) Failed : training-state unresolved. | ⬇ # (... 12 lines above ...) class ResidualBlock ( tf . keras . Model ): self . shortcut = tf . keras . Sequential ([...]) def call ( self , x , training = None ): out = self . bn1 ( out , training = training ) # (... 8 lines omitted ...) Passed |
| Model | Pass@1 | Pass@k | ||
|---|---|---|---|---|
| SR (%) | Cost (USD) | SR (%) | Cost (USD) | |
| Gemma-3-27B | 23.94 | $0.45 | 25.25 | $1.47 |
| DeepSeek-R1 | 48.12 | $2.66 | 50.62 | $8.01 |
| MySQL PostgreSQL | MySQL SQLite | PostgreSQL SQLite | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Model | My PG | PG My | My SQ | SQ My | PG SQ | SQ PG | ||||
| Qwen2.5-Coder-7B | 52.2 | 45.0 | 7.20 | 71.2 | 53.8 | 17.40 | 57.4 | 52.8 | 4.60 | 9.73 |
| Llama-3.1-8B | 47.6 | 46.0 | 1.60 | 62.2 | 47.6 | 14.60 | 53.2 | 47.8 | 5.40 | 7.20 |
| Ministral-14B | 51.4 | 46.0 | 5.40 | 60.2 | 47.2 | 13.00 | 52.2 | 49.4 | 2.80 | 7.07 |
| Phi-4 | 49.8 | 43.8 | 6.00 | 60.6 | 52.2 | 8.40 | 48.4 | 51.8 | 3.40 | 5.93 |
| Gemma-3-27B | 52.0 | 48.6 | 3.40 | 68.0 | 53.2 | 14.80 | 57.6 | 52.8 | 4.80 | 7.67 |
| Model | Overall |
|---|---|
| Popular Open-Source Models | |
| Phi-4 | |
| Qwen2.5-Coder-32B | |
| Llama-3.1-70B | |
| GLM-4.7 | |
| DeepSeek-V3 | |
| Bin | #Tasks | Avg. Comp. | Opus-4.6 | Sonnet-4.5 | DS-V3 | Kimi-K2.5 | Avg. |
|---|---|---|---|---|---|---|---|
| Low | 66 | 29.45 | 46.97 | 39.39 | 22.73 | 31.82 | 35.23 |
| Medium | 66 | 79.33 | 27.27 | 28.79 | 16.67 | 24.24 | 24.24 |
| High | 68 | 237.79 | 26.47 | 16.18 | 14.71 | 16.18 | 18.38 |
| High–Low Change | – | – | -20.50 | -23.21 | -8.02 | -15.64 | -16.85 |
| Bin | # Tasks | Avg. Comp. | Opus-4.6 | Sonnet-4.5 | DS-V3 | Kimi-K2.5 | Avg. |
|---|---|---|---|---|---|---|---|
| Low | 20 | 35.60 | 50.00 | 35.00 | 20.00 | 40.00 | 36.25 |
| Medium | 20 | 78.70 | 35.00 | 30.00 | 18.00 | 35.00 | 29.50 |
| High | 22 | 200.82 | 22.73 | 13.64 | 13.64 | 13.64 | 15.91 |
| High–Low Change | – | – | -27.27 | -21.36 | -6.36 | -26.36 | -20.34 |
| Data Querying | Data Manipulation | Deep Learning | |||||||
| Model | Pd PG | PG Pd | NP Pd | Pd NP | TF PT | PT TF | |||
| Popular Open-Source Models | |||||||||
| Qwen2.5-Coder-7B | 15.54 | 7.80 | +7.74 | 28.34 | 6.10 | +22.24 | 27.74 | 18.92 | +8.82 |
| Llama-3.1-8B | 9.30 | 5.14 | +4.16 | 20.35 | 2.31 | +18.04 | 22.77 | 14.23 | +8.54 |
| Ministral-14B | 26.86 | 9.36 | +17.50 | 42.05 | 14.61 | +27.44 | 23.96 | 14.70 | +9.26 |
| Phi-4 | 35.57 | 19.99 | +15.58 | 37.64 | 13.48 | +24.16 | 31.93 | 19.41 | +12.52 |
| Translation direction | Direct | Multi-step or indirect |
|---|---|---|
| PostgreSQL Pandas | 2,521 (70.48%) | 1,056 (29.52%) |
| Pandas PostgreSQL | 2,746 (99.35%) | 18 (0.65%) |
| NumPy Pandas | 1,449 (65.80%) | 753 (34.20%) |
| Pandas NumPy | 550 (42.05%) | 758 (57.95%) |
| PyTorch TensorFlow | 2,665 (99.22%) | 21 (0.78%) |
| TensorFlow PyTorch | 2,546 (96.66%) | 88 (3.34%) |
| ORCA-Main | ORCA-Project | ||||
|---|---|---|---|---|---|
| Core operations/functions | Tasks | Share | Files translated | Tasks | Share |
| 1 | 41 | 2.6% | 3 | 16 | 8.0% |
| 2–10 | 530 | 33.1% | 4 | 127 | 63.5% |
| 11–22 | 519 | 32.4% | 5 | 51 | 25.5% |
| 23 | 510 | 31.9% | 6 | 6 | 3.0% |
| Domain | Simple | Moderate | Difficult |
|---|---|---|---|
| Data Querying | 180 / 45.21 | 234 / 40.68 | 186 / 33.13 |
| Data Manipulation | 189 / 39.35 | 233 / 37.50 | 178 / 34.59 |
| Deep Learning | 124 / 54.23 | 153 / 26.67 | 123 / 17.33 |
| Overall | 493 / 45.23 | 620 / 36.03 | 487 / 29.67 |
| Domain | Direction | GPT-5.5 | Claude-Opus-4.6 |
|---|---|---|---|
| DQ | PostgreSQL Pandas | 34/50 (68%) | 34/50 (68%) |
| DQ | Pandas PostgreSQL | 35/50 (70%) | 22/50 (44%) |
| DM | NumPy Pandas | 29/50 (58%) | 27/50 (54%) |
| DM | Pandas NumPy | 16/50 (32%) | 11/50 (22%) |
| DL | PyTorch TensorFlow | 16/50 (32%) | 14/50 (28%) |
| DL | TensorFlow PyTorch | 28/50 (56%) | 22/50 (44%) |
| Model | Prompt | DQ | DM | DL | Overall |
|---|---|---|---|---|---|
| GPT-5.5 | Baseline | 69 | 45 | 44 | 52.67 |
| Detailed-Criteria | 71 (+2) | 56 (+11) | 35 (-9) | 54.00 (+1.33) | |
| Library-Version | 68 (-1) | 48 (+3) | 37 (-7) | 51.00 (-1.67) | |
| Claude-Opus-4.6 | Baseline | 56 | 38 | 36 | 43.33 |
| Detailed-Criteria | 58 (+2) | 42 (+4) | 39 (+3) | 46.33 (+3.00) | |
| Library-Version | 56 (0) | 40 (+2) | 39 (+3) | 45.00 (+1.67) |
| Domain | Direction | Direct SR | Agent SR | |
|---|---|---|---|---|
| DQ | PostgreSQL Pandas | 68 | 70 | +2 |
| DQ | Pandas PostgreSQL | 44 | 58 | +14 |
| DM | NumPy Pandas | 54 | 56 | +2 |
| DM | Pandas NumPy | 22 | 24 | +2 |
| DL | PyTorch TensorFlow | 28 | 34 | +6 |
| DL | TensorFlow PyTorch | 44 | 52 | +8 |
| Subset | Baseline SR | Claude Code SR | Baseline cost | Claude Code cost |
|---|---|---|---|---|
| Data Querying | 56.0 | 69.0 | – | – |
| Data Manipulation | 38.0 | 45.0 | – | – |
| Deep Learning | 36.0 | 44.0 | – | – |
| ORCA-Main overall | 43.33 | 52.67 | $6.72 | $202.88 |
| ORCA-Project | 17.0 | 26.0 | $46.84 | $164.89 |
| Total cost | – | – | $53.56 | $367.77 |
| Failure pattern | Share | Definition |
|---|---|---|
| Data or interface mismatch | 58.1% | Incorrect columns, schema, container, public interface, shape, axis, layout, dtype, precision, or null behavior. |
| Logic or behavior mismatch | 22.9% | Executable code with incorrect query or algorithmic logic, train/eval behavior, randomness, or gradient behavior. |
| Incomplete or invalid implementation | 19.0% | Missing imports, helpers, or definitions; invalid target-library APIs; or failed execution. |
| Failure pattern | Claude Code | Baseline |
|---|---|---|
| Data or interface mismatch | 85/142 (59.9%) | 99/170 (58.2%) |
| Logic or behavior mismatch | 32/142 (22.5%) | 44/170 (25.9%) |
| Incomplete or invalid implementation | 25/142 (17.6%) | 27/170 (15.9%) |
| Failure pattern | Claude Code | ReAct baseline |
|---|---|---|
| Cross-stage interface | 35/74 (47.3%) | 35/83 (42.2%) |
| Local data semantics | 5/74 (6.8%) | 7/83 (8.4%) |
| Output or project contract | 30/74 (40.5%) | 39/83 (47.0%) |
| Modeling, implementation, or execution | 4/74 (5.4%) | 2/83 (2.4%) |
| Failure pattern | Share | Definition |
|---|---|---|
| Cross-stage interface | 38% | Incompatible schema, dtype, shape, ordering, preprocessing state, train–inference alignment, or I/O between an identifiable producer and consumer. |
| Local data semantics | 38% | Incorrect query, transformation, split, leakage decision, feature computation, or numerical operation within 1 stage. |
| Output or project contract | 13% | Violation of a required output schema, formatting, cardinality, file, function, class, signature, entry point, or return format. |
| Modeling, implementation, or execution | 11% | Errors in model construction, training, prediction, loss or metric behavior, completeness, API usage, or execution. |
| Cross-stage interface | Local data semantics | ||
|---|---|---|---|
| Subtype | Share | Subtype | Share |
| Column or schema | 72.44% | Field/nested-value extraction | 56.39% |
| Train–inference alignment | 50.67% | Completeness/missing values | 37.44% |
| Dtype | 39.11% | Parsing/type conversion | 32.60% |
| Feature or value ordering | 24.44% | Query/filter/join/aggregation | 30.84% |
| Serialization or stage I/O | 16.44% | Split/sampling/leakage | 25.99% |
Code Translation
Code translation converts programs between languages, frameworks, and representations while aiming to preserve behavior and sometimes improve safety or performance.
See all 42 papers