NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Syntax Without Semantics: Teaching LLMs to Code in an Unseen Language

Vinayshekhar Bannihatti Kumar, Disha Makhija, Manoj Ghuhan Arivazhagan, Rashmi Gangadharaiah

TL;DR

Researchers have identified an "implementation fidelity gap" in LLMs: while models can transfer high-level algorithmic reasoning to a completely new programming language, they struggle to translate that reasoning into working code. Even with extensive fine-tuning and advanced training interventions, a significant performance gap remains between a model's ability in a familiar language like Python versus a novel, unseen language like PyLang.

What Problem Does This Paper Address?

LLMs are remarkably good at coding in popular languages like Python or Java, but it’s unclear if they are actually "reasoning" or just reciting patterns from their massive pretraining corpora. This poses a challenge for emerging languages (like Mojo or Carbon) or proprietary domain-specific languages (DSLs) where training data is scarce.

The authors investigate a fundamental question: Does pretraining endow models with general algorithmic reasoning that can be easily "plugged into" a new syntax, or is their reasoning ability inextricably tied to the specific languages they saw during training?

Methods

To isolate the effects of pretraining, the authors created PyLang, a minimal imperative language designed to be absent from all existing pretraining data.

  • Language Design: PyLang uses familiar C/JavaScript-style syntax (curly braces, semicolons) to make syntax acquisition easy, but it features "impoverished semantics." It lacks for loops, list comprehensions, and a standard library. Every operation—from string-to-integer conversion to sorting—must be built from scratch using while loops and basic arithmetic.
Table 1: Feature comparison and illustrative example showing PyLang’s (PL) deliberately impoverished semantics.
  • Training & Evaluation: The team fine-tuned Qwen3 models (4B to 32B) on parallel Python and PyLang solutions. They also evaluated frontier models (GPT-5.4, Claude Sonnet 4.5) zero-shot by providing the language specification in the prompt.
  • Interventions: They tested several methods to close the performance gap, including multi-task learning with intermediate reasoning (Chain-of-Thought), preference tuning (DPO and GRPO), code infilling, and latent-space objectives (JEPA).
  • Analysis: They used an LLM judge to determine if models were choosing the same algorithm across languages and employed Centered Kernel Alignment (CKA) to compare the models' internal representations.

Datasets

The study utilized a parallel corpus of 2,250 training problems and 352 test problems, each with verified solutions in both Python and PyLang.

  • Codeforces: 251 problems used for in-distribution evaluation.
  • MBPP (Mostly Basic Python Problems): 101 problems used for out-of-distribution evaluation.
  • Test Suite: A total of 771 test cases were used to verify functional correctness.

Key Insights and Ideas

  • Syntax is Easy, Semantics is Hard: Fine-tuning quickly eliminates syntax errors (the code "looks" right and parses), but the models fail to produce code that actually works.
  • The Implementation Fidelity Gap: This is the paper's core finding. An LLM judge found that frontier models select the identical algorithm for PyLang and Python 80% of the time. However, they simply cannot express that algorithm correctly in the new language.
  • Internal Representations are Language-Agnostic: CKA analysis revealed that fine-tuned PyLang and Python models converge to nearly identical internal representations (CKA > 0.97). The models "know" what to do internally, but the "translation" to the output tokens fails.
  • Data Saturation: Adding more PyLang data doesn't help. Performance saturates quickly, leaving a persistent 13–20% gap compared to Python. This suggests the bottleneck isn't a lack of examples, but a fundamental inability to decouple reasoning from the pretraining language prior.
Table 5: PyLang problem pass rate (%) vs. fraction of the 2,250-example training set. Perfor- mance saturates far below Python (47.7% for 4B, 57.4% for 8B).

Key Results

The "Python advantage" is pervasive across all model sizes and training strategies.

  • Performance Deficit: Python consistently outperformed PyLang by up to 19% in fine-tuned models. Even the most capable frontier model, Sonnet 4.5, showed a 30% deficit in PyLang compared to Python.
  • Failure of Interventions: None of the targeted interventions (DPO, GRPO, Infilling) closed the gap. In some cases, preference tuning actually widened the gap because the model had fewer "correct" PyLang examples to learn from.
  • Error Decomposition: For Sonnet 4.5, 75% of failures were "language barriers"—meaning the model had the right algorithm but made implementation errors like off-by-one errors or incorrect input parsing.
Table 2: Performance comparison (in %) across PyLang and Python on Codeforces and MBPP benchmarks (best checkpoint across 3 epochs).

Limitations and Future Work

The authors acknowledge that PyLang, while novel, still shares some syntactic DNA with C and JavaScript. A language with a completely foreign paradigm (e.g., a stack-based language like Forth or a functional language like Haskell) might show an even wider gap.

The study was also limited to the Qwen3 family for fine-tuning. Future work could explore whether different architectures or training objectives—specifically those that explicitly decouple algorithmic planning from code emission—can bridge this implementation fidelity gap. The authors suggest that modular architectures or language-conditioned decoding might be the most promising paths forward.

Summary updated

BibTeX
@inproceedings{kumar2026syntax,
  author = {Vinayshekhar Bannihatti Kumar and Disha Makhija and Manoj Ghuhan Arivazhagan and Rashmi Gangadharaiah},
  title = {{Syntax Without Semantics: Teaching LLMs to Code in an Unseen Language}},
  booktitle = {COLM},
  year = {2026},
  url = {https://openreview.net/forum?id=ielFjUVr8O},
}
Figure