Introduction
Large Language Models (LLMs) have demonstrated remarkable capabilities across diverse domains. However, their "black-box" nature remains a significant hurdle for deployment in high-stakes environments like medicine or neuroscience, where interpretability is paramount. While traditional n-gram models offer full transparency, they are often too brittle to handle the nuances of natural language, such as rephrasings or minor variations.
To bridge this gap, we introduce Induction-head ngram models (Induction-Gram), also referred to as the Generalized Induction-Head Model (GIM). This approach combines the grounding of n-gram models with the flexibility of neural similarity, creating an efficient and interpretable framework for next-token prediction.
Methodology: The Induction-Gram Framework
Induction-Gram functions as a retrieval-based model that predicts the next token by searching the immediate input context for patterns. It mimics the "induction head" behavior observed in Transformers—mechanisms that identify and complete repeated sequences.
The model employs a dual-matching strategy:
- Exact Matching: Utilizing the Infini-gram framework, the model searches for identical token sequences within the context or a massive reference corpus.
- Fuzzy Matching: To handle linguistic variations, a lightweight Fuzzy Matching Model is employed. This small transformer (typically 3-4 layers) is trained via knowledge distillation from a large teacher LLM (e.g., LLaMA-2).
Instead of generating tokens, this distilled model produces feature embeddings used to calculate similarity between sequences based on Jensen-Shannon Divergence (JSD). By scoring the similarity between the current sequence and previous segments in the context, Induction-Gram identifies the most likely next token while providing explicit grounding for its prediction.
Performance and Scaling
Induction-Gram was evaluated on various datasets, including BabyLM, OpenWebText, and The Pile. A key finding is the relationship between "Effective n" (the length of the matching sequence) and prediction accuracy.
As shown in Figure 3, next-token accuracy significantly improves as the length of the matching sequence increases. Induction-Gram improves accuracy by up to 26 percentage points over baseline interpretable models like Infini-gram. Furthermore, the model's efficiency allows it to serve as a "draft model" for speculative decoding, achieving up to a 2.27x speedup for LLaMA2-70B.
Natural Language Neuroscience
The interpretability of Induction-Gram makes it uniquely suited for scientific investigation. In a neuroscience setting, the model was tasked with predicting fMRI responses in human participants listening to narrative podcasts. Induction-Gram achieved a 20% relative increase in the correlation of predicted fMRI responses compared to previous interpretable baselines. In specific brain regions associated with language processing, such as the Occipital Face Area (OFA), it reached performance parity with black-box models like LLaMA-2, suggesting that these regions may employ similar pattern-matching mechanisms.
Conclusion
Induction-Gram demonstrates that neural components can be used to enhance interpretable models without sacrificing transparency. By using a neural network for scoring similarity rather than generation, the model remains human-auditable. While it currently lacks the extensive world knowledge of massive LLMs, it provides a powerful tool for high-stakes applications and the scientific study of language processing in the brain.
Summary updated