Inference engine
Mothfire Inference
An inference engine that serves agent sessions, not just requests.
The repository opens with the first release
Research explorationWe’re studying the problem and designing the first release. There’s nothing to install yet.About stages
Why
A coding agent’s session is hundreds of model calls over one growing context. In public traces of real coding agents, a typical call re-reads over a hundred thousand tokens of context, adds under a thousand, and generates a few hundred — with pauses in between: a second or so for most tools, minutes for people.
Inference engines are built around independent requests. Every call resends the whole conversation, and the engine rediscovers the session by matching prefixes. When a chat template rewrites earlier history, or a summary replaces it, the cache is missed without a word. And the engine can’t tell a session that’s paused for a tool from one that’s over, so the context it will need again in a few seconds competes for memory with everything else. The best open models make it sharper: they’re hybrids, whose linear-attention state can be reused only where it was saved.
What we’re building
- A session benchmark. An open trace format and a replayer that measures any engine on real agent sessions — the wait for the first token after each tool call, the time per session, and the memory paused sessions hold.
- A compact engine for the best open models. Built from scratch on proven kernels, small enough to read end to end, and speaking the APIs agents use now — Open Responses and Anthropic Messages. It serves the best open models, Kimi K3.1 Pro and GLM-5.3-Flash: hybrids of linear and sparse attention with hundreds of experts, spread across the GPUs of one machine. Nothing older.
- Sessions as first-class objects. The engine keeps each session’s tokens, so a call appends instead of resending. Sessions branch, rewind, and pause; their state is saved where each step ends, kept through tool calls, and moved to host memory through longer pauses; and every cache miss reports its reason.
What it isn’t
Not a race to support every model and every GPU, a kernel library, or a datacenter orchestrator. Mothfire Inference serves only the best open models, each on one machine of eight GPUs, and measures itself against the best open engines on the same sessions, publishing what it finds.