1.58-Bit Ternary Inference in Rust: Why the Scheduler Beat bitnet.cpp
Our Rust engine led Microsoft's bitnet.cpp on the same GGUF. The gain came from export-time precomputation, and from keeping the default scheduler instead of splitting phone cores.

Can 1.58-bit ternary inference in Rust beat bitnet.cpp on CPU?
In this race, yes. Our Rust engine, Minerva, ran 1.58-bit ternary inference against Microsoft's bitnet.cpp on the same exported GGUF of BitNet b1.58 2B4T. On a 15-inch Alienware Windows laptop it led every cell we measured, including 1.46x to 1.86x decode and 1.90x to 1.92x prefill. On a Pixel 9 Pro at 4 threads, first token was 1.15x and decode was 1.17x.
Ship it
AI Media On The DeviceASR, OCR, detection, and BitNet b1.58 inference in one Remade suite instead of a Python or C++ stack.
1.58-bit ternary inference is usually told as a C++ story. Microsoft's bitnet.cpp is the official engine for BitNet b1.58 2B4T, and it is a serious baseline: same model family, tuned kernels, a public tree. We wanted to know whether a Rust engine could do the same job, on the same exported GGUF, at the same thread counts, and win on CPU anyway.
Minerva is that engine, and it is not open-sourced yet. We raced it against bitnet.cpp commit 765741d, a clang build, on a 15-inch Alienware Windows laptop and a Pixel 9 Pro. All runs were greedy, so both engines produced identical tokens. We report medians, plus how many paired rounds Minerva won.
The surrounding tooling is part of the same Rust bet. FFAI is public and publishing soon; the FFAI field note is the map of that toolkit, and candle is the tensor runtime under several of those crates. This article is about the inference race, not a tour of those trees.
These runs used a GGUF verified against the golden copy.
A Rust engine, the same GGUF, and a C++ baseline
On the laptop, Minerva led every cell we measured, at 8, 12, and 16 threads. At those widths the first-token ratios were 1.57x, then 1.41x, then 1.49x for a 64-token prompt. Decode was 1.46x, 1.64x, and 1.86x. Prefill of a 512-token prompt was 1.92x, 1.92x, and 1.90x. That is what 1.58-bit ternary inference looked like on this laptop: 8 of 8 rounds in every cell except first token at 8 threads, which it took 6 of 8.
On the phone, both sides used 4 threads. First token was 1.15x, with Minerva winning all 6 rounds. Decode was 1.17x, with Minerva winning 4 of 6. We did not race long prompts on the phone.
Decode on the laptop is the result I would hang a systems argument on. The lead grew with thread count, from 1.46x at 8 threads to 1.86x at 16. That is not a single lucky cell. Prefill stayed near 1.9x at every laptop width we tried. First token was the competitive cell, and it is the one that needed a design change, which I will get to next.
We are not attaching tokens-per-second figures we did not record in this note, and we are not inventing a laptop CPU model number. The ratios and the win counts are the claims.
Moving one-time work out of the first token
Before this round, there was still a cell the C++ engine won: first token after a short prompt. The Rust side was paying a startup tax that the C++ side was not paying at that moment.
The 128k-entry output head, paid once at export
The deficit was setup for the 128k-entry output head, done once, and Minerva used to run it at model load. Load-time setup is convenient for the author of the engine and expensive for the first token the user actually waits on. We now do that work once, when the model is exported, and store the result in a 330 MB file shipped next to the 1.19 GB model.
With the file, first token on a short prompt is 1.34x faster on the phone and 1.5x to 1.7x faster on the laptop. Decode is unchanged. That is the signature of a one-time cost, not of a faster inner loop.
Checking the sidecar when the model opens
Minerva checks the file against the model when it opens it. The sidecar is useless if it quietly drifts out of date, so the open path has to refuse a mismatch rather than hope. We are not describing the check's internals here; the public claim is that the engine verifies the file against the model, then uses it.
Export-time precomputation is an old systems habit, and it is how 1.58-bit ternary inference stopped paying a load-time tax on the opening token. You do the work when you have time, you write down the answer, and you authenticate it later. The only unusual part is the size: 330 MB next to a 1.19 GB model is a real storage bill, not a tiny cache.
What you pay for the first-token win
That file is the cost of the first-token win. Without it, bitnet.cpp still leads on short-prompt first token on the phone and at 12-16 threads on the laptop. If you ship the engine without the sidecar, do not quote the first-token leads from this round. Decode, and the laptop prefill numbers, do not ride on that file.
The scheduler, and a split that made decode worse
Phones invite a clever assignment: give the big cores more of the decode, and keep the little cores busy with leftover work. We tried it. It lost.
Even work on four phone threads
The phone numbers above used a plain 4-thread default. First token at 1.15x and decode at 1.17x are those default runs, not a hand-tuned affinity map. Heat still moved decode around: runs started only with the screen awake, CPU frequency limits at maximum, and the phone at or under 33 C, and decode still swung by about plus or minus 19 percent between rounds. That is why the decode lead won 4 of 6 rounds, not 6 of 6.
Why smaller tasks did not help the slow cores
At two context lengths, 64 tokens and 1,856 tokens, we assigned decode work unevenly to the phone's fast cores and its slow cores. None of those assignments beat the ordinary four-thread path. The slowdowns ranged from 4 percent to 43 percent. Because the scheduler already imbalances work on its own, carving the job into smaller pieces still failed to make the slow cores useful. The extra policy added cost and did not add useful overlap, so we kept the default.
A failed split is useful data. It says the bottleneck was not "the slow cores were idle and needed a special queue." On this engine, the default work distribution was already the faster policy.
How the race was run
Both sides did the same work: equal threads, the same model file, identical greedy output tokens. The engines alternated within each paired round. Minerva raced against itself in every run as a null arm, so we had a noise floor for the same binary. Laptop runs waited until background load was below 40 percent; measured load was 15-42 percent, and single cells moved by about 10 percent between rounds. Those are the conditions behind the medians.
Microsoft documents its own engine in the bitnet.cpp technical report. We raced that engine, at the commit above. For the rest of the Remade inference and media stack, see Mercury and Argus. If you want the local document path that can sit in front of a CPU model, RAG Converter is the in-browser product, with a field note, and MATA is where that stack is meant to run on hardware you hold. The MATA in the wild note is the deployment half.
FAQ
Quick answers for builders evaluating this technology.
Why did moving output-head setup to export time change first token but not decode?
The work was one-time setup on the model's 128k-entry output head, previously done when Minerva loaded the model. Doing it at export and storing the result in a 330 MB sidecar removes that cost from the first token after a short prompt. Decode does not use that setup path, so its times stay the same.
Did pinning extra decode work onto the phone's slow cores help?
No. We tried splitting decode work unevenly between the phone's fast and slow cores, at 64 tokens of context and at 1,856 tokens of context. Every split was slower than the plain 4-thread default, by 4-43 percent. We kept the default.
If the scheduler already spreads work unevenly, why not make smaller tasks for the slow cores?
We tried that, and it did not help. The work scheduler already spreads tasks unevenly when it needs to. Cutting the work into smaller tasks still left every uneven split slower than the plain 4-thread path. The slow cores did not turn that extra bookkeeping into a faster decode.
Which bitnet.cpp build did you race, and how did you keep the comparison honest?
Commit 765741d, a clang build. Both engines used the same exported GGUF, the same thread counts, and greedy decoding, so the output tokens matched. Engines alternated inside each paired round. Minerva also raced itself in every run as a null arm to measure the noise floor. We report medians and round wins, not a single pass.
Is the Rust engine for this race in a public repository?
Minerva is not open-sourced yet, so this article does not link a Minerva repository. FFAI, the broader Rust AI media toolkit, is public at github.com/Remade-With-Rust/FFAI and is publishing soon.