Blog 5 December 2026

A domain embedding model on 2 CPUs and 4 GB

argot-inference is a small Rust server that runs our model on a CPU. What it costs in latency and memory, what it keeps in accuracy, and the ideas that did not help.

argot-inference is a small Rust server that turns text into vectors on a CPU. It runs the int8 ONNX build of artha-embed-indianfs-v1, our retrieval model for Indian financial services content. The target is a machine with 2 vCPUs and 4 GB of memory: no GPU, no Python at run time, and no text leaving your network.

How the model was built is a separate post.

Results first

what we measured result
recall@10, 1,490 questions over 35,110 passages .697 (the full-precision model: .698)
encoding a short query, p50, one at a time, 2 CPUs 49 ms (ARM), 54 ms (x86), best setting on each
peak memory 0.8 GB with one session, 1.3 GB with two
encoding a 256-token passage 0.5 to 0.6 s, best setting on each

The speed figures come from shared CI machines inside a container limited to 2 CPUs and 4 GB, not from a dedicated small VM. They time the encoding inside the process, without HTTP. Treat them as indicative. This is an early release.

What is in the box

ONNX Runtime does the arithmetic. Rust does the rest: tokenising, the query prompt, a pool of sessions, and an HTTP API shaped like OpenAI's /v1/embeddings. You get one binary and the ONNX Runtime library.

The binary contains no HTTP client, so it cannot send your text, or a key, anywhere. It needs no keys. It stores and searches nothing: put the vectors in whatever vector database you already use.

As a service it has:

  • timeouts for reading a request and for answering it, and limits on size, connections and queued requests;
  • a clean stop: on SIGTERM it finishes the requests it has, then exits;
  • /health, and /metrics in the Prometheus format, with no request text in it.

When a request times out, or its caller hangs up, the texts not yet encoded are skipped, so abandoned work does not take CPU from the next caller.

Use a recent ONNX Runtime. In early tests version 1.20 ran this model about ten times slower than 1.32 does. We have not measured 1.20 again since.

The setting that matters most

Send "input_type": "query" with search queries, and send passages without it.

curl -s http://127.0.0.1:8080/v1/embeddings \
  -d '{"input": "annual fee for a credit card", "input_type": "query"}'

The model was trained with task: search result | query: in front of every question and nothing in front of passages. On the 1,490-question benchmark:

what the engine or model was given recall@10
prompt on queries, none on passages (correct) .698 full precision, .699 int8 index
no prompt on queries .630 full precision, .631 int8 index
title: none | text: on passages .679 full precision

Passages were written as Page title — Section | text in training and evaluation. Use the same shape.

Accuracy on a CPU

query vectors passage vectors recall@10 MRR@10
full precision (PyTorch) full precision .698 .479
this engine, int8 this engine, int8, native on an Apple M1 Pro .697 .482
this engine, int8 this engine, int8, in a 2 CPU / 4 GB container on that Mac .697 .481
this engine, int8 int8, built with Python ONNX Runtime .699 .482

The container run had no swap and was not killed for memory.

The benchmark's questions were written by a language model from the passages, and the set is not published, so you cannot reproduce recall. You can check that the engine produces the right vectors on your CPU: argot-inference verify compares them with full-precision reference vectors for 20 made-up sentences. Cosine similarity was .9995 on average and .9992 at lowest on x86 and ARM Linux and on macOS.

Speed and memory

Shared GitHub runners with 2 vCPUs, in a 2 CPU / 4 GB container, 200 short queries per row, 2026-12-04. "Threads" is how many ONNX Runtime threads work on one text; "sessions" is how many texts are encoded at once.

CPU threads x sessions p50 / p90 requests/s 256-token passage peak memory
ARM Neoverse N2, two cores 2 x 1 49 / 56 ms 22 501 ms 823 MB
ARM Neoverse N2 1 x 2 74 / 91 ms 27 907 ms 1275 MB
x86 AMD EPYC 9V74, one core with two hyperthreads 2 x 1 58 / 67 ms 19 635 ms 824 MB
x86 AMD EPYC 9V74 1 x 2 54 / 64 ms 24 632 ms 1276 MB

"2 vCPU" is not the same machine everywhere. On the ARM runner the two vCPUs are two cores, and a second thread takes a request from 74 to 49 ms. On the x86 runner they are one core with two hyperthreads, and the second thread does nothing for a request. There, one thread and two sessions is as fast per request and serves about a quarter more. Check with lscpu ("Thread(s) per core") before choosing.

Indexing is the slow part. At half a second or more per long passage, two CPUs handle about two long passages a second. Build a large index on a bigger machine and keep the small one for queries and updates.

The repository includes a USearch example. One thing it taught us: USearch's default search width is too narrow for this model.

search over 35,110 int8-model vectors stored as F32 recall@10
exact scan .699
approximate, width 64 (USearch default) .687
approximate, width 128 .692
approximate, width 256 (used in the example) .696

Measured with USearch 2.26.6 through its Python package, with the same index settings as the example.

What did not help

Tried on an Apple M1 Pro before and while writing the engine.

idea outcome
Padded batches vectors changed slightly, and two threads gained nothing
All 10 cores slower than 6 on a busy machine
Turning off idle spinning one request got slower (20 to 28 ms), though it used less CPU
Fusing the spelled-out normalisation layers about 2 % faster, and the vectors shifted
Z-order (UB-tree) vector search looking at 20 % of the rows found only 64 % of the true neighbours

What did help: int8 weights are 1.5 to 1.6 times faster than full precision on CPU.

What is missing

  • No numbers yet from a dedicated small VM, or from an x86 CPU without VNNI.
  • No authentication and no per-caller rate limit. It listens on localhost; put a proxy that does both in front of it.
  • No release binaries yet.
  • The container's default (2 threads, 1 session) suits two real cores, not a hyperthreaded x86 vCPU.

Run it

The code is Apache-2.0 at github.com/argot-labs/argot-inference.

git clone https://github.com/argot-labs/argot-inference && cd argot-inference
scripts/fetch_model.sh          # public download, about 410 MB, checksums pinned
docker compose up --build

The model: full precision · ONNX int8, which the engine uses.