New in 0.4.12 Qwen3.6-35B-A3B

Make LLM state
programmable.

An 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

Two connected forms rendered in blue ASCII characters

LPCompact

Compact state.
Keep going.

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.

Qwen3.8-27B8×
8 GiB to 1 GiB of attention KV at 128K
state = state.compact()

LPCombine

Two contexts.
One continuation.

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".

Qwen3.5-4B · Example
“When does the project ship?”
model.combine(left, right)

LPBridge

Read once.
Hand it over.

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.

Qwen3.5-4B to Qwen3.8-27B 0 historical tokens replayed by the target
ReadProcess the source context
TranslateCarry over working memory
ContinueGenerate with the target model

Benchmarks

Smaller caches.
Faster handoffs.

Qwen3.6-35B-A3B · BF16 · 128K

61/64

Correct 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 benchmark

Qwen3.5-4B · BF16 · NVIDIA L40S

1M

Input tokens processed with compaction

Four compactions left 82,496 physical KV positions. The restored snapshot accepted token 1,000,001. Retrieval at that length remains unmeasured.

Million-token replay

4B to 27B research preview

The first token, sooner.

2.19×

Faster to first emitted token

Paired requests at ~16K context on RTX 5090

Median warm time to first emitted token
Transfer benchmark and methodology

More tasks completed with the larger model

The 4B to 27B research preview more than doubled the 4B reader’s task successes on an independent 64-task panel.

11/64Native 4B
23/64LatentPort 4B to 27B

Reusable state

One context.
Different directions.

Let a model read a codebase once. Save the snapshot, then use it as a starting point for independent security and performance reviews.

SaveKeep working context beyond one session.
ResumeRestore the snapshot and append new observations.
ForkRun separate tasks from the same starting point.
Explore the runtime cookbook

Model catalog

Pick a model.
Keep the same API.

Use LPCompact across seven models and LPCombine across six. Choose BF16, NF4, or a pinned GGUF checkpoint for your setup.

Base modelLPCompactLPCombine
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

LatentPort: Beyond KV Cache

Simon P. Villani’s September 2026 paper explored how one hybrid language model can inherit the recurrent memory of another.

Read the original paper

Get started

Try LPCompact in Python.

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 bf16
Compact a snapshot · Python
import 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.