Abstract
This paper introduces PySLICoder, a specialized Large Language Model (LLM) designed to automatically induce "sound laws"—the mathematical-like rules that describe how languages evolve over centuries. By framing Sound Law Induction (SLI) as a Programming by Examples (PBE) task and identifying the optimal balance of synthetic training data, the researchers created a model that outperforms much larger general-purpose coding models while using only a third of the parameters. The study demonstrates that a "middle-of-the-road" approach to data synthesis, balancing abstract structure with linguistic substance, is key to achieving state-of-the-art performance.
Introduction
Historical linguists study how languages change by identifying "sound laws": string-rewrite rules that transform a word from an ancestor language (a protoform) into its descendant (a reflex). For example, a rule might state that a specific vowel changes when it appears at the end of a word.
Manually inducing these rules from lists of words is tedious and error-prone. While modern LLMs are excellent at writing code, they often struggle with Programming by Examples (PBE)—the task of generating a program that satisfies a specific set of input-output pairs. The core challenge lies in finding the right fine-tuning strategy for this niche task. Specifically, the authors investigate a classic linguistic debate: should training data focus on structure (abstract logic) or substance (realistic linguistic patterns)?
Methodology
The authors formulate SLI as a PBE task where the "program" is a Python class called BasicAction representing a sound law. To find the best training strategy, they developed a pipeline to generate four types of synthetic datasets, moving along a spectrum from pure structure to pure substance:
- RP-RI (Random Programs + Random Inputs): Purely structural; uses random string manipulations on random character strings.
- RP-LI (Random Programs + LLM-generated Nonce Inputs): Uses random programs applied to "pronounceable" fake words (nonce words) generated by an LLM.
- RP-PI (Random Programs + Protolanguage Inputs): Applies random programs to real words from ancient languages.
- IDP-PI (Index Diachronica Programs + Protolanguage Inputs): Pure substance; uses real sound laws sampled from a linguistic database applied to real ancient words.
The researchers fine-tuned a Magicoder-S-DS-6.7B model on these distributions to evaluate which produced the most effective Sound Law Inducer.
Datasets and Evaluation
The study utilized four synthetic training datasets of 2,500 instances each. For evaluation, the authors created a high-quality benchmark consisting of 85 real-world sound laws from two language families: Polynesian (Hawaiian, Niue, Samoan, Tongan) and Tangkhulic (Huishu). This benchmark was manually curated to ensure high accuracy (75%+).
Results and Key Insights
The results highlight a "Goldilocks" zone of data realism. Surprisingly, the most realistic data (IDP-PI) performed poorly, suggesting that real-world sound laws are too uniform, causing the model to develop "pernicious biases." The best performance came from the RP-LI condition—random programs applied to pronounceable fake words. This approach provides enough linguistic "substance" to be helpful without over-constraining the model's ability to learn general string-manipulation logic.
PySLICoder set a new state-of-the-art for open-source models in this domain:
- Superior Accuracy: PySLICoder achieved a 59.1% average pass rate when trained on LLM-generated data, outperforming the base Magicoder's 2.4%.
- Efficiency and Performance: The GPT-4o-boosted version of PySLICoder achieved a 68.4% pass rate, a 6% improvement over Codestral-22B, despite PySLICoder having only 1/3 of the parameters.
Conclusion
This research demonstrates that smaller, specialized models can significantly outperform larger generalist models if the fine-tuning distribution is carefully chosen. While the current benchmark is small and focuses on single laws rather than complex sequences ("cascades"), PySLICoder represents a significant step forward in automated historical linguistics. Future work will explore multi-law induction and the broader applicability of these synthetic data insights to other PBE domains.
Summary updated