mlsanityData to 7 Oct 2026

When Many-Shot Prompting Fails: An Empirical Study of LLM Code Translation

arXiv 2510.16809 ↗First posted 19 Oct 2025cs.SE cs.AI cs.CLcited by 1

Not on the map. Why?

Abstract (arXiv)

Large Language Models (LLMs) with vast context windows offer new avenues for in-context learning (ICL), where providing many examples ("many-shot" prompting) is often assumed to enhance performance. We investigate this assumption for the complex task of code translation. Through a large-scale empirical study of over 90,000 translations, we systematically evaluate the impact of scaling in-context examples from zero-shot to many-shot configurations of up to 625 examples, with prompts spanning from approximately 100,000 to 800,000 tokens. Our findings reveal a "many-shot paradox": while static similarity metrics may modestly improve with more examples, functional correctness consistently peaks with few-shot prompting (5-25 examples). Providing substantially more examples often degrades this crucial functional performance. This study highlights that for code translation, the quality of a few well-chosen examples outweighs sheer quantity, challenging the universal efficacy of "more is better" for ICL and underscoring the task-dependent nature of optimal prompting strategies. Our results have significant implications for effectively leveraging LLMs in software engineering.

Key facts. Cited by 1 paper in the map (data through 7 Oct 2026). Builds on 10 of its 17 references that are in the map. First posted on arXiv 19 Oct 2025.

Builds on

10 of 17 references.

References · 10

  1. 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
  2. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,175
  3. 2023Large Language Models Can Be Easily Distracted by Irrelevant Contextcited by 820
  4. 2024Many-Shot In-Context Learningcited by 203
  5. 2024In-Context Learning with Long-Context Models: An In-Depth Explorationcited by 126
  6. 2024Many-Shot In-Context Learning in Multimodal Foundation Modelscited by 64
  7. 2023CodeTransOcean: A Comprehensive Multilingual Benchmark for Code Translationcited by 55
  8. 2025On the generalization of language models from in-context learning and finetuning: a controlled studycited by 39
  9. 2024AlphaTrans: A Neuro-Symbolic Compositional Approach for Repository-Level Code Translation and Validationcited by 28
  10. 2025More is not always better? Enhancing Many-Shot In-Context Learning with Differentiated and Reweighting Objectivescited by 12

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2026: 1.

1 paper.