Lngram: N-gram Conditional Memory in Latent Space
Not on the map. Why?
Abstract (arXiv)
Sequence modeling requires both compositional reasoning and local static knowledge retrieval, yet standard Transformers handle both through dense computation. Engram partially decouples retrieval from the backbone, but its token-based keys remain tied to text tokenization and hash compression. We propose Lngram, a latent-space conditional memory module that learns discrete symbols directly from hidden states and performs N-gram lookup over these symbols. This design removes the dependence on tokenizer IDs and naturally extends to non-text modalities. In our evaluated settings, Lngram outperforms Transformer and Engram baselines, consistently reduces perplexity in long-context language modeling, and effectively injects domain knowledge when added post hoc to pretrained models. Joint training with the backbone further surpasses full fine-tuning, while experiments on vision-language and vision-language-action tasks show overall gains. Analyses with LogitLens and CKA suggest that Lngram enables prediction-relevant information to emerge earlier, increasing effective depth with limited inference and memory overhead. Code is available at https://github.com/zyaaa-ux/Lngram.
Key facts. Cited by 3 papers in the map (data through 7 Oct 2026). Builds on 23 of its 31 references that are in the map. First posted on arXiv 24 May 2026.
Builds on
23 of 31 references.
References · 23
- 2017Attention Is All You Needcited by 59,932
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2025Qwen3 Technical Reportcited by 8,195
- 2023Visual Instruction Tuningcited by 7,792
- 2020Measuring Massive Multitask Language Understandingcited by 7,768
- 2024Qwen2.5 Technical Reportcited by 4,713
- 2022Flamingo: a Visual Language Model for Few-Shot Learningcited by 4,337
- 2019HellaSwag: Can a Machine Really Finish Your Sentence?cited by 4,018
- 2019PIQA: Reasoning about Physical Commonsense in Natural Languagecited by 2,818
11 more
- 2019Similarity of Neural Network Representations Revisitedcited by 1,695
- 2024The FineWeb Datasets: Decanting the Web for the Finest Text Data at Scalecited by 1,104
- 2024DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Modelcited by 1,093
- 2024DeepSeekMoE: Towards Ultimate Expert Specialization in Mixture-of-Experts Language Modelscited by 834
- 2017Crowdsourcing Multiple Choice Science Questionscited by 742
- 2019Compressive Transformers for Long-Range Sequence Modellingcited by 699
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2024Lessons from the Trenches on Reproducible Evaluation of Language Modelscited by 172
- 2026StarVLA: A Lego-like Codebase for Vision-Language-Action Model Developingcited by 103
- 2026Conditional Memory via Scalable Lookup: A New Axis of Sparsity for Large Language Modelscited by 78
- 2023A Study of Situational Reasoning for Traffic Understandingcited by 13
Built on by
Citing papers per year: 2026: 3.
3 papers.
Similar, not cited
Close in wording, no citation either way
- 2026Lngram v2: Latent N-Gram Memory with Interpretable Discrete Representations
- 2026EngramEdit: Decoupled Knowledge Updates in LLMs through Conditional Memory
- 2026NGM: A Plug-and-Play Training-Free Memory Module for LLMs
- 2026Memory Grafting: Scaling Language Model Pre-training via Offline Conditional Memory
- 2026SemanticFold: Latent Sequence Compression SeparatesLanguage Modeling, Decodability, and Reasoning
- 2026Why Struggle with Continuous Latents? Interpretable Discrete Latent Reasoning via Rendered Compression
- 2026Disentangling Long-Term Memory via Latent Neuro-Symbolic Reasoning
- 2026LaSER: Internalizing Explicit Reasoning into Latent Space for Dense Retrieval