# MemOnce: Scalable LLM Memory With One KV Decode Per Query

> Source: <https://explainx.ai/blog/memonce-scalable-llm-memory-architecture-2026?utm_source=rss&utm_medium=feed&utm_campaign=blog>
> Published: 2026-11-24 00:00:00+00:00

**Recommendation:** For long-context serving, test storing only a short tail of final-layer hidden states in a shared memory bank and projecting them back to per-layer KV, reusing one sparse index set across layers instead of keeping full per-layer caches.
More in the playbook "Inference and self-hosting": <https://wpnews.pro/playbooks/inference-serving>

**MemOnce is a new open research architecture for long-horizon language models** that tries to escape the **linear GPU memory growth** of classic **[KV caches](https://explainx.ai/blog/what-is-kv-cache-llm-inference-explained-guide-2026)** without giving up the **fine-grained recall** people expect from full attention. **[arXiv 2611.27973](https://arxiv.org/abs/2611.27973?ref=explainx)**, posted **November 20, 2026** by **Chang Nie**, **Chaoyou Fu**, **Songlin Liu**, **Yiqing Hu**, and **Caifeng Shan** (Nanjing University and University of Science and Technology of China affiliations per [arXiv](https://arxiv.org/abs/2611.27973?ref=explainx) and [Hugging Face Papers](https://huggingface.co/papers/2611.27973?ref=explainx)), ships with a **[project page](https://clare-nie.github.io/MemOnce/?ref=explainx)** and **[GitHub repo Clare-Nie/MemOnce](https://github.com/Clare-Nie/MemOnce?ref=explainx)**. The headline systems claim: at **1M tokens** on adapted **Qwen3.5-4B**, **~1,313×** smaller active memory state cache, **6.9×** faster prefill, and **+5.77%** on their long-memory benchmark average—**author-reported** numbers you should treat as **reproducibility targets**, not vendor SLAs.

## TL;DR: the two mechanisms

| Piece | What it does | Why it matters | 
|---|---|---|
| **Memory encoder-decoder** | Caches only a **small trailing subset** of**final-layer hidden states** in one**global memory bank** , then**projects** retrieved states back into**per-layer KV** when an attention block needs them | Avoids storing **L layers × T tokens** of KV for the full history | 
| **Memory sparse attention** | For each new continual input, computes **which memory slots matter once** , then**reuses the same sparse indices across layers** | Stops every layer from re-scanning the entire past at full density | 
| **Hybrid backbone** | Alternates **linear-time blocks** (paper cites**Gated DeltaNet** ) with**MemOnce attention blocks** | Blends **cheap local mixing** with**selective recall** | 

The slogan on the project page—**write once, index once, decode on demand**—is the implementation story in one line.

## Why builders are looking past "just buy more HBM"

Long-context agent ribbon passing through a window, illustrating MemOnce memory pressure on agent harnesses

Agent harnesses that loop for hours—[Codex jobs](https://explainx.ai/blog/mobile-agent-testers-claude-code-github-actions-parallel-qa-november-2026), support bots, coding CLIs—hit the same wall **[vLLM versus SGLang](https://explainx.ai/blog/vllm-vs-sglang-inference-server-comparison-2026)** customers debate daily: **context length** is not free. Every token in history adds **KV tensors** across **every attention layer**. Prefill cost scales **quadratically** in the naive attention case, and **decode** keeps rereading that cache.

Research teams attack that bottleneck from several angles. **[Zyphra ZHA](https://explainx.ai/blog/zyphra-zha-hierarchical-attention-subquadratic-tree-indexer-qwen3-6-35b-ruler-modeled-speedups-2026)** sparsifies which keys each query sees. **[NVIDIA sparse attention co-design](https://explainx.ai/blog/nvidia-sparse-attention-co-design-long-context-inference-november-2026)** chases hardware-aligned sparsity. MemOnce is another entry: **learned memory states** plus **structured sparsity**, aimed at **native memory** inside the model rather than only **external retrieval**.

If you run **[multi-day agent evaluations](https://explainx.ai/blog/hugging-face-agentic-evaluation-guide-harbor-november-2026)**, the interesting question is whether MemOnce's **bounded cache** changes **dollars per successful task** more than a **bigger GPU** does.

## Architecture walkthrough

The **[MemOnce project page](https://clare-nie.github.io/MemOnce/?ref=explainx)** breaks training and inference into three public steps:

1. **Write — cache memory only once.** Only**final-layer** hiddens for a**short tail** enter the**global bank** . Earlier layers never keep their own duplicate token caches for the whole transcript.
2. **Index — retrieve once per query.** Given a new user or tool message, MemOnce scores memory slots**one time** and fixes**sparse indices** for that turn.
3. **Read — decode KV on demand.** Retrieved vectors**expand** into the**key/value tensors** each attention layer consumes, while much of the**backbone stays frozen** during adaptation experiments.

The paper argues this coupling yields **linear-time complexity** in their setup and a **constant GPU memory budget** for the **active** memory state, as opposed to **unbounded KV growth**.

MemOnce pretraining benchmark table comparing Transformers, GDN, and MemOnce at 400M scale
*Image: [Chang Nie et al., MemOnce project](https://clare-nie.github.io/MemOnce/?ref=explainx)*

### Pretraining from scratch (FineWeb-Edu)

On roughly **400M-parameter** runs, MemOnce posts **validation perplexity 10.77** at compression ratio **r = 1** and **10.89** at **r = 8**, beating a **365M Transformer** baseline at **10.97** in the public table. Against **Gated DeltaNet (GDN)** and **YOCO**, MemOnce claims **better average zero-shot scores** on eight reasoning-style tasks while using **64× depth–time cache compression** with **under 0.3%** accuracy loss between **r = 1** and **r = 8** in their scaling chart narrative.

Those are **pretraining** results, not a productized **Qwen** drop. They matter because they show the stack is meant as a **foundation architecture**, not only a **LoRA bolt-on**.

## Long-context memory adaptation on Qwen3.5

The more product-facing section adapts **Qwen3.5-2B** and **4B** "full context" baselines to MemOnce and tests **MemBench**, **LoCoMo**, **LongMemEval**, and **PersonaMem** out to **~1M tokens** on the hardest persona split.

| Model | Overall long-memory average (project table) | Delta vs full-context baseline | 
|---|---|---|
| Qwen3.5-4B full context | 54.30% | — | 
| MemOnce-4B (authors) | 60.07% | **+5.77 points** | 
| Qwen3.5-2B full context | 49.33% | — | 
| MemOnce-2B (authors) | 51.17% | **+1.84 points** | 

The authors position MemOnce as the **first native memory model** in their comparison set to **beat** the **full-context Qwen** baseline on that average, ahead of **M+**, **Metis**, **δ-Mem**, and **EvoEmbedding** in the same table. Independent labs have not yet published conflicting numbers on Hugging Face or Hacker News as of this writing.

## Systems numbers at 1M context

MemOnce inference scalability chart showing KV cache reduction and prefill speed at 1M context
*Image: [Chang Nie et al., MemOnce project](https://clare-nie.github.io/MemOnce/?ref=explainx)*

The project page's **inference scalability** panel is what most **infra engineers** will screenshot:

| Metric (Qwen3.5-4B + MemOnce, 1M context) | Claim on project page | 
|---|---|
| Active GPU memory state cache | **~25 MB** ,**1,313×** smaller than compared baseline | 
| Prefill latency | **6.9×** faster | 
| Decoding throughput | **3.5×** higher (**29.3 tok/s** cited) | 
| Retrieval plus KV decode overhead | **64.2 ms** end-to-end in one table row | 

Map those against how you already budget **[speculative decoding](https://explainx.ai/blog/what-is-speculative-decoding-llm-inference-guide-2026)** and **[prefix caching](https://explainx.ai/blog/what-is-kv-cache-llm-inference-explained-guide-2026)** on the same GPUs. MemOnce is **not** a drop-in flag on **vLLM** today; it is a **research codebase** you would integrate only after reading their **hybrid block** schedule.

### How MemOnce compares to other KV research lines on this blog

Several 2026 papers attack the same **GPU footprint** problem with different geometry. **[Multi-Branch Transformer Joint-KV](https://explainx.ai/blog/multi-branch-transformer-joint-kv-mbt-uiuc-2026)** shares keys across branches to deduplicate storage. **[NVIDIA's compaction study](https://explainx.ai/blog/nvidia-you-dont-need-long-context-compaction-sssm-arxiv-november-2026)** argues many agent traces can **summarize away** without quality loss. MemOnce instead **learns a memory bank** and **rehydrates KV only where attention fires**, which is closer to **native recurrent memory** than to **post-hoc summarization**. None of these are interchangeable flags; each needs **your workload trace**—codegen sessions look different from **PersonaMem** personas.

If you teach long-context design in a **[workshop cohort](https://explainx.ai/workshops)**, use MemOnce as a **reading assignment**: ask students to reproduce **one 128K row** and explain whether **sparse indices** stay stable when users **edit earlier messages**. That exercise surfaces whether **agent products** need **retrieval** or **learned memory** first.

## How to try MemOnce this week

1. **Read the paper** —[arXiv PDF](https://arxiv.org/pdf/2611.27973?ref=explainx) for training objectives and ablations.
2. **Clone the repo** —[github.com/Clare-Nie/MemOnce](https://github.com/Clare-Nie/MemOnce?ref=explainx) for configs; star count was modest on November 24 but the**README and checkpoints** are the gate that matters.
3. **Reproduce one row** — pick**PersonaMem ~128K** before chasing**1M** ; confirm**GPU model** ,**batch** , and**precision** match the paper before quoting throughput externally.
4. **Compare honestly** — run the same prompt suite on**dense KV** with your existing**[inference server](https://explainx.ai/blog/vllm-vs-sglang-inference-server-comparison-2026)** so savings are**net of integration tax** .

The Hugging Face entry includes `arxiv:2611.27973` and `hf papers read 2611.27973` CLI instructions if you pipe papers into local research agents—use your normal **data-handling policy** before sending proprietary chats through any experimental stack.

## Limitations the authors and page imply

- **Scope is memory architecture** , not**tool-use reliability** or**safety alignment** . Better long recall does not fix**bad actions** from agents; pair model work with**[evaluation harnesses](https://explainx.ai/blog/hugging-face-agentic-evaluation-guide-harbor-november-2026)** and policy checks.
- **1M-token claims** need**your hardware** profile. A**25 MB** active state still sits beside**weights** ,**activations** , and**framework overhead** .
- **Competing memory papers** land weekly on Hugging Face; MemOnce is one**encode-once** design among**[surveys of memory-centric compression](https://huggingface.co/papers/2610.21165?ref=explainx)** the Librarian bot lists near this entry.
- **No major lab product** ships MemOnce yet. Contrast with**[frontier sparse attention research](https://explainx.ai/blog/nvidia-sparse-attention-co-design-long-context-inference-november-2026)** that already targets**production stacks** .

## Where MemOnce fits in your roadmap

| If you are building… | MemOnce may help when… | Safer default today | 
|---|---|---|
| **Personal agents with week-long threads** | You control the **base model** and can**fine-tune** | **RAG + summarization** with audited retrieval | 
| **On-prem long-context chat** | You can **allocate engineering** to**custom inference** | **Quantized KV** and**context pruning** in**[vLLM](https://explainx.ai/blog/vllm-vs-sglang-inference-server-comparison-2026)** | 
| **Research prototypes** | You need a **published baseline** beyond**RMT / Titans** style papers | Start from **arXiv + GitHub** before promising customers**1M** | 

None of that replaces **[workshop training on agent harness design](https://explainx.ai/blog/ai-agent-workshop-formats-prerequisites-how-to-pick-2026)**—architecture papers change **cost curves**, not **operator discipline**.

## What we are watching next

- **Independent replications** on**Hugging Face Spaces** or**GitHub issues** with conflicting throughput numbers.
- **Integration patches** for**PyTorch** training loops beyond the authors'**Qwen3.5** adaptation recipe.
- **Downstream embeddings** : the paper claims**zero-shot** representation tasks; if**code or weights** for those heads ship, compare against whichever**embedding endpoint** you already use in production RAG.

We will add an update if **peer review**, **v2 arXiv**, or **major inference engine** adoption appears.

## Related reading

*Benchmarks and tables follow the MemOnce project page and arXiv 2611.27973 as of November 24, 2026.*
