A GGUF-native Rust and CUDA inference engine built for cold starts: the time from
launching a process to its first result, not sustained server throughput. Every CUDA
kernel is compiled ahead of time by nvcc and shipped inside the binary, so nothing is
JIT-compiled when the process starts.
~448 ms cold start, p50: reflex system1 from process start to its scored result
(the engine's own timer), AWS EC2 g5.xlarge (NVIDIA A10G, 24 GB),
Qwen3-0.6B-Q4_K_M, n=10, two interleaved rounds, quantized-resident weights (the
default since 2026-10-20). The two rounds are 445 and 451 ms; from outside the process
that is ~0.58 s wall clock. Phase breakdown.
reflex generate reaches its first token in 458–461 ms, against 620 ms with
REFLEX_QUANT_RESIDENT=0 (f16). The older ~483 ms figure was a T4/f32 measurement;
see f16 weight storage and
QR as the default.
Architectural boundary. Reflex is a local execution engine for single-tenant decisions: one request at a time, no scheduler, no batching, no network server inside the engine. HTTP is a separate sidecar (
sidecar/openai-adapter) over local IPC. See Non-goals before proposing otherwise.
Serverless GPU platforms bill per second of wall clock per invocation, so for bursty, single-shot work (a tool call, a classification, an extraction) the time a worker takes to become useful is the bill. Engines built for steady-state throughput pay for that with long startups: vLLM captures CUDA graphs and compiles at launch. llama.cpp, like Reflex, ships precompiled kernels and is the honest comparison point.
On a real Runpod serverless endpoint, Reflex's own load took ~1.6 s of a ~42-44 s cold invocation; the rest is the platform provisioning the GPU and container, which no engine avoids. Runpod's official vLLM worker took ~150 s on the same GPU tier the same day. Against an official llama.cpp server image on the same platform, Reflex's engine load was ~0.5 s vs. ~0.95 s on an L4, but end-to-end the platform's own variance was far larger than that gap (details). The full argument and measurements are in docs/benchmarks.md.
Requires the CUDA toolkit (nvcc on PATH, or CUDA_PATH/CUDA_HOME set) and an
NVIDIA GPU. REFLEX_SKIP_CUDA=1 cargo build type-checks without CUDA (nothing will run).
git clone https://github.com/lateos-ai/reflex.git
cd reflex
cargo build --release
# Prove the AOT kernel pipeline works on your GPU:
cargo run --release --bin reflex -- smoke
# Score candidate answers in one forward pass:
cargo run --release --bin reflex -- system1 model.gguf "The capital of France is" \
--candidate " Paris" --candidate " London"
# Generate text:
cargo run --release --bin reflex -- generate model.gguf "Once upon a time" --max-tokens 32
# Embed text with an embedding model (Nemotron-3.5-Embed):
cargo run --release --bin reflex -- embed nemotron-embed.gguf "query: What is NeMo?"
To compare your GPU with the published numbers in one command, run
scripts/prove_it.sh. It builds Reflex, runs reflex doctor and
reflex smoke, times five cold reflex system1 processes on Qwen3-0.6B-Q4_K_M (it
prints the download command if the file is missing), and prints p50 per phase next to
the reference row for the closest GPU in bench/baseline-*.json, with what differs
between the two setups (GPU, kernel image, weight mode). It exits non-zero only when
something fails, never for being slower.
reflex <subcommand> with no arguments prints that subcommand's usage. All subcommands,
build options and output formats: docs/reference.md.
No GPU of your own? Reflex is listed on the
Runpod Hub: deploy a
scale-to-zero endpoint in one click, no build required (worker docs),
for routing and guardrails (/v1/classify scores every label in one prefill) and
extraction (response_format JSON Schema output), plus chat, embeddings and optional
retrieval over your own documents (RAG). Presets set
up each use case (presets).
Architecture (GGUF general.architecture) |
Tested with |
|---|---|
Dense Qwen3 (qwen3) |
Qwen3-0.6B |
Dense Qwen2 / Qwen2.5, incl. Math and Coder (qwen2) |
Qwen2.5-0.5B-Instruct; a synthetic fixture. YaRN long-context scaling and qwen2moe are not supported |
Qwen3-MoE (qwen3moe) |
synthetic fixtures (real qwen3moe tensor layout, top-k routing) |
Llama / Mistral (llama) |
TinyLlama-1.1B |
Qwen3.5 hybrid Gated DeltaNet (qwen35, qwen35moe) |
Qwen3.5-0.8B; Qwen3.8-27B Q8_0 (f16 weights, 80 GB GPU)†; a random-weight qwen35moe checkpoint. MTP/NextN heads are not supported, so use a --no-mtp conversion or a non-MTP Q4_K_M file (the official Q8_0/BF16/Q4_0 are rejected) |
DeepSeek-V2/V3 MLA (deepseek2) |
DeepSeek-V2-Lite, DeepSeek-Coder-V2-Lite-Instruct, GigaChat3.1-10B-A1.8B, GLM-4.7-Flash (f16 weights, 80 GB GPU)†; two synthetic fixtures. Group-limited routing (the 671B V3/R1), MTP heads, Moonlight (kimi-k2 tokenizer) and Kanana-2 (kanana2) are not supported |
Granite 4.0-H Mamba-2 hybrid (granitehybrid) |
Granite 4.0-H 350M and 1B Q8_0; a synthetic fixture. MoE variants (Tiny, Small), Falcon-H1, Nemotron-H, Jamba and pure Mamba-2 are not supported |
Kolibri-1 MoE (kolibri1) |
Aleph Alpha's Kolibri-1 78B, Q4_K_M†; a synthetic fixture |
Gemma 4 dense, text only (gemma4) |
Gemma 4 12B-it and 31B-it Q8_0 (31B runs on a 48 GB card with QR; the f16 opt-out needs ~80 GB)†; a synthetic fixture. E2B/E4B and 26B-A4B are not supported |
Text embeddings: Nemotron-3.5-Embed (mistral3, bidirectional) |
Nemotron-3.5-Embed-1B BF16/Q8_0/Q4_K_M (vs HF transformers); a synthetic fixture. Images (the mmproj file), pooling other than mean and Ministral 3 chat models are not supported. See docs/reference.md |
Decision models: lev, OpenJev (qwen35 with decision.type lev/openjev) |
ggml-org's lev Q8_0 (f16 weights) and llama.cpp's tiny OpenJev test model, vs llama.cpp's /v1/systemone. Text only; kev and laya models are not supported. Served by the sidecar's POST /v1/systemone; see docs/reference.md |
† Supported for completeness on 48–80 GB cards (Gemma 4 12B also fits 24 GB with QR). Reflex is built for small models that cold-start in under a second; every cold-start number in this README is Qwen3-0.6B unless it says otherwise.
Each architecture counted as supported only after its generated tokens matched an
independent implementation (llama.cpp, or a CPU reference) on real hardware;
embeddings were compared with HF transformers by cosine similarity.
- GGUF only. Convert other checkpoints with llama.cpp's
convert_hf_to_gguf.py. - Weights are held quantized on the GPU by default (Q4_K/Q6_K on the dense path, Q8_0 on Gemma 4): on an A10G that is 270 MiB resident for Qwen3-0.6B vs 878 MiB with
f16, 4.1 GB for Mistral 7B vs 13.8 GB, and 11.1 GB for Gemma 4 12B vs 20.9 GB.--weights f32(orREFLEX_WEIGHTS=f32) keeps the exactf32reference mode for everything that is dequantized; norms, MoE routers, activations and the KV cache aref32in both modes.reflex checkdefaults tof32. - Context: up to 65,535 positions per sequence (prompt + generated tokens + any
imported KV cache); longer requests fail with a clear
context_overflowerror. system1works on every architecture, with single- and multi-token candidates.- QR off:
REFLEX_QUANT_RESIDENT=0loads matrix weights asf16(about 2 bytes per parameter). This makes short warm prompts andsystem1faster on the smallest model (Qwen3-0.6B), at the cost of 2–3.4x the resident VRAM and slower decode (measured ~8–10% on Qwen3-0.6B, ~30–40% on Qwen3-1.7B/TinyLlama, ~2x on Mistral 7B). On a 24 GB card it does not fit Gemma 4 12B forgenerate. - DeepSeek's MTP heads and group-limited expert routing are not supported.
Cold starts measured from outside the process (process launch to exit),
Qwen3-0.6B-Q4_K_M. Each row gives its own date, GPU and Reflex weight mode; rows from
different dates or GPUs don't compare with each other. The llama.cpp, Ollama and vLLM
rows time reflex generate to its first token, the metric every engine shares; the
headline above times system1 scoring.
| vs. | Result | Measured | Caveat |
|---|---|---|---|
llama.cpp llama-simple |
Reflex 2.05x faster (0.47 s vs. 0.965 s p50, n=30 each) | 2026-10-30, T4, QR | Both precompile their kernels; this is model-load work |
llama.cpp llama-cli |
Reflex 3.3x faster (0.47 s vs. 1.57 s p50, n=30 each) | 2026-10-30, T4, QR | llama-cli always applies the chat template |
| Ollama | Reflex 2.6x faster (0.83 s vs. ~2.1 s) | 2026-09-29, T4, f32 |
Cold daemon plus cold model; not re-measured on QR |
| vLLM | Reflex 48–150x faster (0.83 s vs. 39.8–127.3 s) | 2026-09-29, T4, f32 |
CUDA-graph capture and torch.compile at startup; ran from safetensors; not re-measured on QR |
| vLLM on Runpod serverless | Reflex ~3.4x faster (42–44 s vs. ~150 s) | 2026-09-26, RTX A4500, f32 |
Mostly platform provisioning; vLLM also downloaded bf16 weights |
| llama.cpp server on Runpod serverless | Engine load ~1.9x faster (0.49 s vs. 0.95 s, n=5 each); end-to-end inconclusive | 2026-10-01/02, L4, f32 |
Platform overhead (24–73 s even for Reflex) swamps the difference; details |
| TypeSafe Jev (managed API) | Reflex 1.1–2.0x slower (0.63 s vs. 0.31–0.57 s) | 2026-10-01, T4, f32, system1 |
Jev is always warm; Reflex starts a process each time |
In the 2026-10-30 session Reflex's own first-token timer read 379 ms p50; the rest of
the 0.47 s is process launch and exit. On the same T4 setup Reflex's figure was 0.83 s
with f32 weights on 2026-09-29, while llama-simple moved only from 0.94 s to 0.965 s.
Methodology, per-run numbers and every caveat: docs/benchmarks.md.
Energy. Measured from outside the process with the GPU's idle draw subtracted, a cold
reflex system1 on a T4 costs ~5.4 J. Most of the ~28 J the GPU draws over that
window is idle power. Details.
For a scale-to-zero endpoint, start with the serverless deployment
guide — one page, Runpod first. The job Reflex is built
for is a single cold decision (POST /v1/classify), not a warm chat pool; see the
sidecar's classify section. The
table below is the long form.
| Target | Where |
|---|---|
| Serverless / scale-to-zero (start here) | docs/deploy-serverless.md |
Docker (one multi-target Dockerfile: reflex, adapter, runpod-lb) |
docs/reference.md |
OpenAI-compatible HTTP (/v1/chat/completions, /v1/classify, /v1/embeddings), and llama.cpp's /v1/systemone |
sidecar/openai-adapter |
| AWS, scale to zero (Spot, local socket) | docs/aws-deployment.md |
| AWS, always warm (load balancer, HTTPS) | docs/aws-deployment-warm.md |
| Runpod serverless, load-balancing endpoint | serverless/runpod |
| Runpod Hub, queue-based worker (one-click deploy) | Hub listing · .runpod |
| Modal (Modal Server, L4) | .modal |
| Kubernetes (one Job per invocation) | docs/reference.md |
| Embedding in another program | C FFI (include/reflex_engine.h), local IPC (reflex stdio/uds) |
From Python (or any language), drive reflex stdio or reflex uds: one JSON request
per line, no client library (example).
Multi-agent loops make many short, sequential calls, so what matters is the cost of each hop from one agent to the next. Reflex gives an orchestrator the pieces for a cheap hop and leaves the wiring to it:
- A warm process per agent (
reflex stdio/uds) that keeps one pinned prefix, such as the agent's role prompt, in VRAM. A System-1 routing decision against the pin takes 12.5 ms, against 543 ms for a freshreflex system1process (T4). - KV cache files (
export_kv/import_kv,--export-kv/--import-kv): one agent writes its context to a file and the next one, warm or cold, resumes from it instead of prefilling again (format and guarantees). - JSON Schema constrained output (
json_schema,--json-schema) for structured handoffs.
Routing, the message envelope and where the files live belong to the orchestrator; the engine answers one request at a time and never knows other agents exist. Examples (an orchestrator in Python and a cold shell chain) and the envelope schema are in examples/. Design and measurements: docs/design/agent-relay.md.
The Runpod Hub worker can answer chat jobs from your own documents. It is off by
default; with RAG=on the worker also runs an embedding model (Nemotron-3.5-Embed-1B,
about 1 GB more VRAM) next to the chat model, and a chat job carrying a rag field:
- searches the job's own
rag.documentsand an optional corpus: a folder on the network volume (RAG_DIR,.txt/.md/.jsonl) or a file or archive atRAG_CORPUS_URL; - adds the best passages, numbered, to the system message and asks the model to cite them;
- returns those passages, with their scores, alongside the answer.
The corpus is embedded once when a worker starts and the index is cached on the network volume until a file or setting changes (506 passages in 8.2 s on an RTX 4090; a restart loads the cache in 1.3 s). Retrieval is Python in the worker; the engine and the adapter are unchanged. Fields, limits and costs: .runpod/README.md.
For deployments that need to show what served a request, Reflex can produce records that are all off by default (with every option off, nothing is hashed or logged and responses are unchanged):
- Supply chain: CycloneDX SBOMs of the engine and the OpenAI adapter, plus the
license text of every dependency, built from the lockfiles in CI or with
scripts/compliance-bundle.sh. The Runpod Hub image ships them. - Model provenance:
reflex model-info <gguf> [--sha256] [--json]prints a GGUF's license, source, architecture, quantization and sha256, no GPU needed. - Runpod Hub worker:
COMPLIANCE=onadds an attestation (model sha256 and license, engine version, GPU, wall time, and token counts for chat and embedding jobs) to every response, plus a report job that returns the SBOMs and a model card.AUDIT_LOG=stdout|volumewrites one JSON line per job.
These records are facts, not legal advice. Overview, model card template and data-handling statement: docs/compliance/. Hub options: .runpod/README.md.
These are permanent, not a backlog:
batch_sizeis always 1. No request queue, no continuous batching, no PagedAttention-style allocation. Run more processes to serve more requests.- No network server in the engine, ever. HTTP lives in the separate sidecar; the engine itself offers only sequential local IPC and in-process bindings.
- No multi-tenant LoRA router, no internal KV-cache store. Adapters load once at startup; where a KV-cache file lives is the caller's business.
- No scheduler or autoscaling. The platform (Kubernetes, a serverless provider, an autoscaling group) is the orchestrator; the engine stays a single-shot process.
The reasoning, and what the engine may grow instead: docs/DEVELOPMENT.md.
- docs/reference.md: subcommands, build features and kernel modes,
--jsonoutput, error categories, Docker, Kubernetes - docs/benchmarks.md: every measurement, with method and caveats
- docs/DEVELOPMENT.md: building, testing, and the rules for changes
- docs/design/agent-relay.md: agent-to-agent handoffs (pinned prefixes, cache files, constrained output) and their measurements
- .runpod/README.md: the Hub worker's opt-in RAG
(corpus sources,
ragjob fields, costs) - docs/compliance/: opt-in compliance records (SBOMs, model provenance, attestation, audit log)
- docs/gpu-ci.md: the nightly GPU workflow
- CHANGELOG.md: what has been built, in order
MIT; see LICENSE. Contributions need a signed Contributor License Agreement; see CONTRIBUTING.md.