Verace Keel
A capped-window attention patch with a constant-size linear-attention memory for a small pretrained language model, plus a local serving stack.
- KdV soliton memory ring: Fixed-size state that does not grow with context
- Eviction folding: Tokens leaving the 256-token window fold in
- Memory read-out: Added to the local output at weight 0.05
Overview
Verace Keel is a language model serving system that replaces standard attention with a capped local window plus a constant-size recurrent memory. It addresses a single question: can a pretrained model keep conversing over very long contexts without a key-value cache that grows with every token? The lab's technical description frames the model after the Kimi K3 architecture, which is the Kimi Team's design, described in their technical report (arXiv:2607.24653). The code loads Qwen2.5-Coder-0.5B, a small pretrained model built by another party. The lab's own work is the attention patch and the serving stack around it.
The core idea is dual-scale attention. Recent tokens receive exact scaled dot-product attention inside a window capped at 256 tokens, with 4 sink tokens always kept. Tokens that leave the window are folded into a fixed-size matrix memory with a linear-attention recurrence and a decay of 0.999. The memory output is added to the local output at weight 0.05. The technical description calls this memory a KdV soliton memory ring, after the Korteweg-de Vries wave equation . Around the patched model, the system has a serving engine, a byte-level tokenizer, an interactive terminal chat and an HTTP server.
The code monkey-patches every attention layer of the base model with CappedWindowKdVSolitonAttention and adds generate and stream_generate methods. A singleton engine formats multi-turn chats and dispatches them to streaming or blocking generation. A FastAPI server on port 8585 exposes OpenAI-style /v1/chat/completions and /v1/models endpoints and an Anthropic-style /v1/messages endpoint, with server-sent event streaming. The technical description claims conversations of up to 10 billion tokens with no memory growth. The records contain no measurement of this claim, of generation quality, or of memory use.
Status: the attention patch, the memory module, the tokenizer, the serving engine, the chat interface and the API server are implemented, and a test suite exists. No training run, evaluation or benchmark is recorded. The technical description says the system loads a distilled weight file, and describes its own target layout as multi-head attention and BlockSparseMoE decoder layers with 64 or more experts, a layout that is the lab's description and not the design in the Kimi Team's report. The code instead loads Qwen2.5-Coder-0.5B, and no expert layers appear in it. The configuration sets a memory decay of 0.98, while the memory module uses 0.999. The 10-billion-token context remains an unmeasured claim.
Status
Prototype. The attention patch and serving stack are implemented with a test suite, but no training run, evaluation or measurement of the long-context claim is recorded.
Simulator
A row of tokens is read two ways at once: the newest token looks back at every earlier one, and every token is also written into one memory of fixed size that fades.
- looking back: one arc for every earlier token
- fixed memory: how much of each token it still holds
- newest token at the right
- Looking back, this token
- 23 comparisons
- Looking back, whole sequence
- 276 comparisons
- State kept: looking back / fixed
- 24 tokens / 1 state
- Fixed memory: a token is half faded after
- 4.3 tokens
Lengthen the sequence: the arcs multiply, the fixed memory stays one state. Lower the decay and it forgets sooner.
This simulator is an illustration of the principle, with made-up numbers. It does not run the lab's code or show the lab's data, and nothing in it is a measurement.
Architecture
Capped-window soliton attention
A replacement for every attention layer of the base model that combines exact attention over a capped recent window with a constant-size memory of evicted tokens.
KdV soliton memory module
A linear-attention memory that keeps a fixed-size state per layer, so memory per token stays constant regardless of context length.
Patched causal language model
The model wrapper, which loads the pretrained Qwen2.5-Coder-0.5B base model, installs the patched attention and adds autoregressive and streaming generation.
Serving engine
A singleton engine, which turns multi-turn message lists into a chat template and runs streaming or blocking generation.
Multi-protocol API server
A FastAPI server with OpenAI-compatible chat completion and model listing endpoints and an Anthropic-compatible messages endpoint, streaming over server-sent events.
Byte-level tokenizer
A 256-symbol tokenizer over UTF-8 bytes with special tokens.
Terminal chat interface
An interactive command-line chat that streams tokens and supports /reset, /exit and /help, where /reset also clears the soliton memory.
Implementation
Mechanisms as they are implemented in the source code, with the constants the code uses.
- Decayed linear-attention memory recurrence
- The memory keeps a matrix state and a normaliser, both updated with decay : and . The output is read as , so the state size does not depend on how many tokens have been absorbed.
- ELU plus one feature map
- Queries and keys are mapped through before entering the recurrence. This keeps the features positive, so the normaliser stays positive.
- Topos dispersion modulator
- An 8 by 8 modulator acts on the top harmonic modes of the memory state, on top of the linear-attention recurrence. The code names it a dispersion term. Its effect on outputs is not evaluated in the records.
- Capped local window with sink tokens
- Exact scaled dot-product attention runs over a window strictly capped at 256 tokens. The first 4 tokens are kept permanently as attention sinks.
- Eviction folding into the memory
- Tokens pushed out of the 256-token window are not discarded. Their keys and values are folded into the soliton matrix memory with decay 0.999.
- Weighted fusion of local and memory outputs
- The memory read-out is added to the exact local attention output at a fixed weight of 0.05, so local attention dominates and the memory contributes a small long-range correction.
- Attention monkey-patching of a pretrained model
- The model code loads Qwen2.5-Coder-0.5B and replaces the attention module of every layer with the capped-window soliton attention, leaving the other pretrained weights in place.
- Streaming UTF-8 byte accumulator
SafeUTF8ByteStreamAccumulatorbuffers partial multi-byte UTF-8 sequences during streaming and emits text only once the bytes decode, so streamed output never shows broken characters.- Soliton cache configuration
- The configuration dataclass combines Qwen-style hyperparameters with soliton cache settings: 64 channels, dispersion 0.5 and decay 0.98, plus a stated 10-billion-token context. The decay of 0.98 differs from the 0.999 used in the attention code.
Results
From the lab's own experiments and records. They have not been independently replicated.
Code base model differs from described architecture
The technical description says the system loads a distilled weight file and gives its own target layout as multi-head attention and BlockSparseMoE decoder layers. The code loads Qwen2.5-Coder-0.5B and patches only its attention.
Memory decay set inconsistently
The configuration sets the soliton cache decay to 0.98, while the memory module and the capped-window attention use 0.999.
Ten-billion-token context is unmeasured
The technical description claims conversations of up to 10 billion tokens without memory growth. The records contain no run or measurement supporting this figure.
Concepts
- Key-value cache
- The stored keys and values of past tokens that a transformer attends to during generation. Its size grows linearly with context length, and full attention over it costs time quadratic in that length.
- Linear attention
- An attention variant that replaces the softmax with a feature map, so past tokens can be summarised in a fixed-size matrix updated recurrently instead of being stored one by one.
- KdV soliton
- A solitary wave solution of the Korteweg-de Vries equation that keeps its shape as it travels. The technical description uses it as the motivating picture for the memory, which the code implements as a decayed linear-attention recurrence.
- Attention sinks
- A few initial tokens that are kept permanently in the attention window. Verace Keel keeps 4 of them alongside the 256-token local window.
- Dual-scale attention
- Combining exact attention over recent tokens with a compressed memory of older ones, so short-range detail is precise and long-range context costs constant memory.
- Constant memory per token
- The property that state size does not grow with sequence length. The memory module is designed for it, and the technical description claims it allows conversations of up to 10 billion tokens.
- Kimi K3 architecture
- A model design by the Kimi Team, described in their technical report (arXiv:2607.24653), which the lab's technical description names as its template. That description gives its target layout as multi-head attention and BlockSparseMoE decoder layers, which is the lab's own account and not the design in the report, and the code builds on Qwen2.5-Coder-0.5B instead.
- Mixture of experts
- A layer design in which a router sends each token to a small subset of expert feed-forward networks. The technical description mentions top-k routing over 64 or more experts, and the code examined shows no such layers.
- Monkey-patching
- Replacing a module of an existing model at runtime without retraining from scratch. Verace Keel uses it to swap every attention layer of the pretrained base model.
- Server-sent events
- A streaming HTTP format in which the server pushes a sequence of events over one connection, used here to stream generated tokens to OpenAI-style and Anthropic-style clients.
About this page
Written from the lab's own documents and source code. Figures and results are the lab's measurements as it recorded them at the time, and have not been independently replicated.
Published under the PolyForm Noncommercial License 1.0.0: free for noncommercial use.