Explain-then-Translate: An Analysis on Improving Program Translation with Self-generated Explanations
On the map: Synthetic data and self-improvement for LLMs → Code and instruction data synthesis
Abstract (arXiv)
This work explores the use of self-generated natural language explanations as an intermediate step for code-to-code translation with language models. Across three types of explanations and 19 programming languages constructed from the MultiPL-E dataset, we find the explanations to be particularly effective in the zero-shot case, improving performance by 12% on average. Improvements with natural language explanations are particularly pronounced on difficult programs. We release our dataset, code, and canonical solutions in all 19 languages.
Key facts. Cited by 12 papers in the map (data through 7 Oct 2026). Placed in Code and instruction data synthesis, one of 13 directions in Synthetic data and self-improvement for LLMs. Builds on 45 of its 58 references that are in the map. First posted on arXiv 13 Nov 2023.
Builds on
45 of 58 references.
References · 45
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2021Evaluating Large Language Models Trained on Codecited by 8,053
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2019The Curious Case of Neural Text Degenerationcited by 2,881
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2022BLOOM: A 176B-Parameter Open-Access Multilingual Language Modelcited by 1,968
- 2022Challenging BIG-Bench Tasks and Whether Chain-of-Thought Can Solve Themcited by 1,767
- 2022Competition-Level Code Generation with AlphaCodecited by 1,427
33 more
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2017Explanation in Artificial Intelligence: Insights from the Social Sciencescited by 1,201
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2023Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Promptingcited by 1,081
- 2023Teaching Large Language Models to Self-Debugcited by 963
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2023Distilling Step-by-Step! Outperforming Larger Language Models with Less Training Data and Smaller Model Sizescited by 710
- 2017Program Induction by Rationale Generation : Learning to Solve and Explain Algebraic Word Problemscited by 642
- 2023Is ChatGPT a Good NLG Evaluator? A Preliminary Studycited by 420
- 2023Large Language Models Are State-of-the-Art Evaluators of Translation Qualitycited by 416
- 2021Unified Pre-training for Program Understanding and Generationcited by 361
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2023Explainability for Large Language Models: A Surveycited by 331
- 2020Unsupervised Translation of Programming Languagescited by 262
- 2022Can language models learn from explanations in context?cited by 248
- 2023SantaCoder: don't reach for the stars!cited by 169
- 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 163
- 2020Measuring Association Between Labels and Free-Text Rationalescited by 159
- 2022Multi-lingual Evaluation of Code Generation Modelscited by 158
- 2023Hypothesis Search: Inductive Reasoning with Language Modelscited by 119
- 2022Coder Reviewer Reranking for Code Generationcited by 83
- 2021Leveraging Automated Unit Tests for Unsupervised Code Translationcited by 82
- 2021When Can Models Learn From Explanations? A Formal Framework for Understanding the Roles of Explanation Datacited by 75
- 2023Improving Code Generation by Training with Natural Language Feedbackcited by 75
- 2023Dictionary-based Phrase-level Prompting of Large Language Models for Machine Translationcited by 74
- 2021DOBF: A Deobfuscation Pre-Training Objective for Programming Languagescited by 68
- 2023Post Hoc Explanations of Language Models Can Improve Language Modelscited by 50
- 2022A survey on improving NLP models with human explanationscited by 15
- 2022FRAME: Evaluating Rationale-Label Consistency Metrics for Free-Text Rationalescited by 10
Built on by
Citing papers per year: 2023: 1; 2024: 6; 2025: 4; 2026: 1.
12 papers.
- 2024Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step-by-stepcited by 123
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Codecited by 62
- 2024Usable XAI: 10 Strategies Towards Exploiting Explainability in the LLM Eracited by 45
- 2025RExBench: Can coding agents autonomously implement AI research extensions?cited by 17
- 2024Syzygy: Dual Code-Test C to (safe) Rust Translation using LLMs and Dynamic Analysiscited by 16
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligencecited by 13
- 2025LLM4EFFI: Leveraging Large Language Models to Enhance Code Efficiency and Correctnesscited by 10
- 2024Planning-Driven Programming: A Large Language Model Programming Workflowcited by 7
- 2024Speak It Out: Solving Symbol-Related Problems with Symbol-to-Language Conversion for Language Modelscited by 4
- 2024Identify Critical Nodes in Complex Network with Large Language Modelscited by 4
- 2025Skeleton-Guided-Translation: A Benchmarking Framework for Code Repository Translation with Fine-Grained Quality Evaluationcited by 3
- 2026Revisiting the Role of Natural Language Code Comments in Code Translationcited by 0
- 2026Revisiting the Role of Natural Language Code Comments in Code Translation23 Jan 2026
- 2025From Code Foundation Models to Agents and Applications: A Comprehensive Survey and Practical Guide to Code Intelligence23 Nov 2025
- 2025RExBench: Can coding agents autonomously implement AI research extensions?27 Jun 2025
- 2025LLM4EFFI: Leveraging Large Language Models to Enhance Code Efficiency and Correctness17 Feb 2025
- 2025Skeleton-Guided-Translation: A Benchmarking Framework for Code Repository Translation with Fine-Grained Quality Evaluation27 Jan 2025
- 2024Syzygy: Dual Code-Test C to (safe) Rust Translation using LLMs and Dynamic Analysis18 Dec 2024
- 2024Planning-Driven Programming: A Large Language Model Programming Workflow21 Nov 2024
- 2024Usable XAI: 10 Strategies Towards Exploiting Explainability in the LLM Era13 Mar 2024
- 2024Identify Critical Nodes in Complex Network with Large Language Models1 Mar 2024
- 2024Debug like a Human: A Large Language Model Debugger via Verifying Runtime Execution Step-by-step25 Feb 2024
- 2024Speak It Out: Solving Symbol-Related Problems with Symbol-to-Language Conversion for Language Models22 Jan 2024
- 2023Unifying the Perspectives of NLP and Software Engineering: A Survey on Language Models for Code14 Nov 2023
Similar, not cited
Close in wording, no citation either way
- 2024From Critique to Clarity: A Pathway to Faithful and Personalized Code Explanations with Large Language Models
- 2024Enhancing Code Translation in Language Models with Few-Shot Learning via Retrieval-Augmented Generation
- 2024SpecTra: Enhancing the Code Translation Ability of Language Models by Generating Multi-Modal Specifications
- 2024Assessing Code Generation with Intermediate Languages
- 2025Enabling Global, Human-Centered Explanations for LLMs:From Tokens to Interpretable Code and Test Generation
- 2026Are you Synthesizing or Recalling? Evaluating LLMs on Algorithmic Code Retrieval
- 2026Illocutionary Explanation Planning for Source-Faithful Explanations in Retrieval-Augmented Language Models
- 2024Semi-Instruct: Bridging Natural-Instruct and Self-Instruct for Code Large Language Models