Study probes if LMs understand variable roles via SAEs
Researchers from arXiv cs.CL published a study titled "Do LMs Know What Variables Do?" to investigate whether large language models (LLMs) truly understand the functional roles of variables in code. The team used Sajaniemi's taxonomy to define eleven recurring variable behaviors, such as accumulation and traversal, and built a corpus of 126,926 natural-code files across five programming…
Key points
- Study analyzes 126,926 code files across five languages to test LLM understanding of variable roles.
- Residual probes outperform individual SAE features in recovering variable role distinctions.
- Interventions to change variable roles during generation often reduce code correctness.
The study employed sparse autoencoders (SAEs) to analyze model representations. Results showed that residual probes were more effective than individual SAE features or lexical baselines at recovering role distinctions, though performance dropped slightly when variable names were changed. While combining SAE features improved accuracy, the models remained sensitive to role-changing edits.
A key finding is that high ranking accuracy often came with frequent false positives. During code generation, interventions aimed at changing variable roles frequently compromised code correctness. Changes that passed tests did not show a clear advantage over random controls, suggesting that current models may not reliably control variable roles without breaking functionality.
The headline, key points and digest above were generated by Digest AI's editorial model from the linked sources. Automated summaries can contain errors: the sources are the record. Spotted a mistake? Tell us. Published by Martin K., who runs Digest AI and handles corrections.
More in Research
All →- Researchers introduce parade to improve demographic Survey simulations with LLMs · 1 src
- Open-source LLMS over-cooperate in prisoner's dilemma, study shows · 1 src
- Researchers introduce SURE-Act to improve Tool-Using agents · 1 src
- Google and Meta release TorchTPU for native PyTorch on TPU · 1 src
- Researchers find transformer prompt influence decays as power law · 1 src
Comments
via GitHub Discussions