Conversation
Add optimizer-backed DPO and GRPO with strict CUDA execution, batched preference gradients, device-resident AdamW, deterministic qualification, and LoRA artifact publication. Qualify E2B and E4B BF16 checkpoints against pinned Unsloth, honor checkpoint-declared shared-tail MLP topology, harden A4B quantized loading, and regenerate the affected API and CUDA artifacts.
Contributor
|
looks like this needs a make generate? |
# Conflicts: # go/pkg/sdk/oapi/client.gen.go
ajroetker
reviewed
Sep 8, 2026
| - auto | ||
| - streamed | ||
| - resident | ||
| A4bLoadStrategy: |
Contributor
There was a problem hiding this comment.
I don't think we should have a4b specific config options
Contributor
Author
|
/ci run d8dfae0 |
# Conflicts: # go/pkg/sdk/oapi/client.gen.go # zig/pkg/antfly/src/storage/lsm_backend/cache.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.
This PR productionizes Gemma 4 CUDA preference training for both E2B and E4B,
plus the qualified 26B-A4B inference load path.
execution, batched preference gradients, device-resident AdamW, and LoRA
artifact publication.
group sample standard deviation (
correction = 1), additive1e-4denominator epsilon, and per-completion token-mean loss.
tail while E4B keeps uniform-width MLPs. Missing flags default to the
upstream-compatible uniform topology.
verifies CUDA execution evidence, adapter movement, deterministic output,
model/protocol fingerprints, and reports matched end-to-end performance
against Unsloth.
bounded pinned-host pipelining, prepared-pack policy, startup prefetch,
memory envelopes, and strict public configuration.
Qualification and Unsloth comparison
Matched end-to-end benchmarks on one NVIDIA L4 (SM89, 23,034 MiB), using local
Gemma 4 E2B and E4B BF16 SafeTensors checkpoints. Every sample is a fresh
process and includes startup, model load, 25 optimizer updates, and adapter
publication. Results are medians of three deterministic repetitions.
Protocol: LoRA rank 16 / alpha 32,
q_proj+v_proj, dropout 0, sequence cap128, AdamW (
lr=1e-4, weight decay0.01, betas0.9/0.999, epsilon1e-8),constant LR, gradient clipping 1.0, and accumulation 1. GRPO uses group size 4,
four completion tokens, clip epsilon 0.2, KL coefficient 0.04, sample-std
reward scaling, and advantage epsilon
1e-4.E2B DPO completes in 7.2% less wall time than Unsloth and corrected-semantics
GRPO is at parity, completing in 0.4% less wall time. E4B is within 10.3% of
Unsloth throughput for both objectives while using 10.2-12.7% more peak GPU
memory. All three Zig repetitions for every model/objective benchmark produced
identical losses, gradient norms, and trained-adapter SHA-256 values. Every run
reported exactly 25 CUDA optimizer steps, changed every expected LoRA tensor,
and reported zero graph fallback, unsupported operations, interpreter
fallback, or host gradients.
Pinned baseline versions:
ReleaseFast CUDA binary SHA-256 used for the E4B benchmark and current E2B
regression qualification:
bd9d19f56eef478a72deebf71a6c80e1180bff84fc840f5e1b8ca3191d625700The E2B three-repetition benchmark predates the parser-only E4B follow-up and
used binary SHA-256
6b8ec016e1c12bb4c981d5fc029497bed616213475a5390fe4a96e339e3abf3e.The current binary was requalified on the real E2B checkpoint for both DPO and
GRPO; both objectives passed with every expected adapter tensor changed.
Validation
zig build inference-test-finetunezig build quant-kernel-local-check -Dmetal=false -Dcuda=false(120 selected compiler/renderer tests)
py_compile