Why agent apps break small models, and the lean lane we are building
The Context Crash on 25 Nov 2026
On 25 Nov 2026, we connected our local Qwen3.5-4B model to PicoClaw, a small open-source agent app. We set our local model context size to 4096 tokens. On the very first run, the execution failed immediately. The runtime returned this exact error message:
request (18313 tokens) exceeds the available context size (4096 tokens)
The system prompt built by PicoClaw, combined with tool definitions, came out to about 18,300 tokens. Because our model instance had a 4096-token context window limit, the input payload was more than four times larger than our context budget, causing the request to fail before processing started.
Why Agent Apps Break Small CPU Models
Agent applications like Hermes and PicoClaw are designed for big hosted models with context windows of 128K tokens or larger. Because these frameworks assume large context budgets, they default to sending complete system instructions and full lists of available tools on every single request.
Across our servers, we have about 280 tools. When PicoClaw runs, it attempts to serialize the definitions for all 280 tools into the request prompt, alongside long system instructions describing how the agent should reason, invoke tools, and structure its output.
Even if our local model context window were expanded to accept 18,300 tokens, running payloads of that size on CPU hardware creates an extreme latency bottleneck. Our local setup processes prompt tokens at approximately 8.6 tokens per second on CPU. At 8.6 tokens per second, reading an 18,300-token prompt takes about 35 minutes before the model generates its first output word. When we cut the prompt down to about 800 tokens, prompt processing drops to under 2 minutes. Small CPU models cannot run under agent frameworks that re-send hundreds of tools on every call.
Knowledge Division: RAG, Tools, and Fine-Tuning
To keep context usage small while preserving answer quality, we separate knowledge into three distinct functional channels:
- Look-up first (RAG): We use retrieval over static documentation for factual knowledge. This covers standard operating procedures (SOPs), payer rules, and denial codes. The model only receives the relevant text fragments needed for the specific query.
- Tools: We restrict tool calls strictly to fetching live numbers and real-time state.
- Fine-tuning: We use fine-tuning solely to enforce model behaviour and format compliance, not to store factual data inside parameter weights.
Speed Levers Ranked by Performance Gain
We tested and ranked ten speed levers based on the actual performance gains measured on our CPU hardware setup.
| Rank | Speed Lever | Measured Gain / Status |
|---|---|---|
| 1 | Short instructions with 3-5 tools per job | 10-20x gain |
| 2 | Keep fixed opening identical (llama.cpp prompt cache) | 2-10x gain on repeat calls |
| 3 | Turn thinking off for simple jobs | Cuts output latency on simple tasks |
| 4 | Force JSON answer shape with a grammar | Eliminates formatting retries |
| 5 | Cap answer length | Prevents run-on generations |
| 6 | 4-bit model quantization | Done on our box |
| 7 | Sparse MoE models | Reduces active parameter compute |
| 8 | Draft-model speculative decoding | Smaller gain on CPU |
| 9 | Fine-tune on our jobs | Reduces prompt instruction overhead |
| 10 | Add a GPU | Hardware upgrade path |
Here is how these levers function in our deployment:
- Short instructions with only 3-5 tools: Stripping out the full list of 280 tools and supplying only the 3-5 tools required for a specific job yields our largest speedup, improving execution speed by 10-20x.
- Keep fixed opening identical: Keeping the opening prompt sequence identical across calls allows llama.cpp to reuse its internal prompt cache, yielding a 2-10x speedup on repeat requests by bypassing prompt re-processing.
- Turn thinking off for simple jobs: Disabling internal reasoning steps for basic tasks eliminates extra output tokens and lowers output generation time.
- Force JSON answer shape with a grammar: Enforcing strict output schemas using execution grammars guarantees valid JSON output, preventing parsing errors and eliminating retry loops.
- Cap answer length: Applying hard upper limits on token generation prevents unnecessary model output and caps maximum latency.
- 4-bit model: We have already quantized Qwen3.5-4B to 4-bit precision to fit within system memory limits and increase CPU processing rates.
- Sparse MoE models: Switching to sparse Mixture-of-Experts architectures lowers the active parameter count required per generated token.
- Draft-model speculative decoding: Using smaller draft models to predict output tokens yields a smaller performance gain on CPU hardware compared to GPU execution.
- Fine-tune on our jobs: Training the model directly on our specific job patterns allows us to eliminate lengthy instructions from the prompt payload.
- Add a GPU: Shifting processing off CPU hardware to dedicated graphics cards provides a hardware upgrade path to scale token generation rates.
The Lean Lane Design
To avoid the overhead of heavy agent apps, we designed a streamlined workflow called the lean lane. The system executes requests through six defined steps:
- Pick job type: Identify the specific task classification of the incoming user request.
- Build a short prompt: Assemble a minimal prompt containing a fixed opening sequence, definitions for only the 3-5 tools required for that job type, the top 3 look-up results from RAG (over SOPs, payer rules, or denial codes), and the user question.
- Force JSON: Apply a execution grammar to constrain the model's output strictly to the required JSON schema.
- Validate response: Parse and validate the JSON object returned by the local model.
- Fallback execution: If output validation fails, or if the model indicates that it is unsure, transmit the identical job request to a big free hosted model.
- Log call data: Log every call request, context payload, tool selection, and output across both local and hosted runs to build dataset files for future model training.
What we do next
We are building the lean lane execution pipeline on our local CPU box. We are configuring our system prompts to keep opening prefixes fixed for llama.cpp prompt caching, mapping our 280 server tools into task-specific sets of 3-5 tools per job type, and enabling logging across local runs and hosted fallbacks to gather training data for future fine-tuning.