LLM-Microscope: Svelare il Ruolo Nascosto della Punteggiatura nella Memoria Contestuale dei Trasformatori
LLM-Microscope: Uncovering the Hidden Role of Punctuation in Context Memory of Transformers
February 20, 2025
Autori: Anton Razzhigaev, Matvey Mikhalchuk, Temurbek Rahmatullaev, Elizaveta Goncharova, Polina Druzhinina, Ivan Oseledets, Andrey Kuznetsov
cs.AI
Abstract
Introduciamo metodi per quantificare come i Large Language Model (LLM) codificano e memorizzano le informazioni contestuali, rivelando che token spesso considerati minori (ad esempio, determinanti, punteggiatura) trasportano un contesto sorprendentemente elevato. In particolare, la rimozione di questi token — specialmente stopword, articoli e virgole — degrada costantemente le prestazioni su MMLU e BABILong-4k, anche se vengono rimossi solo token irrilevanti. La nostra analisi mostra inoltre una forte correlazione tra contestualizzazione e linearità, dove la linearità misura quanto strettamente la trasformazione dagli embedding di uno strato a quello successivo possa essere approssimata da una singola mappatura lineare. Questi risultati sottolineano l'importanza nascosta dei token di riempimento nel mantenimento del contesto. Per ulteriori esplorazioni, presentiamo LLM-Microscope, un toolkit open-source che valuta la non linearità a livello di token, valuta la memoria contestuale, visualizza i contributi degli strati intermedi (tramite un Logit Lens adattato) e misura la dimensionalità intrinseca delle rappresentazioni. Questo toolkit illumina come token apparentemente banali possano essere critici per la comprensione a lungo raggio.
English
We introduce methods to quantify how Large Language Models (LLMs) encode and
store contextual information, revealing that tokens often seen as minor (e.g.,
determiners, punctuation) carry surprisingly high context. Notably, removing
these tokens -- especially stopwords, articles, and commas -- consistently
degrades performance on MMLU and BABILong-4k, even if removing only irrelevant
tokens. Our analysis also shows a strong correlation between contextualization
and linearity, where linearity measures how closely the transformation from one
layer's embeddings to the next can be approximated by a single linear mapping.
These findings underscore the hidden importance of filler tokens in maintaining
context. For further exploration, we present LLM-Microscope, an open-source
toolkit that assesses token-level nonlinearity, evaluates contextual memory,
visualizes intermediate layer contributions (via an adapted Logit Lens), and
measures the intrinsic dimensionality of representations. This toolkit
illuminates how seemingly trivial tokens can be critical for long-range
understanding.Summary
AI-Generated Summary