Scaling EngramState to larger tool repositories

The important question is not whether 24 tools work. It is which costs grow with the repository, which stay constant, and where retrieval quality begins to matter.

Execution cost stays local to the candidate

EngramState never loads the full state repository for one request. The retriever selects Top-K candidates and the executor loads one candidate state per attempt. This means the cost of a single state-loading + generation step does not increase just because the catalog contains more tools.

What does scale with tool count?

Similarity comparisons increase with the catalog size, just as they do in retrieve-then-prompt systems. In our 100-tool measurement, similarity computation plus Top-K scanning took only 0.0304 ms out of 24.1 ms total retrieval time—about 0.1% of retrieval latency.

ToolsHit@1Hit@4Tool embeddingsTotal retriever memory
240.98330.995012.0 KiB8.26 MiB
500.94400.992925.0 KiB8.28 MiB
1000.89900.985050.0 KiB8.30 MiB
2060.85760.9563103.0 KiB8.36 MiB

Why Hit@4 matters

EngramState can traverse multiple candidates, so Hit@4 is often more operationally meaningful than Hit@1. At 206 tools, the MLP retriever still places the correct tool in the Top-4 about 95.63% of the time.

The retriever objective is weighted

The State Retriever is not trained by blindly adding every loss term with equal weight. The objective combines a retrieval loss, an auxiliary tool-classification loss, and a hard-negative ranking loss. The auxiliary coefficients are treated as hyperparameters and selected from values between 0 and 0.3.

L = L_retrieval
  + λ_cls  · L_tool_classification
  + λ_hard · L_hard_negative

This matters because the auxiliary tasks are useful regularizers, but allowing them to dominate can hurt the representation used for actual retrieval.

End-to-end retrieval, not just ranking

A retriever can have good Hit@K and still create a poor system if it is large, slow, or increases retries. We therefore measured the complete pipeline.

RetrieverHit@1Hit@4Acc.Soft Acc.TTFTAvg callsStorage
Oracle1.0001.0000.7850.8960.03711.730
EngramState0.9400.9950.7400.8480.06101.778.24 MiB
MPNet FT0.9400.9900.7400.8400.05001.81417.66 MiB
BGE-base FT0.9350.9950.7300.8350.04931.86417.64 MiB
MiniLM FT0.9200.9900.7250.8350.04621.8386.64 MiB
Systems lesson: the best retriever for an on-device agent is not necessarily the largest semantic encoder. The retriever itself becomes part of the deployment budget.

Offline compilation scales linearly

State preparation increases linearly with tool count, but compilation is separated from online inference.

BackboneTime / state48-state DroidCall repository
RWKV-7 0.1B0.033 s1.58 s
RWKV-7 0.4B0.075 s3.60 s
RWKV-7 1.5B0.140 s6.72 s
RWKV-7 2.9B0.247 s11.86 s

For RWKV-7 1.5B, Base + Corrective compilation for one tool is roughly 0.28 s. Extrapolating the same per-state measurement, 1,000 states take roughly 140 s on one RTX 3090. The cost grows, but it is paid offline and can be parallelized.

Common offline work vs EngramState-specific work

Function-calling systems already pay common preparation costs such as LLM fine-tuning and retriever training. In our setup, LLM fine-tuning takes 2.4 / 4.4 / 6.5 / 13.5 hours for the 0.1B / 0.4B / 1.5B / 2.9B RWKV-7 variants using 10k examples, 24 epochs, and eight RTX 3090 GPUs. The additional EngramState-specific step is state compilation, which is orders of magnitude smaller.

← Back to technical notes