What does post-training actually teach LLMs about code? Isolating syntax, algorithms, and implementation fidelity with a novel language
2026
When we fine-tune an LLM on code in a new programming language, what actually changes inside the model? Does it learn new algorithms, new syntax, or does it develop the ability to faithfully implement known algorithms in an unfamiliar language? This question is hard to answer with existing languages because we cannot disentangle what the model learned from fine-tuning versus what it already knew from pretraining. We introduce \textbf{PyLang}, a novel programming language the model has never seen, and fine-tune Qwen~3 models (4B, 8B) on 2,250 examples. By comparing each model's Python output (pretraining + fine-tuning knowledge) against its PyLang output (fine-tuning knowledge only), we isolate exactly what fine-tuning contributes. We find three surprising results: (1)~On in-distribution problems, 2,250 PyLang examples are sufficient to match Python performance---closing the gap entirely; (2)~Out of distribution, a persistent $\sim$19pp gap remains, and seven distinct interventions (infilling, multi-token prediction, LLM-JEPA, plan-then-code training, easy-only data, and restricted Python prompting) all fail to close it; (3)~An LLM judge analysis reveals that models produce fundamentally different algorithms in PyLang vs.\ Python for 64--75\% of problems, with cross-language algorithmic agreement as low as 25--33\%. Interpretability analysis on the 8B models confirms that PyLang fine-tuning requires substantially more representational restructuring than Python fine-tuning, yet both models converge to nearly identical internal problem representations. These findings suggest that the bottleneck in cross-language code generation is not syntax or algorithm selection, but \emph{implementation fidelity}---the ability to translate a correct algorithm into bug-free code in an unfamiliar language.
Research areas