Skip to content

Optimize Drama 3 output head for speech token candidates - #931

Merged
0xShug0 merged 1 commit into
mainfrom
perf/drama3-restricted-output-head
Oct 16, 2026
Merged

0xShug0 merged 1 commit into
mainfrom
perf/drama3-restricted-output-head

Conversation

@0xShug0

@0xShug0 0xShug0 commented Oct 16, 2026

Copy link
Copy Markdown
Owner

Summary

Compute only EOS and the 4,096 semantic-token logits that Drama 3 already samples, rather than projecting the full 252,288-token vocabulary and discarding the other results.

  • Use views of the existing GPU weights, with a session-owned cached graph. No per-frame weight gathering or GGUF regeneration.
  • Preserve candidate order, sampling, dtype, and expert placement in resident and offload modes.
  • Add candidate-logit checks to the existing backbone test and group the noise, standard, and long-short-long regression cases for reuse.
  • No framework, ggml/kernel, spec, or codec changes.

Validation

CUDA RTX 5090, Debug build, existing Q4_K_S GGUF, eight threads, 256-character text chunks. Offload uses eight pinned expert slots and a GPU codec. Measurements were sequential with logging and 25 ms peak-VRAM sampling. Warm RTF averages the four requests after warmup in the standard five-request session; timing uses session.wall_ms and actual WAV duration.

Mode / Measurement Warm RTF Before Warm RTF After
Resident 0.209222 0.193675
Offload, first pair 0.519309 0.528091
Offload, recheck 0.515051 0.515085

Resident is 1.08x faster, with all four warm requests improving. Accumulated head time is 5.53x faster in resident mode and 6.51-7.07x faster in offload mode. These are head-level gains, not whole-model speedups.

Offload end-to-end improvement is not established: the first pair was 1.69% slower, while the recheck was effectively flat. Strict zero-performance-regression for offload is not claimed.

Standard Session Peak VRAM Before After
Resident 26,630 MiB 26,630 MiB
Offload 7,848 MiB 7,846 MiB

The full head remains loaded; this is not a weight-memory optimization. No observed peak-VRAM increase across the regression group.

Correctness checks:

  • All 34 primary CUDA outputs match baseline byte-for-byte: 17 resident and 17 offload, covering three noise seeds, the standard five-request sequence, and three long-short-long sequences including the previously failing computing case.
  • All eight primary repeat pairs are byte-identical within their sessions.
  • Streaming offload and real Vulkan offload first/repeat outputs match their pre-experiment baselines exactly.
  • Eight additional initial A/B/control WAV comparisons also match, for 45 successful baseline comparisons overall.
  • The existing backbone allocation/lifecycle test, extended with full-versus-selected candidate logits and graph recreation, passes on CPU, CUDA, and Vulkan.

Identical WAVs preserve the previously validated offload ASR results, including the existing seed-42 exciting to easy substitution; no correction of that pre-existing error is claimed. CPU testing is component-level, not full-model inference.

@0xShug0
0xShug0 merged commit 624cf91 into main Oct 16, 2026
6 checks passed
@0xShug0
0xShug0 deleted the perf/drama3-restricted-output-head branch October 16, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant