Run quantized Whisper on the fused Metal decode path - #768
Merged
Merged
Conversation
The in-place K/V and fused Q/K/V projections only accepted dense weight slots, so a quantized Whisper GGUF fell back to separate projections and blit copies into the cache (17 encoders and 8 blits per token). Quantized slots now write straight into the slab rows through the existing quantized single-row and fused Q/K/V kernels, so q8_0 and q4_0 decode on the same single-encoder, zero-blit step as f32. The GGUF export applies a Whisper policy under the requested format: position tables stay dense, and the token table and the whole encoder never go below q8_0. A 4-bit token table breaks language detection on the small checkpoints, and q4_0 across all 32 encoder layers of large-v3-turbo produces nonsense on both backends while q8_0 is exact and also the fastest quantized encoder on Metal. large-v3 and large-v3-turbo use 128 mel bins; the mel front end now takes the bin count from the checkpoint config instead of assuming 80.
The export policy let q6_k through for the encoder and token tables while the guide promised those never go below q8_0; q6_k now floors too. New tests cover the exported tensor types under the policy with include and exclude filters, the 128-bin mel front end (shape, BLAS and FFT parity), and quantized projections written in place into slab rows on Metal with nonzero biases, the fused q8_0 kernel, the mixed-format fallback, and untouched neighboring rows.
Contributor
Author
|
/ci run b2abb22 |
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
Follow-up to #760: quantized Whisper GGUF bundles now run on the same fused Metal decode path as f32, the export command applies a Whisper-aware quantization policy, the 128-mel large-v3 checkpoints load, and a ready-made Q8_0 large-v3-turbo is published at
antflydb/whisper-large-v3-turbo.antfly inference export <dir> --target gguf --format q8_0|q4_0already produced Whisper bundles. Under the requested format, position tables now stay dense and the token table (tied output head) and the whole encoder never go below q8_0 (q6_k included); decoder layers take the requested format. Prefix include and exclude filters still apply on top.large-v3andlarge-v3-turbofailed withInvalidInputShapebecause the mel front end assumed 80 bins. The bin count now comes from the checkpoint config through the server, the dictation runtime, and the CLI.antfly inference pull antflydb/whisper-large-v3-turbo:gguf:Q8_0 --tasks transcribeinstalls the Q8_0 export (829 MB, MIT, model card with the reproduce command). Verified end to end: pulled through the registry and transcribed on Metal.Why the policy
Measurements
Metal, warm CLI run, 2.5 s English clip, M-series laptop. The published large-v3-turbo safetensors are f16.
Decode per token barely moves because it is bound by kernel dispatch at these sizes, not weight bandwidth; the gains land in size, encoder time, and the prompt block. q8_0 is the recommended format. The f16 checkpoints run their decoder on the unfused path (the dense fused Q/K/V entry only takes f32 weights), which is another reason to export large-v3-turbo to q8_0.
Test plan
test_transcribe.py,test_dictate.py,test_transcription_sessions.py): 24 passed against a server from this tree/transcribeand/dictateover HTTP against a q8_0 tiny bundle installed as a model directory (Spanish clip, correct transcript and language)antfly inference pull antflydb/whisper-large-v3-turbo:gguf:Q8_0round trip, then transcription of both clips from the pulled directoryDeferred to a follow-up: listing the bundle on the supported-models page as the accuracy recommendation, and whether the e2e suite should pull it.