A Consistent Pattern for Identifying Decisive Code Snippets for LLM-Based Code Inference

Min Xue, Artur AndrzejakOpenReview 2025 · Submission to ICLR 2025 · Withdrawn

Its authors withdrew this paper, so there is no full text to read or summarize.

Abstract

Which parts of pre-target input are most influential for next-token prediction in the context of programming languages? In this paper, we present evidence that code snippets at specific locations in pre-target inputs play a decisive role in large language model (LLM) inference, and these snippets exhibit a consistent pattern. Firstly, we introduce a novel causal tracing method to identify tokens, so-called high-information tokens, that significantly contribute to next-token prediction. Building on this, we propose a multi-phase causal tracing process to analyze the importance distribution of high-information tokens, revealing a consistent pattern, named the Important Position Rule (IPR). To further validate this hypothesis, we assess the role of IPR across various LLMs, languages, and tasks. Our extensive evaluations for code translation, code correction and code completion tasks (Java, Python, C++) on models CodeLlama-7b/13b/34b-Instruct and GPT-3.5/4-turbo, confirm this hypothesis. Furthermore, we observe that IPR exhibits structural and semantic properties similar to the $\langle \text{subject}, \text{relation}, \text{object} \rangle$ paradigm in natural language. Leveraging this insight, we successfully combine IPR with the knowledge editing method ROME in order to repair translation errors, achieving a correction rate of 62.73% to 75.31%. To our knowledge, this is the first application of knowledge editing in the context of programming languages.
BibTeX
@misc{xue2025consistent,
  author = {Min Xue and Artur Andrzejak},
  title = {{A Consistent Pattern for Identifying Decisive Code Snippets for LLM-Based Code Inference}},
  year = {2025},
  url = {https://openreview.net/forum?id=QgA0auXUU0},
  howpublished = {OpenReview},
  note = {Submitted to ICLR 2025},
}
Figure