Engineering · · OpenJet
OpenJet's engine is a CUDA inference engine built for Qwen3.8-27B on NVIDIA RTX GPUs. Its central optimisation is to get more useful output from each pass over the model's weights. It combines a persistent decoding kernel, on-device multi-token prediction (MTP), and a separate tensor-core path for processing prompts.
On an RTX 3090 with thinking on, OpenJet now decodes 121 tokens/s versus llama.cpp's 61, and 96 versus 37 with 98K tokens in context, with speculation enabled on both sides (benchmarks). Those gains are specific to the model, hardware and settings measured. Understanding why they appear starts with a much smaller result: without speculation, the first version of the engine and llama.cpp decoded at about the same speed, 42.9 and 40.4 tokens/s.
This article explains the design those numbers come from, using the engine's first version at revision 8f29aff, which verified up to four drafts per pass. The current engine, developed further by Benjamin Cutler in qwen38-megakernel, keeps that design and verifies up to seven.
The bottleneck: reading weights for a small amount of work
Generating a token requires applying the model's projections to a small set of activations. For a single conversation, those projections have little work to reuse across tokens unless the engine deliberately creates that opportunity. The engine README describes both implementations' non-speculative decode as close to the memory-bandwidth limit: OpenJet's 42.9 tokens/s is only about 6% above llama.cpp's 40.4.
Speculative decoding creates more work for each weight read. A cheaper predictor proposes several future tokens. The main model evaluates the proposed continuation together, accepting a prefix and correcting a failed proposal. Each accepted draft moves the conversation forward without requiring a separate full-model pass for that token.
OpenJet uses the model's MTP block to draft, then evaluates the current token and up to four drafts together. These are positions from one conversation. A verification pass can therefore advance the sequence by several tokens while sharing the expensive weight traffic across the positions.
This gives a useful way to reason about the design:
decode throughput ≈ accepted output tokens per cycle / time per cycleBoth sides of that ratio matter. More drafts can increase accepted output, but drafting takes time and rejected proposals do not advance the conversation. The goal is to keep verification cheap enough, and acceptance high enough, for the extra work to pay for itself. The baseline result is evidence for this explanation, not an isolated measurement of each optimisation's contribution.
One GPU launch for a speculative cycle
The decoding implementation specialises the complete cycle to the model's shapes. The source describes 64 main layers: 48 Gated-DeltaNet layers and 16 gated full-attention layers, plus the MTP block. A persistent cooperative CUDA kernel carries out roughly 340 phases, synchronising GPU blocks with a software grid barrier between phases.
Current token + drafts
↓
Main model evaluates all positions together
↓
Full-vocabulary output head + verification
↓
MTP catches up with accepted positions
↓
MTP proposes the next drafts
↓
Host receives accepted output tokensPersistent here means that the GPU kernel stays active through the phases of one cycle. There is still a launch for the next cycle. Keeping projections, attention, feed-forward work, verification and drafting inside that launch reduces kernel-launch overhead and host round trips between those operations.
The projection kernels retain the weights' GGUF quantised representations. Q6_K and Q8_0 weights are rearranged at load time for aligned memory access without changing their values. During decode, integer dot products use CUDA's dp4a instruction with int8 activations. Warps reuse activation loads across weight rows, and weight reads serve multiple verification positions. Adding positions therefore increases arithmetic without multiplying the dominant weight traffic in the same way as separate decode passes.
The producing phase also requantises activations for the next consumer, including the next RMS normalisation's weight. This reduces intermediate work and lets consumers use asynchronous copies. These details support the main design: doing more useful work while the weights are already being streamed. Implementation notes.
Cheap drafting, careful state management
The draft output head scores a bundled vocabulary of 32,768 frequent tokens instead of the entire vocabulary. Tokens from the current sequence that are absent from that subset are added dynamically, helping the predictor reuse identifiers in pasted code. The main model's verification still uses the full vocabulary. Restricting draft candidates can change acceptance and performance without restricting which tokens the final model may emit.
Acceptance depends on the continuation. In the current measurements, with thinking on, the Python function prompt reaches 144.8 tokens/s while the C ring buffer prompt reaches 102.5. The first version also reduced a configured four-draft depth to three for a cycle after a rejection. Extra speculation has a cost, even in a kernel designed to share weight reads.
State handling is another part of that cost. Gated-DeltaNet layers maintain a recurrent state, so speculative positions cannot simply become permanent as they are evaluated: some may be rejected. OpenJet commits state only through the position known to be accepted. It keeps a small ring of intermediate values and replays accepted drafts into the recurrent state at the start of the following cycle. Rejected drafts do not require copying and restoring a full state snapshot.
Full-attention layers use split-K flash decoding, with fp16 tensor-core operations and fp32 accumulation. Double-buffered K/V tiles overlap loading the next tile with processing the current tile. This targets a different cost from weight streaming: reading the growing attention history. As context grows, that history takes more work, so short-prompt throughput cannot describe every conversation length. Drafting, replay and attention details.
Prompts need a different execution path
Prompt processing, or prefill, has many known tokens available at once. That gives the GPU enough parallel work to use larger matrix multiplications. OpenJet therefore uses ordinary batched CUDA kernels for prefill rather than feeding the whole prompt through its small-position decode cycle.
The prefill kernels process all but the last prompt token in chunks of up to 2,048 tokens. Quantised projection weights are dequantised in registers for fp16 tensor-core matrix multiplication; the engine avoids expanding the whole model into a separate fp16 weight copy. Gate and up projections share a matrix multiplication whose epilogue prepares the feed-forward down projection's input. DeltaNet uses a chunked formulation, and full attention uses causal flash attention. Prefill design.
Prefill leaves the caches and recurrent state in the layout decode expects. The last prompt token enters the persistent kernel, which produces the first output token and the first drafts. A growing conversation uses the batched path to append new input, including any accepted positions still waiting to be committed to recurrent state.
This matters for a coding agent: reading a pasted file or tool result may dominate the wait before generation starts. In the published second-turn test, processing 2.7K new tokens takes 1.68 seconds in OpenJet versus 2.41 seconds with llama.cpp's prompt cache. At 12K new tokens, the times are 8.10 and 10.45 seconds. These are prompt-processing times; generating the response adds further latency.
What the measurements show
The current results compare the same Qwen3.8-27B Q4_K_M GGUF on one RTX 3090, one conversation, through the same benchmark harness: 106K-token context, q8_0 KV cache, thinking on, temperature 1.0, top_p 0.95, top_k 20, 1,024 tokens per reply.
| Decode workload | llama.cpp (tokens/s) | OpenJet (tokens/s) | Speedup |
|---|---|---|---|
| Five short coding prompts | 60.7 | 121.2 | 2.0× |
| Python function prompt | 66.2 | 144.8 | 2.19× |
| C ring buffer prompt | 55.7 | 102.5 | 1.84× |
| 98K tokens in context | 36.6 | 95.9 | 2.6× |
llama.cpp b11982 uses MTP with at most two drafts, flash attention, q8_0 keys and values, 99 GPU layers and one server slot; OpenJet's engine uses up to seven drafts. llama.cpp was measured on 29 October 2026 and OpenJet on 17 November 2026; one short prompt and the 98K prompt's text differ between the runs. Reading the 98K-token prompt took 76 seconds against 112.
The spread between prompts is the acceptance effect described above: the Python prompt, with its repeated structure, gains the most. The gain grows with context because llama.cpp's decode slows faster as its attention history grows.
Decode rate excludes model loading, prompt processing and response transport. Faster decode does not imply the same proportional reduction in total request time or coding-task completion time. The benchmark article supplies the complete tables, aggregation rules and reproduction commands.
Correctness has two separate questions
First, does speculation preserve the target model's selection rule? Greedy verification follows the main model's choice. Sampled verification is designed to preserve its sampling distribution through acceptance and correction; the README reports a 2,000-sample test per position. The smaller draft vocabulary belongs to the proposal mechanism, while verification retains the full output vocabulary.
Second, how closely does the CUDA implementation match llama.cpp numerically? Arithmetic ordering and precision differ. Even changing verification batch size can change a near-tie between tokens, so preserving the sampling rule does not guarantee byte-identical generations across engines or draft settings.
The project compares teacher-forced next-token distributions against llama.cpp generating token by token with q8_0 KV. llama.cpp's own batched mode, scored against the same reference, shows how much two correct implementations differ. On 13,299 positions of repository code and prose after 1,024-token prompts:
| Configuration against the reference | Top-token agreement | Mean KL divergence (nats) | Perplexity |
|---|---|---|---|
| llama.cpp, batched | 98.25% | 0.00225 | 3.1529 |
| OpenJet, q8_0 KV | 98.74% | 0.00162 | 3.1504 |
Reference perplexity is 3.1528; lower KL means distributions closer to that reference. After a 94K-token prompt, over 1,980 positions, OpenJet agrees on 99.70% of top tokens with KL 0.00093, against 99.49% and 0.00111 for llama.cpp's batched mode. These checks support numerical similarity on the tested material. They do not measure coding-task success or establish identical behaviour on every input. Correctness procedure and results.
Where the design stops helping
Specialisation makes this approach practical and sets its boundaries. The engine targets Qwen3.8-27B shapes and supported tensor quantisation recipes. A GGUF extension or a Q4 label alone does not establish compatibility. The loader checks every tensor's type for its role; files the current engine can't read, such as UD-Q3_K_XL, run on the legacy engine kept beside it.
The supported environment is Linux with an NVIDIA sm_86, sm_89 or sm_120 GPU and at least 24 GB VRAM; more than four drafts needs a GPU with at least 80 SMs. The engine is tuned on the RTX 3090. These results do not establish its speed on other supported GPUs, other models or quantisations. CPU and Apple GPU execution use other runtime paths.
It supports temperature, top-p, min-p, top-k up to 32 and the presence and frequency penalties, and ignores the repetition penalty with a warning. Editing an early part of conversation history, including context compaction, resumes from the nearest saved checkpoint and processes the rest again. There is no slot save/restore. These restrictions affect whether the engine can replace an existing application backend, even when its decode rate is attractive.
The measured workload is one conversation. The engine also serves up to four conversations at once with --agents (documentation); the engine's author measured 424 tokens/s in total on short prompts, which this article does not reproduce.
Finally, the speed tables report means without confidence intervals, and the two engines were measured on different days. Poor draft acceptance, longer attention histories and time spent outside decode can all reduce the practical gain.
OpenJet's engineering result is that a specialised verifier can turn shared weight reads into more accepted tokens per cycle. The published RTX 3090 measurements demonstrate that benefit for the specified workloads. To evaluate it for an application, start with the standalone installation, run the benchmark procedures, and measure prompt latency, generation, numerical behaviour and complete task time on the workload you intend to serve.