Qwen3.6-35B-A3B · BF16 · 128K
61/64Correct retrieval answers with 8× compaction
On a paired 128K synthetic retrieval panel, the full-memory model scored 53/64. Compaction retained all 53 of those answers.
Qwen3.6 benchmarkAn open-source Python runtime for LLM inference state. Compact KV caches, hand off state to compatible models, and combine, save, or fork snapshots.
Created by Simon P. Villani
State operations
LatentPort captures the working memory a model builds as it reads. Use that state as the starting point for the next task, session, or model.
Free attention memory with a learned selector.
CombineContinue one snapshot with a second saved context.
TransferLet a new model continue from the reader’s state.
ReuseSave, resume, or fork a session into independent branches.
LPCompact
Make room for more history. A trained selector keeps useful attention key/value (KV) entries, then the same model continues from the smaller cache with its original token positions.
Seven supported models, from Qwen3.5-4B to Qwen3.6-35B-A3B, including Gemma 4 31B IT.
state = state.compact()LPCombine
Start with a project brief and release notes captured by the same model. LPCombine continues the first snapshot with the second context, so you can ask one question about both.
LPCombine replays the right-hand context after the left snapshot. It uses recorded tokens or recovers them from cached input embeddings with method="cache".
model.combine(left, right)LPBridge
Let a 4B model read the history, then let a 9B or 27B model take it from there. A learned bridge translates the reader’s attention cache, recurrent memory, convolution history, and hidden state.
Benchmarks
Qwen3.6-35B-A3B · BF16 · 128K
61/64On a paired 128K synthetic retrieval panel, the full-memory model scored 53/64. Compaction retained all 53 of those answers.
Qwen3.6 benchmarkQwen3.5-4B · BF16 · NVIDIA L40S
1MFour compactions left 82,496 physical KV positions. The restored snapshot accepted token 1,000,001. Retrieval at that length remains unmeasured.
Million-token replay4B to 27B research preview
Faster to first emitted token
Paired requests at ~16K context on RTX 5090
The 4B to 27B research preview more than doubled the 4B reader’s task successes on an independent 64-task panel.
Reusable state
Let a model read a codebase once. Save the snapshot, then use it as a starting point for independent security and performance reviews.
Model catalog
Use LPCompact across seven models and LPCombine across six. Choose BF16, NF4, or a pinned GGUF checkpoint for your setup.
| Base model | LPCompact | LPCombine |
|---|---|---|
| Qwen3.6-35B-A3B | Selector | — |
| Qwen3.5-4B | Selector | Profile |
| Qwen3.5-9B | Selector | Profile |
| Qwen3-14B | Selector | Profile |
| Qwen3.8-27B | Selector | Profile |
| Qwen3.8-Flash-Next | Selector | Profile |
| Gemma 4 31B IT | Selector | Profile |
Original research
Simon P. Villani’s September 2026 paper explored how one hybrid language model can inherit the recurrent memory of another.
Read the original paperGet started
Start with Python 3.11+, an NVIDIA GPU, CUDA-enabled PyTorch, and a matching CUDA compiler. Use the setup guide for your platform, then install the BF16 backend and check it.
python -m pip install --no-build-isolation "latentport[bf16]"
latentport doctor --backend bf16import latentport as lp
history = "The project is Atlas. Atlas ships on Friday.\n" * 1024
with lp.load_model("Qwen/Qwen3.5-4B", backend="bf16") as model:
state = model.prefill(history)
compacted = state.compact(force=True)
print(state.physical_kv_length, "→", compacted.physical_kv_length)
with model.session(compacted) as session:
print(session.ask("When does the project ship?").text)
The diagnostic prints a smaller physical KV count, then asks the compacted model a question. force=True lets this short example compact. Qwen3.5-4B normally starts at 65,536 physical KV positions.