crit-labs/crit

Why wait for someone to optimize an LLM for your GPU when an AI agent can build a specialized inference engine in a few hours?

Python

7

4 commits

updated Oct 19, 2026

See the code

See what people are saying

SourceMessageScoreDate

We studied 30 inference engines like NInfer, Strata and FreeToken and distilled what makes them great into an agent-native toolkit for building bespoke inference engines (r/LocalLLM)

NInfer, Strata, FreeToken... these highly specialized inference engines seem to pop up every other month. Personally Ninfer was a game changer for my local PC. But there are two things that bother us: > 1) discovering them is almost entirely a matter of checking Reddit regularly and hoping you…

38

Oct 19, 2026

README

wordmark

Why wait for someone to optimize an LLM for your GPU when an AI agent can build a specialized inference engine in a few hours?

Version 0.2.2 License Apache-2.0 crit-hub engines CI

Summary • Quick start • What crit solves • Case studies • Methodology • crit-hub • Serving • Limitations • Documentation


Summary

crit is a toolkit for developers and coding agents to quickly build inference engines tailored to your model and hardware.

[!IMPORTANT] Combines a runtime foundation, reusable techniques, kernel discovery and physics-based evaluation. In our first case study, a coding agent built an engine for Qwen3.8-27B on one RTX 5090 in about 3.5 hours and five candidates, reaching 216 tok/s decode with the model's full 262,144-token context. You get runnable source, measured candidate comparisons and an OpenAI-compatible API. Follow the building guide yourself, or give your coding agent the agent instructions, target model and hardware.


Quick start

Give this prompt to your coding agent and specify your target LLM:

Use github.com/crit-labs/crit to build an optimized inference engine.

What crit solves

Less time building an engine. More performance from your hardware.

The boring stuff has already been built ⏱️

Requests, memory management and cleanup eat up development time before optimization even starts. crit supplies a clean foundation so you can get to the work that makes your engine fast.

Curated high-impact inference strategies 📊

Don't rebuild inference strategies from scratch. We studied established tailored engines and distilled their core speedup strategies into reusable code, so you can apply what works to your model and hardware.

Physics-based evaluation suite 🔬

A benchmark score alone doesn't tell you what's still left on the table. crit measures your hardware's limits and shows how close your engine gets, with quality and correctness checks along the way.


Case Studies

[!NOTE] Find the referenced engines in our crit-hub repository.

We gave Claude Opus 5.5 a target LLM along with the crit repository and let it cook autonomously.

What it showsEvidence
crit engines are fastQwen3.8-27B decodes at 216 tok/s and prefills at 8,917 tok/s
Dense and MoE modelsDense: Qwen3.8-27B and Gemma 4 31B. Mixture-of-experts larger than VRAM: Qwen3.8-Flash-Next (102 GB) and Nemotron 3.5 Super 120B (75 GB)
Different architecturesQwen (gated DeltaNet and attention), Gemma (sliding-window and full attention), Nemotron (Mamba-2 and latent MoE)
Hours, not weeksQwen3.8-27B in 3h 33m, Gemma 4 31B in 5h 24m, from the first command to the selected engine

📋 Dense LLM, Qwen architecture → Inspect engine

Goal: Get to a fast, working engine for a dense model as quickly as possible. Limit: A fixed candidate budget.

3h 33m

Development to selection

216 tok/s

Decode

8,917 tok/s

Prefill

262,144 tok

Context

+0.3%

Perplexity vs reference

0.0094

Mean KL divergence


mtp7-fp8attn runs Qwen3.8-27B in its original NVFP4 weights on one RTX 5090, with the model's full 262,144 tokens of context. One coding agent built it from scratch in a single crit run, writing its own kernels on Core without using another inference engine as a reference. It speeds up decoding with the model's own built-in draft layer, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine: reads the checkpoint as stored, 8-bit KV cache, drafts 4 tokens ahead174 tok/s5,177 tok/s181 ms
2Draft layer in 4-bit, draft width adapted per request, fused decode passes218 tok/s7,530 tok/s138 ms
38-bit prompt attention scores, fastest matrix-multiply variant recorded per shape217 tok/s8,113 tok/s127 ms
48-bit decode attention, faster prompt epilogues and convolution216 tok/s8,674 tok/s120 ms
5Prompt attention fully in 8-bit; decode attention from 4 reverted216 tok/s8,917 tok/s120 ms

Measured with crit Eval at the full 262,144-token context. Decode is the geometric mean over six prompts, from a chat question to a 14K-token agent session.

  • Long context: a prompt that fills all 262,144 tokens gets its first token after 69 s, then decodes at 217 tok/s. Candidate 4's 8-bit decode attention was slower in real rounds, so candidate 5 dropped it.
  • Quality: perplexity stays within 0.3% of the reference, and drafting never changes the output: it is token for token what plain decoding produces.

📋 Dense LLM, Gemma architecture → Inspect engine

Goal: Get to a fast, working engine for a dense model of a different architecture. Limit: A fixed candidate budget.

5h 24m

Development to selection

261 tok/s

Decode

8,326 tok/s

Prefill

262,144 tok

Context

+4.6%

Perplexity vs reference

0.025

Mean KL divergence


assistant6-fp8qk runs Gemma 4 31B-IT on one RTX 5090 with the model's full 262,144 tokens of context. Gemma mixes 50 sliding-window layers with 10 full-attention layers whose keys equal their values, and its hidden states overflow FP16, so little carries over from the Qwen engines. The NVFP4 MLPs are used as stored; the BF16 attention projections and output head are re-encoded to FP8 at load, because as stored they don't fit next to a 262K KV cache. It drafts 6 tokens ahead with Google's own assistant model, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine: FP8 attention and head, NVFP4 MLPs as stored, drafts 6 tokens ahead253 tok/s7,428 tok/s123 ms
2Long prompts scored, full attention reads one shared key/value cache252 tok/s7,779 tok/s120 ms
34-bit prompt activations scaled per row (candidate 2's shared scales missed the quality budget)261 tok/s7,609 tok/s119 ms
48-bit query-key products for full-attention prompts, two-stage argmax over the head267 tok/s8,471 tok/s114 ms
5Candidate 4's engine, with Gemma's tool-call syntax carried by the package261 tok/s8,326 tok/s116 ms

Measured with crit Eval at the full 262,144-token context. Candidates 4 and 5 run the same code; their difference is run-to-run variation.

  • Bandwidth: the verify pass reads the weights at their bandwidth floor (14.6 ms against 15.0 ms), so decode speed is set by how many drafts are accepted: 3.1 tokens per round on chat, up to 6.4 on the agent case. A prompt that fills all 262,144 tokens gets its first token after 148 s.
  • Quality: decoding stays within 0.2% perplexity of the reference. The 4-bit prompt path spends most of the drift budget (+4.6% perplexity, 91% of the budget), inside it on every path.

📋 MoE LLM, VRAM overload, Qwen architecture → Inspect engine

Goal: Quickly build a fast engine for an MoE model whose weights don't fit in VRAM. Limit: A fixed candidate budget.

13h 56m

Development to selection

84.5 tok/s

Decode

1,801 tok/s

Prefill

262,144 tok

Context

+0.03%

Perplexity vs reference

0.0012

Mean KL divergence


mtp3-expert-cache runs Qwen3.8-Flash-Next, a 102 GB mixture-of-experts checkpoint with 512 NVFP4 experts per layer, on one 32 GB RTX 5090 with the model's full 262,144 tokens of context. The weights are used as stored: attention, the shared expert and the KV cache stay on the GPU, the routed experts (about 61 GB) sit in pinned host memory, and a GPU cache of about 7,800 slots holds the hot ones. The coding agent wrote it from scratch on Core, again without another inference engine as a reference, and drafts 3 tokens ahead with the model's own MTP block, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine: stored formats, experts in host memory behind a GPU cache36 tok/s1,098 tok/s2.19 s
2Drafts 3 tokens ahead, decode in CUDA graphs, unused KV space lent to the expert cache82 tok/s1,916 tok/s1.63 s
3Weights decoded once per pass, CPU share of short prompts' experts81 tok/s1,744 tok/s1.43 s
4Second run, from candidate 2 with candidate 3's exact changes80 tok/s1,737 tok/s1.79 s
5Faster decode GEMVs and expert sums, 8-bit KV cache (superseded: incorrect after prompts of 512+ tokens: prefetched experts used before their scales were set)88 tok/s1,818 tok/s1.60 s
6Prefetched experts' scales initialized before cache use; 2 GiB VRAM margin84.5 tok/s1,801 tok/s1.61 s

Measured with crit Eval at the full 262,144-token context. The work took two crit runs back to back, from 14:37 to 04:34. The first run's request asked for 1 GiB of free VRAM instead of the machine's 0.3 GiB, so none of its candidates qualified, and the second continued from its candidate 2. Candidate 5 was selected first, but an audit found it reused prefetched experts before their scales were initialized, so generation after prompts of 512 or more tokens was wrong; Eval's prompts and scoring paths never decoded after such a prompt. Candidate 6 fixes it and replaces candidate 5 in crit-hub.

  • Bottleneck: decode is bound by expert misses over the host link (about 27 GB/s): each round reads 88 to 280 missed experts. A prompt that fills all 262,144 tokens gets its first token after about 100 s, then decodes at 63 tok/s.
  • Quality: perplexity stays within 0.03% of the reference. Drafted output equals plain decoding on 3 of 6 cases; the cause is not yet established, and this run reported exactness rather than requiring it.

📋 MoE LLM, VRAM overload, Nemotron architecture → Inspect engine

Goal: Build a fast engine for a 120B hybrid Mamba and mixture-of-experts model whose weights don't fit in VRAM. Limit: A fixed candidate budget.

10h 46m

Development to selection

42.5 tok/s

Decode

3,035 tok/s

Prefill

262,144 tok

Context

+0.7%

Perplexity vs reference

0.0051

Mean KL divergence


mtp3-cpu-experts runs Nemotron 3.5 Super VL 120B-A12B (text path) on one RTX 5090 with 262,144 tokens of context. Its layers are 40 Mamba-2 mixers, 40 latent mixture-of-experts layers with 512 NVFP4 experts each (22 per token) and 8 attention layers. The checkpoint is 75 GB, 63 GB of it routed experts, used as stored: they sit in pinned host memory behind a GPU cache of about 7,150 slots, and 6 CPU cores compute 60% of each pass's cache misses with the GPU's exact operation order, so the output does not depend on where a miss runs. It drafts 3 tokens ahead with the model's own MTP block, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine without drafting, experts in host memory (superseded: forgot content beyond 64K tokens)28.8 tok/s1,605 tok/s2.47 s
2Drafts 3 tokens ahead, CPU share of expert misses, the model's own Mamba time-step limit40.8 tok/s2,373 tok/s2.22 s
34-bit prompt experts on CUTLASS grouped GEMMs, 8-bit prompt GEMMs44.2 tok/s3,149 tok/s1.88 s
48-bit prompt attention, CPU share of short prompts' experts, one copy of the experts in RAM42.5 tok/s3,035 tok/s1.83 s

Measured with crit Eval. Candidates 1 and 2 were built for a 1,048,576-token context; the work then moved to a second crit run at 262,144 tokens, which re-measured candidate 3 and built candidate 4. Candidates 3 and 4 differ only in the prompt path, so their decode difference is run-to-run variation. The development time leaves out about 5h 25m with no work in progress: an idle stretch in the night, and a PC restart (an engine and the FP32 reference together had exhausted host memory) followed by a pause until the work was resumed.

  • Bottleneck: decode is bound by expert misses, over the host link and on the CPU, so other heavy programs on the PC slow it. Sampled requests decode one token per pass, about 22 tok/s.
  • Quality: perplexity stays within 0.7% of the reference on every path. Candidate 1 lost track of content beyond 64K tokens because transformers clamps Mamba's time step; the engine and Eval's reference now follow the model's config, and retrieval passes up to 262,144 tokens.

Methodology

We studied working tailored engines and where specialization makes them fast. The runtime every engine needs became Core. Techniques whose value depends on model and hardware became Inference entries, with their assumptions made explicit.


📗 Core → Full guide

Core provides what every engine needs: request scheduling, memory tracking, output delivery and safe cleanup. Your engine owns the model, tokenizer and layouts, and calls Core's libraries for sampling, state cache and model files. The native runtime supports generation and scoring, with optional CUDA and concurrent requests. Try the Core + Inference walkthrough.


📕 Inference → Full guide

Inference holds techniques with explanations, implementation code and worked examples. Start from a bottleneck:

  • Reuse prompt work. Prefix checkpoints resume from stored state when a prompt shares an earlier prefix.
  • Keep useful weights close. Expert residency retains reusable expert weights within a memory budget.
  • Generate several tokens per round. Speculative decoding proposes a continuation, verifies it and keeps the accepted tokens.
  • Reuse GPU execution. Core's optional CUDA graph harness captures repeated work for replay to cut launch overhead.

Each technique says when it helps, what is tested and what your engine supplies.


📘 Kernels → Full guide

Kernels helps you find and assess existing kernels for your data format and hardware, including the Hugging Face Kernel Hub. It checks declared compatibility, shows mismatches and gaps, and retains chosen artifacts with exact versions and license notices. Your engine then measures whether the kernel helps.


📙 Models → Full guide

Models produces transformed weights when a run allows them, starting with post-training quantization to FP8 or NVFP4 (round-to-nearest or GPTQ). It exports a checkpoint engines can read, runs it in your engine through Eval against the original model, and records the recipe, calibration data, seed, file hashes and cost.


📚 Eval → Full guide

Eval gives engines a common set of tests: fixed prompts, output lengths and a shared quality reference per model.

  • Speed on chat, code, math, tool calling, long-document summarization and a long agent session, with decode, prefill and time-to-first-token scores against their physical ceilings.
  • Quality: the engine's predictions against the reference on fixed conversations, across its execution paths.
  • Speculative checks: drafting against plain greedy decoding, exact when the run requires it.
  • Repeatability: one pinned decode text per model, and paired A/B runs for small changes.
  • Profiling: kernels ranked per phase by GPU time and launch width.

Results keep samples, settings and skipped cases visible.


Miscellaneous


🔭 crit-hub → Repository

crit-hub collects crit-based inference engines in one repository to make discovery super easy. Each engine ships runnable source, the exact checkpoint it was built on, what was measured, its known limits and a link to the repository of whoever contributed it.


🔌 Serving → Full guide

crit serve loads a sealed candidate, keeps it resident and answers OpenAI-compatible chat requests, including streaming, stop strings and structured output. Engines implement the adapter contract.


🚫 Limitations
AreaCurrent status
Multi-GPU setupsExpected to work with engine-specific partitioning and communication; not yet tested end to end.
macOSNot yet tested. Current CI covers Windows and Linux.
AMD and Apple GPUsNo bundled ROCm or Metal backend. The current GPU backend uses CUDA.

Documentation

To…Read
Build and compare enginesBuilding engines · Agent instructions · Run records
Integrate the native runtimeCore · Contracts · Core + Inference walkthrough
Choose or adapt a techniqueInference
Find and adapt kernelsKernels
Quantize weights and record the transformModels
Compare speed, quality and speculative outputEval
Serve an engine as an OpenAI-compatible APIServing · Adapter contract
Change crit or run its testsWhat belongs in crit · Contributing · Licensing
See release historyChangelog

crit-labs/crit

Why wait for someone to optimize an LLM for your GPU when an AI agent can build a specialized inference engine in a few hours?

Python

7

4 commits

updated Oct 19, 2026

See the code

See what people are saying

SourceMessageScoreDate

We studied 30 inference engines like NInfer, Strata and FreeToken and distilled what makes them great into an agent-native toolkit for building bespoke inference engines (r/LocalLLM)

NInfer, Strata, FreeToken... these highly specialized inference engines seem to pop up every other month. Personally Ninfer was a game changer for my local PC. But there are two things that bother us: > 1) discovering them is almost entirely a matter of checking Reddit regularly and hoping you…

38

Oct 19, 2026

README

wordmark

Why wait for someone to optimize an LLM for your GPU when an AI agent can build a specialized inference engine in a few hours?

Version 0.2.2 License Apache-2.0 crit-hub engines CI

Summary • Quick start • What crit solves • Case studies • Methodology • crit-hub • Serving • Limitations • Documentation


Summary

crit is a toolkit for developers and coding agents to quickly build inference engines tailored to your model and hardware.

[!IMPORTANT] Combines a runtime foundation, reusable techniques, kernel discovery and physics-based evaluation. In our first case study, a coding agent built an engine for Qwen3.8-27B on one RTX 5090 in about 3.5 hours and five candidates, reaching 216 tok/s decode with the model's full 262,144-token context. You get runnable source, measured candidate comparisons and an OpenAI-compatible API. Follow the building guide yourself, or give your coding agent the agent instructions, target model and hardware.


Quick start

Give this prompt to your coding agent and specify your target LLM:

Use github.com/crit-labs/crit to build an optimized inference engine.

What crit solves

Less time building an engine. More performance from your hardware.

The boring stuff has already been built ⏱️

Requests, memory management and cleanup eat up development time before optimization even starts. crit supplies a clean foundation so you can get to the work that makes your engine fast.

Curated high-impact inference strategies 📊

Don't rebuild inference strategies from scratch. We studied established tailored engines and distilled their core speedup strategies into reusable code, so you can apply what works to your model and hardware.

Physics-based evaluation suite 🔬

A benchmark score alone doesn't tell you what's still left on the table. crit measures your hardware's limits and shows how close your engine gets, with quality and correctness checks along the way.


Case Studies

[!NOTE] Find the referenced engines in our crit-hub repository.

We gave Claude Opus 5.5 a target LLM along with the crit repository and let it cook autonomously.

What it showsEvidence
crit engines are fastQwen3.8-27B decodes at 216 tok/s and prefills at 8,917 tok/s
Dense and MoE modelsDense: Qwen3.8-27B and Gemma 4 31B. Mixture-of-experts larger than VRAM: Qwen3.8-Flash-Next (102 GB) and Nemotron 3.5 Super 120B (75 GB)
Different architecturesQwen (gated DeltaNet and attention), Gemma (sliding-window and full attention), Nemotron (Mamba-2 and latent MoE)
Hours, not weeksQwen3.8-27B in 3h 33m, Gemma 4 31B in 5h 24m, from the first command to the selected engine

📋 Dense LLM, Qwen architecture → Inspect engine

Goal: Get to a fast, working engine for a dense model as quickly as possible. Limit: A fixed candidate budget.

3h 33m

Development to selection

216 tok/s

Decode

8,917 tok/s

Prefill

262,144 tok

Context

+0.3%

Perplexity vs reference

0.0094

Mean KL divergence


mtp7-fp8attn runs Qwen3.8-27B in its original NVFP4 weights on one RTX 5090, with the model's full 262,144 tokens of context. One coding agent built it from scratch in a single crit run, writing its own kernels on Core without using another inference engine as a reference. It speeds up decoding with the model's own built-in draft layer, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine: reads the checkpoint as stored, 8-bit KV cache, drafts 4 tokens ahead174 tok/s5,177 tok/s181 ms
2Draft layer in 4-bit, draft width adapted per request, fused decode passes218 tok/s7,530 tok/s138 ms
38-bit prompt attention scores, fastest matrix-multiply variant recorded per shape217 tok/s8,113 tok/s127 ms
48-bit decode attention, faster prompt epilogues and convolution216 tok/s8,674 tok/s120 ms
5Prompt attention fully in 8-bit; decode attention from 4 reverted216 tok/s8,917 tok/s120 ms

Measured with crit Eval at the full 262,144-token context. Decode is the geometric mean over six prompts, from a chat question to a 14K-token agent session.

  • Long context: a prompt that fills all 262,144 tokens gets its first token after 69 s, then decodes at 217 tok/s. Candidate 4's 8-bit decode attention was slower in real rounds, so candidate 5 dropped it.
  • Quality: perplexity stays within 0.3% of the reference, and drafting never changes the output: it is token for token what plain decoding produces.

📋 Dense LLM, Gemma architecture → Inspect engine

Goal: Get to a fast, working engine for a dense model of a different architecture. Limit: A fixed candidate budget.

5h 24m

Development to selection

261 tok/s

Decode

8,326 tok/s

Prefill

262,144 tok

Context

+4.6%

Perplexity vs reference

0.025

Mean KL divergence


assistant6-fp8qk runs Gemma 4 31B-IT on one RTX 5090 with the model's full 262,144 tokens of context. Gemma mixes 50 sliding-window layers with 10 full-attention layers whose keys equal their values, and its hidden states overflow FP16, so little carries over from the Qwen engines. The NVFP4 MLPs are used as stored; the BF16 attention projections and output head are re-encoded to FP8 at load, because as stored they don't fit next to a 262K KV cache. It drafts 6 tokens ahead with Google's own assistant model, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine: FP8 attention and head, NVFP4 MLPs as stored, drafts 6 tokens ahead253 tok/s7,428 tok/s123 ms
2Long prompts scored, full attention reads one shared key/value cache252 tok/s7,779 tok/s120 ms
34-bit prompt activations scaled per row (candidate 2's shared scales missed the quality budget)261 tok/s7,609 tok/s119 ms
48-bit query-key products for full-attention prompts, two-stage argmax over the head267 tok/s8,471 tok/s114 ms
5Candidate 4's engine, with Gemma's tool-call syntax carried by the package261 tok/s8,326 tok/s116 ms

Measured with crit Eval at the full 262,144-token context. Candidates 4 and 5 run the same code; their difference is run-to-run variation.

  • Bandwidth: the verify pass reads the weights at their bandwidth floor (14.6 ms against 15.0 ms), so decode speed is set by how many drafts are accepted: 3.1 tokens per round on chat, up to 6.4 on the agent case. A prompt that fills all 262,144 tokens gets its first token after 148 s.
  • Quality: decoding stays within 0.2% perplexity of the reference. The 4-bit prompt path spends most of the drift budget (+4.6% perplexity, 91% of the budget), inside it on every path.

📋 MoE LLM, VRAM overload, Qwen architecture → Inspect engine

Goal: Quickly build a fast engine for an MoE model whose weights don't fit in VRAM. Limit: A fixed candidate budget.

13h 56m

Development to selection

84.5 tok/s

Decode

1,801 tok/s

Prefill

262,144 tok

Context

+0.03%

Perplexity vs reference

0.0012

Mean KL divergence


mtp3-expert-cache runs Qwen3.8-Flash-Next, a 102 GB mixture-of-experts checkpoint with 512 NVFP4 experts per layer, on one 32 GB RTX 5090 with the model's full 262,144 tokens of context. The weights are used as stored: attention, the shared expert and the KV cache stay on the GPU, the routed experts (about 61 GB) sit in pinned host memory, and a GPU cache of about 7,800 slots holds the hot ones. The coding agent wrote it from scratch on Core, again without another inference engine as a reference, and drafts 3 tokens ahead with the model's own MTP block, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine: stored formats, experts in host memory behind a GPU cache36 tok/s1,098 tok/s2.19 s
2Drafts 3 tokens ahead, decode in CUDA graphs, unused KV space lent to the expert cache82 tok/s1,916 tok/s1.63 s
3Weights decoded once per pass, CPU share of short prompts' experts81 tok/s1,744 tok/s1.43 s
4Second run, from candidate 2 with candidate 3's exact changes80 tok/s1,737 tok/s1.79 s
5Faster decode GEMVs and expert sums, 8-bit KV cache (superseded: incorrect after prompts of 512+ tokens: prefetched experts used before their scales were set)88 tok/s1,818 tok/s1.60 s
6Prefetched experts' scales initialized before cache use; 2 GiB VRAM margin84.5 tok/s1,801 tok/s1.61 s

Measured with crit Eval at the full 262,144-token context. The work took two crit runs back to back, from 14:37 to 04:34. The first run's request asked for 1 GiB of free VRAM instead of the machine's 0.3 GiB, so none of its candidates qualified, and the second continued from its candidate 2. Candidate 5 was selected first, but an audit found it reused prefetched experts before their scales were initialized, so generation after prompts of 512 or more tokens was wrong; Eval's prompts and scoring paths never decoded after such a prompt. Candidate 6 fixes it and replaces candidate 5 in crit-hub.

  • Bottleneck: decode is bound by expert misses over the host link (about 27 GB/s): each round reads 88 to 280 missed experts. A prompt that fills all 262,144 tokens gets its first token after about 100 s, then decodes at 63 tok/s.
  • Quality: perplexity stays within 0.03% of the reference. Drafted output equals plain decoding on 3 of 6 cases; the cause is not yet established, and this run reported exactness rather than requiring it.

📋 MoE LLM, VRAM overload, Nemotron architecture → Inspect engine

Goal: Build a fast engine for a 120B hybrid Mamba and mixture-of-experts model whose weights don't fit in VRAM. Limit: A fixed candidate budget.

10h 46m

Development to selection

42.5 tok/s

Decode

3,035 tok/s

Prefill

262,144 tok

Context

+0.7%

Perplexity vs reference

0.0051

Mean KL divergence


mtp3-cpu-experts runs Nemotron 3.5 Super VL 120B-A12B (text path) on one RTX 5090 with 262,144 tokens of context. Its layers are 40 Mamba-2 mixers, 40 latent mixture-of-experts layers with 512 NVFP4 experts each (22 per token) and 8 attention layers. The checkpoint is 75 GB, 63 GB of it routed experts, used as stored: they sit in pinned host memory behind a GPU cache of about 7,150 slots, and 6 CPU cores compute 60% of each pass's cache misses with the GPU's exact operation order, so the output does not depend on where a miss runs. It drafts 3 tokens ahead with the model's own MTP block, used as released.

CandidateWhat changedDecodePrefillFirst token
1Working engine without drafting, experts in host memory (superseded: forgot content beyond 64K tokens)28.8 tok/s1,605 tok/s2.47 s
2Drafts 3 tokens ahead, CPU share of expert misses, the model's own Mamba time-step limit40.8 tok/s2,373 tok/s2.22 s
34-bit prompt experts on CUTLASS grouped GEMMs, 8-bit prompt GEMMs44.2 tok/s3,149 tok/s1.88 s
48-bit prompt attention, CPU share of short prompts' experts, one copy of the experts in RAM42.5 tok/s3,035 tok/s1.83 s

Measured with crit Eval. Candidates 1 and 2 were built for a 1,048,576-token context; the work then moved to a second crit run at 262,144 tokens, which re-measured candidate 3 and built candidate 4. Candidates 3 and 4 differ only in the prompt path, so their decode difference is run-to-run variation. The development time leaves out about 5h 25m with no work in progress: an idle stretch in the night, and a PC restart (an engine and the FP32 reference together had exhausted host memory) followed by a pause until the work was resumed.

  • Bottleneck: decode is bound by expert misses, over the host link and on the CPU, so other heavy programs on the PC slow it. Sampled requests decode one token per pass, about 22 tok/s.
  • Quality: perplexity stays within 0.7% of the reference on every path. Candidate 1 lost track of content beyond 64K tokens because transformers clamps Mamba's time step; the engine and Eval's reference now follow the model's config, and retrieval passes up to 262,144 tokens.

Methodology

We studied working tailored engines and where specialization makes them fast. The runtime every engine needs became Core. Techniques whose value depends on model and hardware became Inference entries, with their assumptions made explicit.


📗 Core → Full guide

Core provides what every engine needs: request scheduling, memory tracking, output delivery and safe cleanup. Your engine owns the model, tokenizer and layouts, and calls Core's libraries for sampling, state cache and model files. The native runtime supports generation and scoring, with optional CUDA and concurrent requests. Try the Core + Inference walkthrough.


📕 Inference → Full guide

Inference holds techniques with explanations, implementation code and worked examples. Start from a bottleneck:

  • Reuse prompt work. Prefix checkpoints resume from stored state when a prompt shares an earlier prefix.
  • Keep useful weights close. Expert residency retains reusable expert weights within a memory budget.
  • Generate several tokens per round. Speculative decoding proposes a continuation, verifies it and keeps the accepted tokens.
  • Reuse GPU execution. Core's optional CUDA graph harness captures repeated work for replay to cut launch overhead.

Each technique says when it helps, what is tested and what your engine supplies.


📘 Kernels → Full guide

Kernels helps you find and assess existing kernels for your data format and hardware, including the Hugging Face Kernel Hub. It checks declared compatibility, shows mismatches and gaps, and retains chosen artifacts with exact versions and license notices. Your engine then measures whether the kernel helps.


📙 Models → Full guide

Models produces transformed weights when a run allows them, starting with post-training quantization to FP8 or NVFP4 (round-to-nearest or GPTQ). It exports a checkpoint engines can read, runs it in your engine through Eval against the original model, and records the recipe, calibration data, seed, file hashes and cost.


📚 Eval → Full guide

Eval gives engines a common set of tests: fixed prompts, output lengths and a shared quality reference per model.

  • Speed on chat, code, math, tool calling, long-document summarization and a long agent session, with decode, prefill and time-to-first-token scores against their physical ceilings.
  • Quality: the engine's predictions against the reference on fixed conversations, across its execution paths.
  • Speculative checks: drafting against plain greedy decoding, exact when the run requires it.
  • Repeatability: one pinned decode text per model, and paired A/B runs for small changes.
  • Profiling: kernels ranked per phase by GPU time and launch width.

Results keep samples, settings and skipped cases visible.


Miscellaneous


🔭 crit-hub → Repository

crit-hub collects crit-based inference engines in one repository to make discovery super easy. Each engine ships runnable source, the exact checkpoint it was built on, what was measured, its known limits and a link to the repository of whoever contributed it.


🔌 Serving → Full guide

crit serve loads a sealed candidate, keeps it resident and answers OpenAI-compatible chat requests, including streaming, stop strings and structured output. Engines implement the adapter contract.


🚫 Limitations
AreaCurrent status
Multi-GPU setupsExpected to work with engine-specific partitioning and communication; not yet tested end to end.
macOSNot yet tested. Current CI covers Windows and Linux.
AMD and Apple GPUsNo bundled ROCm or Metal backend. The current GPU backend uses CUDA.

Documentation

To…Read
Build and compare enginesBuilding engines · Agent instructions · Run records
Integrate the native runtimeCore · Contracts · Core + Inference walkthrough
Choose or adapt a techniqueInference
Find and adapt kernelsKernels
Quantize weights and record the transformModels
Compare speed, quality and speculative outputEval
Serve an engine as an OpenAI-compatible APIServing · Adapter contract
Change crit or run its testsWhat belongs in crit · Contributing · Licensing
See release historyChangelog