Skip to content

inkling2 cuda: keep Mini logprob rows when a drafter wraps the backend - #6223

Open
jmpijll wants to merge 1 commit into
ashhart:mainfrom
jmpijll:inkling2-cuda-drafted-logprobs
Open

jmpijll wants to merge 1 commit into
ashhart:mainfrom
jmpijll:inkling2-cuda-drafted-logprobs

Conversation

@jmpijll

@jmpijll jmpijll commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

Follow-up to #5210.

Before: native/cuda_drafted.zig always clears first_row (native.first_row = null) when wrapping a target backend with a drafter, even when the target backend handles both first and drafted verify logprob rows. As a result, serving Inkling 2 Mini on CUDA with --drafter (DSpark or DFlash2) reports logprobs = false and refuses logprobs / top_logprobs requests.

After:

  • cuda_drafted.zig gains keepFirstRow(keep: bool, first_row: ?FirstRowFn) and honours keep_first_row on the opened drafter wrapper so families whose target backend already fills logprob rows through drafted verify rounds keep first_row enabled.
  • families/inkling2/cuda_native.zig sets .keep_first_row = true on its opened Mini drafter.
  • Other families keep .keep_first_row = false (unchanged default).
  • Adds a host unit test in zig/src/native/cuda_drafted.zig covering both keep_first_row = false and keep_first_row = true.

Checks on this head

  • Head commit: 923dffa1a on main f25ae9711 (one commit, 2 files, +49/-0).
  • zig fmt --check zig and git diff --check origin/main: clean.
  • python3 tools/pr_check.py --base origin/main: 0 errors, 0 new lean findings, 0 new import cycle edges.
  • zig build -Dfixed-cpu -j8 test-inkling2-cuda-host test-lane-api-host --summary all: 17/17 steps succeeded; 946/946 tests passed (test-lane-api-host: 835/835; test-inkling2-cuda-host: 103 + 3 + 1 + 3 + 1 = 111/111).
  • Not run on GPU CI here: the change is pure Zig wiring on top of inkling2 cuda: Mini logprob rows (first_row and verify rows) through the shared row kernel #5210's shared row kernel; no kernels, draw paths, or precision change.

Checklist

  • Title and description match the head commit.
  • New host test covers both keep_first_row = false and true.
  • One-line comments/docstrings; no measurements or history in source.
  • No personal data, machine names, internal hosts, or local paths in the diff or commits.
  • No precision traded for speed; drawn tokens and kernels are untouched.

GB10 device follow-up

Built head 923dffa1a for CUDA sm_121 and ran Inkling 2 Mini with an 8,192-token context, two slots and prompt caching off. Both DSpark and DFlash2 returned 96 logprob rows on /v1/completions and seven content logprob rows on /v1/chat/completions. The replies and finish reasons matched their draft: false controls. DSpark accepted 62 completion and 38 chat draft tokens. DFlash2 accepted 70 completion and 46 chat draft tokens. This run checks device behavior for the two drafted paths.

With --drafter (DSpark or DFlash2), Inkling 2 Mini verifies drafts on the same target backend, so its opened drafter now asks native/cuda_drafted.zig to keep first_row logprobs enabled. Includes a host test covering families with and without first_rows.
@ashhart ashhart added kind:bug Classified by Synthena as bug fix synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY labels Dec 3, 2026
@ashhart

ashhart commented Dec 3, 2026

Copy link
Copy Markdown
Owner

Synthena Initial Review — Initial diff check passed (awaiting device run) (kind:bug)

Adds a first_rows flag to the Inkling 2 CUDA drafter wrapper so the target backend's first_row logprob hook is preserved when a drafter wraps it, fixing logprobs = false refusals for Inkling 2 Mini with --drafter. Includes a host unit test covering both flag values.

  • Touches runtime, kernel, or serving paths; awaiting device and performance verification before landing.
  • Synthena

@ashhart

ashhart commented Dec 5, 2026

Copy link
Copy Markdown
Owner

Thanks @jmpijll. The wrapper now preserves Mini's first-row callback for both DSpark and DFlash2, and other families retain the previous default. The host test covers both flag values.

The GB10 follow-up answers the earlier device request: both paths return completion/chat logprob rows, match the plain replies and finish reasons, and accept draft tokens. Ready for our final GB10 A/B of complete row values and token alignment against plain target decoding, including both slots and streamed replies. We will compare those exactly, with no tolerances. No further author change or repeated run is requested.

This review was source-only; builds and device checks were not rerun.

  • Synthena

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind:bug Classified by Synthena as bug fix synthena:needs-device Initial diff review passed; waiting for device and slowdown check before READY

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants