Add generated quant-kernel JIT and accelerate Gemma4, BGE-M3, and GLiNER2 - #372
Open
timkaye11 wants to merge 19 commits into
Open
Add generated quant-kernel JIT and accelerate Gemma4, BGE-M3, and GLiNER2#372timkaye11 wants to merge 19 commits into
timkaye11 wants to merge 19 commits into
Conversation
ajroetker
reviewed
Jul 17, 2026
ajroetker
reviewed
Jul 17, 2026
| @@ -0,0 +1,345 @@ | |||
| name: CUDA Gemma 4 L4 Evidence | |||
Contributor
There was a problem hiding this comment.
Seems like we probably want this to be an e2e test or not in ci
ajroetker
reviewed
Jul 17, 2026
ajroetker
reviewed
Jul 17, 2026
ajroetker
reviewed
Jul 17, 2026
timkaye11
force-pushed
the
codex/quant-kernel-runtime-jit
branch
from
August 3, 2026 16:40
08bf6d0 to
1d98ca0
Compare
…NER2 Adds evidence-gated Metal and CUDA quant-kernel generation and runtime routing, Gemma4 QAT long-context and sampling improvements, the interactive inference CLI, BGE-M3 and GLiNER2 acceleration, and related SDK and runtime hardening.
timkaye11
force-pushed
the
codex/quant-kernel-runtime-jit
branch
from
August 3, 2026 20:04
1d98ca0 to
ad36877
Compare
timkaye11
force-pushed
the
codex/quant-kernel-runtime-jit
branch
from
August 4, 2026 02:57
b7da786 to
5a3ed60
Compare
timkaye11
force-pushed
the
codex/quant-kernel-runtime-jit
branch
from
August 4, 2026 05:39
5a3ed60 to
3917bc4
Compare
Contributor
|
# Conflicts: # zig/pkg/inference/build.zig # zig/pkg/inference/src/architectures/deberta.zig # zig/pkg/inference/src/architectures/session_factory.zig # zig/pkg/inference/src/backends/metal_kernels.m # zig/pkg/inference/src/backends/metal_runtime.zig # zig/pkg/inference/src/bench/gliner2_native.zig # zig/pkg/inference/src/graph/backend_contracts.zig # zig/pkg/inference/src/inference.zig # zig/pkg/inference/src/ops/metal_compute.zig # zig/pkg/inference/src/ops/ops.zig # zig/pkg/inference/src/pipelines/gliner.zig # zig/pkg/inference/src/server/model_manager.zig # zig/pkg/inference/src/server/server.zig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an evidence-gated GPU kernel pipeline and applies it across Gemma4, BGE-M3, GLiNER2, and core multimodal/reranking inference.
antfly inference chatwith model pulling, streamed multi-turn generation, context trimming, interruption, slash commands, and per-turn statistics.Benchmarks
Local, unattested
ReleaseFastmeasurements used a MacBook Air with an Apple M4 8-core GPU and 16 GB RAM. Metal was enabled; CUDA, ONNX, and PJRT were disabled. The same host, model bytes, inputs, and harnesses were used on both sides.The control is the saved main/base snapshot at
8ad98e6, not currentmain. Branch measurements were collected on the reviewed candidate immediately before the final main merge. HTTP results generally use three warmups and ten measured requests. Negative latency deltas are faster.Core models
mxbai-rerank-base-v1¹ Main's ten CLIP-text samples produced five response hashes. The value shown is the median of the three samples matching the branch's deterministic, byte-exact output. CLIP/CLAP values are repeat medians; the reranker value is the median of two cooled isolated runs.
Gemma4 E2B long context
The same raw prompt was repeated to approximately 2K tokens with a forced 300-token completion. The branch tokenizer produced 2,065 prompt tokens versus 2,048 on the control, so normalized prefill throughput is included. Branch used one warmup and five measurements; control used three warmups and ten.
Both revisions generated exactly 300 tokens and were deterministic within each revision. Token IDs differ because of the known tokenizer-path difference, so this is performance evidence rather than cross-revision token parity.
Additional qualification results
These earlier branch results were not rerun during the final M4 sweep.
GLiNER2 Metal is approximately 6.9x faster than its pre-optimization batch-16 baseline and 33-43% faster than native CPU at these shapes.
Correctness and validation
0.998552143573761) match main exactly; Florence2 caption text is exact.0.0003637075; all four relation endpoints resolve correctly.The final review found no unresolved P1/P2 defect in the reviewed changes.