mlsanityData to 7 Oct 2026

Don't Transform the Code, Code the Transforms: Towards Precise Code Rewriting using LLMs

arXiv 2410.08806 ↗First posted 11 Oct 2024cs.LGcited by 8

Not on the map. Why?

Abstract (arXiv)

Tools for rewriting, refactoring and optimizing code should be fast and correct. Large language models (LLMs), by their nature, possess neither of these qualities. Yet, there remains tremendous opportunity in using LLMs to improve code. We explore the use of LLMs not to transform code, but to code transforms. We propose a chain-of-thought approach to synthesizing code transformations from a small number of input/output code examples that incorporates execution and feedback. Unlike the direct rewrite approach, LLM-generated transformations are easy to inspect, debug, and validate. The logic of the rewrite is explicitly coded and easy to adapt. The compute required to run code transformations is minute compared to that of LLM rewriting. We test our approach on 16 Python code transformations and find that LLM- generated transforms are perfectly precise for 7 of them and less imprecise than direct LLM rewriting on the others. We hope to encourage further research to improving the precision of LLM code rewriting.

Key facts. Cited by 8 papers in the map (data through 7 Oct 2026). Builds on 11 of its 12 references that are in the map. First posted on arXiv 11 Oct 2024.

Builds on

11 of 12 references.

References · 11

  1. 2024The Llama 3 Herd of Modelscited by 14,192
  2. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,053
  4. 2022STaR: Bootstrapping Reasoning With Reasoningcited by 895
  5. 2024A Survey on Large Language Models for Code Generationcited by 646
  6. 2023Large Language Models for Software Engineering: A Systematic Literature Reviewcited by 389
  7. 2024Large Language Model-Based Agents for Software Engineering: A Surveycited by 173
  8. 2023Learning Performance-Improving Code Editscited by 103
  9. 2024Meta Large Language Model Compiler: Foundation Models of Compiler Optimizationcited by 39
  10. 2023SLaDe: A Portable Small Language Model Decompiler for Optimized Assemblycited by 28
  11. 2023Supersonic: Learning to Generate Source Code Optimizations in C/C++cited by 15

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 5; 2026: 3.

8 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2025Rewriting Pre-Training Data Boosts LLM Performance in Math and Code
  2. 2025code_transformed: The Influence of Large Language Models on Code
  3. 2025REMODEL-LLM: Transforming C code to Java using LLMs
  4. 2025Beyond Synthetic Benchmarks: Evaluating LLM Performance on Real-World Class-Level Code Generation
  5. 2025Holistic Evaluation of State-of-the-Art LLMs for Code Generation
  6. 2025When Code Crosses Borders: A Security-Centric Study of LLM-based Code Translation ↗
  7. 2026From Brute Force to Semantic Insight: Performance-Guided Data Transformation Design with LLMs
  8. 2024Assessing, Exploiting, and Mitigating Syntactic Robustness Failures in LLM-Based Code Generation