Co-LMLM: Continuous-Query Limited Memory Language Models

Yair Feldman, Linxi Zhao, Nathan Godey, Dongyoung Go, Yilun Hua, Kilian Q. Weinberger, Jennifer J. Sun, Yoav ArtziarXiv 2026

TL;DR

Co-LMLM (Continuous-Query Limited Memory Language Model) is a novel architecture that offloads factual knowledge from a model's parameters into an external, human-readable knowledge base (KB). By replacing slow, rigid text-based queries with efficient continuous vector queries, it achieves state-of-the-art factuality and perplexity at small scales—even outperforming models trained on 40x more data.

What Problem Does This Paper Address?

Standard Large Language Models (LLMs) entangle linguistic competency with factual knowledge by memorizing facts directly into their weights. This leads to several critical issues:

  1. Hallucinations: Models confidently state false information when their internal memory fails.
  2. Stale Knowledge: Updating or deleting specific facts (unlearning) requires expensive retraining or complex gradient-based optimizations.
  3. Inefficiency: A huge portion of a model's parameter budget is spent memorizing "long-tail" facts that could be stored more efficiently elsewhere.

Prior attempts at "Limited Memory" models (REL-LMLM) externalized facts into relational databases (subject-relation-object tuples). However, these were restricted to Wikipedia-style data and relied on slow, brittle text-based queries that added significant inference overhead.

Figure 1: Knowledge separation across three regimes. A standard LLM with RAG retrieves over external documents but keeps factual knowledge in its parameters (left); LMLM externalizes facts to a relational KB queried with an explicit decoded query (middle); CO-LMLM externalizes facts to an unstructured index, retrieved directly from the model’s hidden state (right).

Methods

The authors propose Co-LMLM, which shifts from discrete relational queries to continuous vector queries.

The Architecture

Instead of decoding a text string to search a database, Co-LMLM emits a query vector directly from its hidden state when it encounters a special <FACT> token. This vector is used to perform a dense retrieval against a key-value store where:

  • Keys are dense vectors representing the "intent" of a fact.
  • Values are free-form, human-readable text spans.

Joint Training

The model is trained with a dual objective:

  1. Next-Token Prediction (NTP): Standard language modeling, but the loss is not calculated on factual spans. This forces the model to rely on the KB rather than memorizing the text in its weights.
  2. Bidirectional InfoNCE Loss: A contrastive objective that aligns the document's hidden state (the query) with a synthetic question's hidden state (the key).
Figure 2: Overview of CO-LMLM. Top: We annotate the pre-training corpus with fact spans and paired questions, while leaving the document text unchanged. Middle: During training, a single decoder-only Transformer processes both the annotated document and its paired questions. We optimize next-token prediction over non-fact tokens and a bidirectional InfoNCE loss that aligns the query representation at each <FACT> token with the question representation at the corresponding <FACT-q> token. Bottom: At inference, emitting <FACT> triggers dense retrieval using the hidden state at the emitted <FACT> position as the query. The retrieved fact span is inserted into the context, followed by </FACT>, and decoding continues. No textual query is decoded.

Automated Annotation

To scale beyond Wikipedia, the authors developed a three-stage pipeline:

  1. Seed: A frontier model (Gemini 3.1 Pro) annotates a small set of documents with factual spans and paired questions.
  2. Distill: This seed data trains two lightweight models: a fact-span tagger (ModernBERT) and a question generator (Qwen-2.5-1.5B).
  3. Scale: These efficient annotators process the full pre-training corpus.

Datasets

  • Training: Wikipedia (~3B tokens) and a 90B token sample of FineWeb-Edu.
  • Factuality Benchmarks: TriviaQA, PopQA (long-tail entities), SimpleQA (difficult, indisputable facts), T-REx (factual completion), and FactScore (long-form biography precision).
  • Unlearning: The TOFU benchmark, which tests a model's ability to forget specific synthetic author profiles.
  • General Utility: Standard NLU benchmarks like HellaSwag, PIQA, and ARC-Easy to ensure linguistic skills aren't compromised.

Key Insights and Ideas

  • Linguistic vs. Factual Separation: The paper demonstrates that you can significantly reduce a model's internal "knowledge" without hurting its ability to reason or speak fluently.
  • Vector Queries are Superior: Moving from text queries to continuous vectors reduces inference overhead by ~13x (2.2ms vs 28ms) and allows for much more flexible, context-aware retrieval.
  • Schema-Free Knowledge: By using free-form text spans instead of relational tuples, the model can externalize a much broader range of information from diverse web sources.
  • Database-Level Unlearning: Because the knowledge is external, "forgetting" a fact is as simple as deleting a row in a database. This avoids the "catastrophic forgetting" or utility degradation common in gradient-based unlearning.

Key Results

  • Perplexity: At the 360M parameter scale, Co-LMLM achieved lower perplexity than the off-the-shelf SmolLM2-360M, despite the latter being trained on 40x more data.
  • Factuality: On the challenging SimpleQA benchmark, Co-LMLM-360M-FW scored 21.7, placing it in line with GPT-4o-mini and significantly higher than Claude 3.5 Sonnet (which scored 17.9 on the same leaderboard at the time of writing).
  • Unlearning: On the TOFU benchmark, Co-LMLM achieved near-perfect "forget quality" (p-value > 0.05) through simple database deletions, while maintaining 100% of its utility on retained data.

Limitations and Future Work

  • Model Scale: The study focuses on small models (135M and 360M). While scaling trends look promising, performance on 7B+ parameter models remains to be seen.
  • Index Updates: While the KB is editable, the dense vector keys are tied to the model's hidden states. If the model is significantly fine-tuned, the entire index might need to be re-encoded.
  • Initial Indexing Cost: Building a 2.2B-item index for a large corpus involves a significant one-time computational cost, though the authors argue this is offset by faster training and better factuality.

Summary updated

BibTeX
@misc{feldman2026co,
  author = {Yair Feldman and Linxi Zhao and Nathan Godey and Dongyoung Go and Yilun Hua and Kilian Q. Weinberger and Jennifer J. Sun and Yoav Artzi},
  title = {{Co-LMLM: Continuous-Query Limited Memory Language Models}},
  year = {2026},
  eprint = {2607.07707},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2607.07707},
}
Figure