ChatPaper.aiChatPaper

Meccanismi di Miscelazione: Come i Modelli Linguistici Recuperano Entità Vincolate In-Contesto

Mixing Mechanisms: How Language Models Retrieve Bound Entities In-Context

October 7, 2025
Autori: Yoav Gur-Arieh, Mor Geva, Atticus Geiger
cs.AI

Abstract

Un componente chiave del ragionamento in contesto è la capacità dei modelli linguistici (LM) di associare entità per un successivo recupero. Ad esempio, un LM potrebbe rappresentare "Anna ama la torta" associando "Anna" a "torta", consentendogli di recuperare "Anna" quando viene chiesto "Chi ama la torta?". Ricerche precedenti su brevi liste di entità associate hanno trovato prove solide che i LM implementano tale recupero attraverso un meccanismo posizionale, dove "Anna" viene recuperata in base alla sua posizione nel contesto. In questo lavoro, scopriamo che questo meccanismo si generalizza male a contesti più complessi; man mano che il numero di entità associate nel contesto aumenta, il meccanismo posizionale diventa rumoroso e inaffidabile nelle posizioni centrali. Per compensare ciò, scopriamo che i LM integrano il meccanismo posizionale con un meccanismo lessicale (recuperando "Anna" utilizzando la sua controparte associata "torta") e un meccanismo riflessivo (recuperando "Anna" attraverso un puntatore diretto). Attraverso esperimenti estesi su nove modelli e dieci compiti di associazione, individuiamo un modello coerente nel modo in cui i LM combinano questi meccanismi per guidare il comportamento del modello. Sfruttiamo queste intuizioni per sviluppare un modello causale che combina tutti e tre i meccanismi, stimando le distribuzioni dei token successivi con un accordo del 95%. Infine, dimostriamo che il nostro modello si generalizza a input sostanzialmente più lunghi di testo aperto intervallato da gruppi di entità, dimostrando ulteriormente la robustezza delle nostre scoperte in contesti più naturali. Nel complesso, il nostro studio stabilisce un quadro più completo di come i LM associano e recuperano entità in contesto.
English
A key component of in-context reasoning is the ability of language models (LMs) to bind entities for later retrieval. For example, an LM might represent "Ann loves pie" by binding "Ann" to "pie", allowing it to later retrieve "Ann" when asked "Who loves pie?" Prior research on short lists of bound entities found strong evidence that LMs implement such retrieval via a positional mechanism, where "Ann" is retrieved based on its position in context. In this work, we find that this mechanism generalizes poorly to more complex settings; as the number of bound entities in context increases, the positional mechanism becomes noisy and unreliable in middle positions. To compensate for this, we find that LMs supplement the positional mechanism with a lexical mechanism (retrieving "Ann" using its bound counterpart "pie") and a reflexive mechanism (retrieving "Ann" through a direct pointer). Through extensive experiments on nine models and ten binding tasks, we uncover a consistent pattern in how LMs mix these mechanisms to drive model behavior. We leverage these insights to develop a causal model combining all three mechanisms that estimates next token distributions with 95% agreement. Finally, we show that our model generalizes to substantially longer inputs of open-ended text interleaved with entity groups, further demonstrating the robustness of our findings in more natural settings. Overall, our study establishes a more complete picture of how LMs bind and retrieve entities in-context.
PDF82October 8, 2025