Variable names provide priors: semantic grounding enables data-efficient numerical prediction by large language models
Organizations: School of Highway, Chang’an University, Xi’an 710064, China · School of Civil Engineering, Southeast University, Nanjing 211189, China · Institute for Risk and Reliability, Leibniz University Hannover, Hannover, 30167, Germany · Department of Civil and Environmental Engineering, University of Liverpool, Liverpool, L69 3GH, United Kingdom ·
Abstract
Large language models (LLMs) have achieved strong performance across diverse tasks, from question answering to code generation. Recent studies have found that LLMs can perform numerical prediction on tabular datasets via in-context learning. However, it remains unclear under what conditions and how LLMs use variable names and in-context examples for numerical prediction. Here we show that semantic grounding, the match between variable names and the values they describe, allows five LLMs without task-specific training to match or outperform seven supervised machine learning (ML) models across 20 datasets from nine scientific domains, particularly when examples are scarce. Reasoning traces indicate that variable names allow LLMs to draw on domain-specific knowledge acquired during pretraining. Using controlled tasks based on physical formulas, we further show that LLMs integrate domain-specific knowledge with in-context examples in a way consistent with Bayesian updating. Specifically, when the relationship between the inputs and the target cannot be inferred from the examples alone, LLMs rely on domain-specific knowledge as the prior. Conversely, as contradicting examples accumulate, LLM predictions shift progressively towards these examples, which act as the likelihood. Our work reveals how LLMs use domain-specific knowledge in numerical prediction and positions them as data-efficient predictors for data-scarce scientific domains.
Figures & tables
Appendix figures & tables35 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | All six datasets | Three experimental datasets |
|---|---|---|
| at | ||
| Claude Opus 4.5 | ||
| GPT-5.2 | ||
| Gemini 3 Flash | ||
| Qwen3.5-397B | ||
| DeepSeek-V3.2 | ||
| a , Method-level performance | ||||||
|---|---|---|---|---|---|---|
| Method | ||||||
| Claude Opus 4.5 | ||||||
| GPT-5.2 | ||||||
| Gemini 3 Flash | ||||||
| Qwen3.5-397B | ||||||
| DeepSeek-V3.2 | ||||||
| Method | ||||||
|---|---|---|---|---|---|---|
| Claude Opus 4.5 | ||||||
| GPT-5.2 | ||||||
| Gemini 3 Flash | ||||||
| Qwen3.5-397B | ||||||
| DeepSeek-V3.2 | ||||||
| Median of five LLMs |
| Dataset | WAPE (pp) | WAPE (pp) | ||
|---|---|---|---|---|
| Buccolingual Diameter | ||||
| Carbon Intensity | ||||
| Corrosion Degree | ||||
| Daily Trips (Citi Bike) | ||||
| Daily Trips (Divvy) | ||||
| Number of examples | CARTE HL | Signed-rank 95% CI | Dataset-bootstrap 95% CI | Datasets improved | Five LLMs combined HL | |
|---|---|---|---|---|---|---|
| to | to | 11/20 | ||||
| to | to | 14/20 | ||||
| to | to | 15/20 | ||||
| to | to | 11/20 | ||||
| to | to | 9/20 |
| Condition | Five LLMs combined | Claude Opus 4.5 | GPT-5.2 | Gemini 3 Flash | Qwen3.5-397B | DeepSeek-V3.2 |
|---|---|---|---|---|---|---|
| Anonymised (neither) | ||||||
| Feature names only | ||||||
| Target name only | ||||||
| Correct variable names (both) | ||||||
| Contrast | HL | 95% CI (signed rank) | 95% CI (dataset bootstrap) | |||
| Feature names, target present | to | to |
| Dataset | Anonymised | Feature names | Difference | Paired |
|---|---|---|---|---|
| Buccolingual Diameter § | ||||
| Carbon Intensity § | ||||
| Corrosion Degree | ||||
| Daily Trips (Citi Bike) § | ||||
| Daily Trips (Divvy) § | ||||
| Drug–Polymer Solubility |
| Feature | Original | Feature names | Text-value | ||
|---|---|---|---|---|---|
| Dataset | Anonymised | names | values | contribution | contribution |
| Buccolingual Diameter | |||||
| Carbon Intensity | |||||
| Daily Trips (Citi Bike) | |||||
| Daily Trips (Divvy) | |||||
| Elastic Modulus (FDM) |
| Prompt condition / model | ||||||
|---|---|---|---|---|---|---|
| Anonymised | ||||||
| Median of five LLMs | ||||||
| Claude Opus 4.5 | ||||||
| GPT-5.2 | ||||||
| Gemini 3 Flash | ||||||
| Qwen3.5-397B | ||||||
| Prompt condition / model | ||||||
|---|---|---|---|---|---|---|
| Anonymised | ||||||
| Median of five LLMs | ||||||
| Claude Opus 4.5 | ||||||
| GPT-5.2 | ||||||
| Gemini 3 Flash | ||||||
| Qwen3.5-397B | ||||||
| Anonymised | Correct variable names | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| LLM | Without reasoning | With reasoning | Change | Datasets improved | Without reasoning | With reasoning | Change | Datasets improved | Output tokens | Cost ratio |
| Five LLMs combined | 46/100 | 49/100 | 1,374 | 7.2 | ||||||
| Claude Opus 4.5 | 12/20 | 12/20 | 956 | 6.2 | ||||||
| GPT-5.2 | 12/20 | 7/20 | 463 | 11.0 | ||||||
| Gemini 3 Flash | 14/20 | 8/20 | 1,167 | 11.2 | ||||||
| Qwen3.5-397B | 7/20 | 9/20 | 2,010 | 11.4 | ||||||
| Domain | Words ( ) |
|---|---|
| Structural engineering | ( ), ( ), stiffness ( ), capacity ( ), contribution ( ), failure ( ), shear ( ), steel ( ), load ( ), ACI ( ) |
| Urban mobility | weekday ( ), peak ( ), busy ( ), evening ( ), night ( ), morning ( ), popularity ( ), estimate ( ), volume ( ), popular ( ) |
| Additive manufacturing | thinner ( ), bonding ( ), stiffer ( ), stiffness ( ), harder ( ), thicker ( ), printed ( ), stiff ( ), potentially ( ), adhesion ( ) |
| Biomedicine | molecular ( ), descriptors ( ), temperature ( ), compound ( ), molecule ( ), weight ( ), compounds ( ), soluble ( ), molecules ( ), error ( ) |
| Chemistry | ( ), surface ( ), diffusion ( ), molecular ( ), descriptors ( ), law ( ), saturation ( ), Sieverts ( ), carbon ( ), distance ( ) |
| Dental morphology | teeth ( ), incisors ( ), molars ( ), deciduous ( ), permanent ( ), canines ( ), males ( ), females ( ), mandibular ( ), sexes ( ) |
| DeepSeek-V3.2 | Qwen3.5-397B | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Feature names | Probability | Terms | Domains | Own domain, % | Distance | Probability | Terms | Domains | Own domain, % | Distance |
| No names | 0.39 | 1.0 | 3.9 | 35 | 0.50 | 0.42 | 0.6 | 4.3 | 47 | 0.60 |
| 0% (target only) | 0.56 | 4.0 | 3.4 | 55 | 0.39 | 0.67 | 3.5 | 2.9 | 85 | 0.50 |
| 25% | 0.63 | 8.8 | 3.1 | 69 | 0.36 | 0.79 | 8.9 | 2.3 | 88 | 0.39 |
| 50% | 0.72 | 8.7 | 2.7 | 90 | 0.30 | 0.78 | 9.0 | 2.2 | 85 | 0.36 |
| 75% | 0.80 | 8.9 | 2.1 | 91 | 0.24 | 0.84 | 12.5 | 2.0 | 92 | 0.35 |
| Task | Field | Inputs ( then ) | Units ( , ) | ||
|---|---|---|---|---|---|
| Reaction rate | Chemistry and nuclear physics | concentration of NO concentration of O2 | mmol L -1 mmol L -1 s -1 | ||
| Beam deflection | Structural and solid mechanics | cross-section width cross-section depth in the bending direction | mm mm | ||
| Conductor resistance | Electrical engineering and communications | axial length of the conductor radius of the circular cross-section | mm | ||
| Steady conduction | Heat transfer, optics and atmosphere | side length of the square heat-transfer face conduction thickness | mm W | ||
| Laminar pipe flow | Fluid mechanics | radius of the circular channel length of the channel | m nL s -1 | ||
| Bending stress | Structural and solid mechanics | cross-section width cross-section depth in the bending direction | mm MPa |
| Task | Field | Inputs ( then ) | Relation | Constants | Units ( , ) |
|---|---|---|---|---|---|
| Linear | |||||
| Soil shear strength | Geotechnics | effective cohesion of the soil effective normal stress acting on the shear surface | kPa kPa | ||
| Cantilever moment | Structural and solid mechanics | load at the free end load at a quarter of the span from the support | m | kN kN m | |
| Bearing capacity | Geotechnics | effective cohesion of the soil overburden pressure at the footing base | ; , | kPa kPa | |
| Exponential | |||||
| Fall with linear drag | Dynamics | time elapsed since release drag time constant of the sphere | m s -1 | s mm | |
| Task | Original | Anonymous | Swapped | Separation | Positive |
|---|---|---|---|---|---|
| Power laws | |||||
| Reaction rate | [ , ] | 99/100 | |||
| Beam deflection | [ , ] | 99/100 | |||
| Conductor resistance | [ , ] | 100/100 | |||
| Steady conduction | [ , ] | 98/100 | |||
| Laminar pipe flow | [ , ] | 100/100 | |||
| Deviation from | Deviation from | Closer to | |||
|---|---|---|---|---|---|
| LLM | Separation | Positive | assigned (%) | exchanged (%) | assigned (%) |
| Claude Opus 4.5 | [1.76, 1.91] | 495/500 | 9.2 | 100.0 | 87.4 |
| GPT-5.2 | [1.37, 1.57] | 476/500 | 18.7 | 100.0 | 79.5 |
| Gemini 3 Flash | [2.00, 2.00] | 497/500 | 0.7 | 100.0 | 91.1 |
| Qwen3.5-397B | [0.92, 1.06] | 459/500 | 30.9 | 93.6 | 74.1 |
| DeepSeek-V3.2 | [0.40, 0.55] | 375/500 | 56.2 | 93.1 | 62.9 |
| Contradicting examples, | ||||||||
| Task | Condition | 0 | 1 | 2 | 3 | 4 | 5 | Prior weight |
| Power law | ||||||||
| Reaction rate | Original | [ , ] | ||||||
| Anonymous | ||||||||
| Beam deflection | Original | [ , ] | ||||||
| Anonymous | ||||||||
| Contradicting examples, | ||||||||
|---|---|---|---|---|---|---|---|---|
| LLM | Condition | 0 | 1 | 2 | 3 | 4 | 5 | Prior weight |
| Five LLMs combined | Original | [ , ] | ||||||
| Anonymous | ||||||||
| Claude Opus 4.5 | Original | [ , ] | ||||||
| Anonymous | ||||||||
| GPT-5.2 | Original | [ , ] | ||||||
| Dataset | Domain | Samples | Features | Target variable | Split |
|---|---|---|---|---|---|
| Splitting Strength | Structural engineering | 550 | 9 | Splitting tensile strength (MPa) | Random |
| Shear Force | Structural engineering | 156 | 9 | Shear force (kN) | Random |
| Max Displacement | Structural engineering | 230 | 12 | Maximum impact displacement (mm) | Random |
| MIDR (MDOF) | Structural engineering | 320 | 15 | Maximum interstorey drift ratio | Random |
| Torsional Strength | Structural engineering | 150 | 7 | Torsional strength (kN m) | Random |
| FRP–Steel Bond | Structural engineering | 113 | 12 | Ultimate bearing capacity (kN) | Random |
| Source | Datasets | DOI or access URL | Licence | First public release |
| Citi Bike system data (Jersey City) | Daily Trips (Citi Bike) | https://citibikenyc.com/system-data | Operator system-data licence | Monthly; 2026-06 slice used |
| Divvy system data (Chicago) | Daily Trips (Divvy) | https://divvybikes.com/system-data | Operator system-data licence | Monthly; 2026-06 slice used |
| MTA Bus Hourly Ridership (Beginning 2025) | Hourly Ridership | https://data.ny.gov/Transportation/MTA-Bus-Hourly-Ridership-Beginning-2025/gxb3-akrn | NY Open Data terms of use | Monthly; 2026-06 slice used |
| FDM printed specimens, mechanical properties | Elastic Modulus (FDM); Shore Hardness (FDM) | 10.17632/zd6td6svd6 (Mendeley Data) | CC BY 4.0 | 2026-07-17 |
| Nuclear graphite hydrogen uptake (Univ. Illinois Urbana–Champaign) | Hydrogen Uptake | 10.17632/wn33rrkvj4 (Mendeley Data) | CC BY 4.0 | 2026-07-23 |
| Ratón Pérez deciduous tooth collection (CENIEH, Spain) | Mesiodistal Diameter; Buccolingual Diameter | 10.5281/zenodo.17255973 (Zenodo) | CC BY 4.0 | 2025-10-03 (v1) |
| Model | Resolved identifier | Temp. | Max tokens | Reasoning |
|---|---|---|---|---|
| Claude Opus 4.5 3 | anthropic/claude-opus-4.5 | 0 | 200 | Off by default |
| GPT-5.2 4 | openai/gpt-5.2 | 0 | 200 | enabled: false |
| Gemini 3 Flash 5 | google/gemini-3-flash-preview | 0 | 200 | Off by default |
| Qwen3.5-397B 7 | qwen/qwen3.5-397b-a17b | 0 | 200 | effort: "none" |
| DeepSeek-V3.2 8 | deepseek/deepseek-v3.2 | 0 | 200 | effort: "none" |
| Supervised ML model | Hyperparameter | Search space or procedure |
| Tuned XGBoost | n_estimators | 50 to 500 (integer) |
| max_depth | 3 to 10 (integer) | |
| learning_rate | to (log-uniform) | |
| subsample | 0.6 to 1.0 | |
| colsample_bytree | 0.6 to 1.0 | |
| min_child_weight | 1 to 10 (integer) |
| Comparison | Metric | HL estimate | 95% CI (signed rank) | 95% CI (dataset bootstrap) | |
|---|---|---|---|---|---|
| LLMs versus supervised ML models across numbers of examples | |||||
| Five LLMs versus three supervised ML models, | to | to | |||
| Five LLMs versus three supervised ML models, | WAPE | to | to | ||
| Five LLMs versus three supervised ML models, | to | to | |||
| Five LLMs versus three supervised ML models, | WAPE | to | to | ||
| Five LLMs versus three supervised ML models, | to | to | |||
LLM Grounding
Large language model (LLM) grounding studies how models anchor answers and actions in evidence, structured knowledge, and real-world context.
See all 330 papers