Sense and Sensitivity: Examining the Influence of Semantic Recall on Long Context Code Reasoning

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Štorek, Adam, Gupta, Mukur, Hajizadeh, Samira, Srivastava, Prashast, Jana, Suman
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866910147557720064
author Štorek, Adam
Gupta, Mukur
Hajizadeh, Samira
Srivastava, Prashast
Jana, Suman
author_facet Štorek, Adam
Gupta, Mukur
Hajizadeh, Samira
Srivastava, Prashast
Jana, Suman
contents Large language models (LLMs) are increasingly deployed for understanding large codebases, but whether they understand operational semantics of long code context or rely on pattern matching shortcuts remains unclear. We distinguish between lexical recall (retrieving code verbatim) and semantic recall (understanding operational semantics). Evaluating 10 state-of-the-art LLMs, we find that while frontier models achieve near-perfect, position-independent lexical recall, semantic recall degrades severely when code is centrally positioned in long contexts. We introduce semantic recall sensitivity to measure whether tasks require understanding of code's operational semantics vs. permit pattern matching shortcuts. Through a novel counterfactual measurement method, we show that models rely heavily on pattern matching shortcuts to solve existing code understanding benchmarks. We propose a new task SemTrace, which achieves high semantic recall sensitivity through unpredictable operations; LLMs' accuracy exhibits severe positional effects, with median accuracy drops of 92.73% versus CRUXEval's 53.36% as the relevant code snippet approaches the middle of the input code context. Our findings suggest current evaluations substantially underestimate semantic recall failures in long context code understanding.
format Preprint
id arxiv_https___arxiv_org_abs_2505_13353
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Sense and Sensitivity: Examining the Influence of Semantic Recall on Long Context Code Reasoning
Štorek, Adam
Gupta, Mukur
Hajizadeh, Samira
Srivastava, Prashast
Jana, Suman
Computation and Language
Machine Learning
Software Engineering
Large language models (LLMs) are increasingly deployed for understanding large codebases, but whether they understand operational semantics of long code context or rely on pattern matching shortcuts remains unclear. We distinguish between lexical recall (retrieving code verbatim) and semantic recall (understanding operational semantics). Evaluating 10 state-of-the-art LLMs, we find that while frontier models achieve near-perfect, position-independent lexical recall, semantic recall degrades severely when code is centrally positioned in long contexts. We introduce semantic recall sensitivity to measure whether tasks require understanding of code's operational semantics vs. permit pattern matching shortcuts. Through a novel counterfactual measurement method, we show that models rely heavily on pattern matching shortcuts to solve existing code understanding benchmarks. We propose a new task SemTrace, which achieves high semantic recall sensitivity through unpredictable operations; LLMs' accuracy exhibits severe positional effects, with median accuracy drops of 92.73% versus CRUXEval's 53.36% as the relevant code snippet approaches the middle of the input code context. Our findings suggest current evaluations substantially underestimate semantic recall failures in long context code understanding.
title Sense and Sensitivity: Examining the Influence of Semantic Recall on Long Context Code Reasoning
topic Computation and Language
Machine Learning
Software Engineering
url https://arxiv.org/abs/2505.13353