Post-Incorporating Code Structural Knowledge into Pretrained Models via ICL for Code Translation
Not on the map. Why?
Abstract (arXiv)
Code translation migrates codebases across programming languages. Recently, large language models (LLMs) have achieved significant advancements in software mining. However, handling the syntactic structure of source code remains a challenge. Classic syntax-aware methods depend on intricate model architectures and loss functions, rendering their integration into LLM training resource-intensive. This paper employs in-context learning (ICL), which directly integrates task exemplars into the input context, to post-incorporate code structural knowledge into pre-trained LLMs. We revisit exemplar selection in ICL from an information-theoretic perspective, proposing that list-wise selection based on information coverage is more precise and general objective than traditional methods based on combining similarity and diversity. To address the challenges of quantifying information coverage, we introduce a surrogate measure, Coverage of Abstract Syntax Tree (CAST). Furthermore, we formulate the NP-hard CAST maximization for exemplar selection and prove that it is a standard submodular maximization problem. Therefore, we propose a greedy algorithm for CAST submodular maximization, which theoretically guarantees a (1-1/e)-approximate solution in polynomial time complexity. Our method is the first training-free and model-agnostic approach to post-incorporate code structural knowledge into existing LLMs at test time. Experimental results show that our method significantly improves LLMs performance and reveals two meaningful insights: 1) Code structural knowledge can be effectively post-incorporated into pre-trained LLMs during inference, despite being overlooked during training; 2) Scaling up model size or training data does not lead to the emergence of code structural knowledge, underscoring the necessity of explicitly considering code syntactic structure.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 61 of its 94 references that are in the map. First posted on arXiv 28 Mar 2025.
Builds on
61 of 94 references.
References · 61
- 2023GPT-4 Technical Reportcited by 18,132
- 2024The Llama 3 Herd of Modelscited by 14,192
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2024Qwen2.5 Technical Reportcited by 4,713
- 2022Emergent Abilities of Large Language Modelscited by 2,483
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2024Qwen2 Technical Reportcited by 2,076
- 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,928
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,286
38 more
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,154
- 2024Gemma: Open Models Based on Gemini Research and Technologycited by 889
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2021Learning To Retrieve Prompts for In-Context Learningcited by 641
- 2020GraphCodeBERT: Pre-training Code Representations with Data Flowcited by 600
- 2024StarCoder 2 and The Stack v2: The Next Generationcited by 484
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2022Dynamic Prompt Learning via Policy Gradient for Semi-structured Mathematical Reasoningcited by 347
- 2024DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligencecited by 325
- 2024Long-context LLMs Struggle with Long In-context Learningcited by 285
- 2017Unsupervised Machine Translation Using Monolingual Corpora Onlycited by 272
- 2020Unsupervised Translation of Programming Languagescited by 262
- 2018code2vec: Learning Distributed Representations of Codecited by 249
- 2023In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steeringcited by 240
- 2022Towards Understanding Chain-of-Thought Prompting: An Empirical Study of What Matterscited by 221
- 2017A Survey of Machine Learning for Big Code and Naturalnesscited by 220
- 2022In-context Examples Selection for Machine Translationcited by 172
- 2024CodeGemma: Open Code Models Based on Gemmacited by 145
- 2023Compositional Exemplars for In-context Learningcited by 143
- 2023Unified Demonstration Retriever for In-Context Learningcited by 141
- 2022Diverse Demonstrations Improve In-context Compositional Generalizationcited by 136
- 2018Tree-to-tree Neural Networks for Program Translationcited by 93
- 2021Leveraging Automated Unit Tests for Unsupervised Code Translationcited by 82
- 2023UPRISE: Universal Prompt Retrieval for Improving Zero-Shot Evaluationcited by 74
- 2024In-context Learning with Retrieved Demonstrations for Language Models: A Surveycited by 69
- 2021AVATAR: A Parallel Corpus for Java-Python Program Translationcited by 59
- 2024Exploring and Unleashing the Power of Large Language Models in Automated Code Translationcited by 57
- 2021Weakly-Supervised Visual-Retriever-Reader for Knowledge-based Question Answeringcited by 50
- 2024Let's Learn Step by Step: Enhancing In-Context Learning Ability with Curriculum Learningcited by 47
- 2021Perfection Not Required? Human-AI Partnerships in Code Translationcited by 42
- 2022Code Translation with Compiler Representationscited by 42
- 2021TreeBERT: A Tree-Based Pre-Trained Model for Programming Languagecited by 40
- 2025MDP3: A Training-free Approach for List-wise Frame Selection in Video-LLMscited by 40
50 most cited of 61 All 61 (JSON)
Built on by
Citing papers per year: 2026: 3.
3 papers.