Repository navigation
tflite: fix the 172 Hz buzz in the w8a8 SAME-S decoder - #125
Merged
Merged
Conversation
The int8 (w8a8) SAME-S decoder added a faint 172 Hz tone (= 44100/256) with harmonics, audible in quiet passages. Cause: the output-mapping Conv1d (768->512, k=3) is quantized with a per-TENSOR dynamic-int8 activation scale, so quiet sections land on a coarse grid and the unpatched 256-sample patches become a periodic staircase. Fix: express the mapping as im2col + a pointwise matmul (numerically identical to the conv, 1e-6), which the converter emits as a FULLY_CONNECTED. Dynamic int8 scales FCs PER-TOKEN, so the quiet grid adapts and the buzz is gone -- at full int8 speed (the FC stays int8; decode within ~1% of the conv). Decoder-only, no graph/API change; the fp32 path is bit-identical. Measured 172 Hz in a quiet passage: -73 -> -92 dBFS (fp32 -98); full-clip corr to fp32 0.9997. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
The w8a8 SAME-S decoder emits a faint 172 Hz tone (= 44100/256) with harmonics in quiet passages. It's the output-mapping conv: tflite quantizes conv activations per-tensor, so quiet sections hit a coarse grid and the unpatched 256-sample audio patches form a periodic staircase.
Reformulating the k=3 mapping conv as im2col + a pointwise matmul (bit-identical to the conv, 1e-6) makes the converter emit a FULLY_CONNECTED, which the dynamic-int8 path scales per-token — the grid adapts to the quiet level and the buzz is gone, at full int8 speed.
Validated across 8 prompts × 3–40 s (incl. chunking): the new decoder is ≥ the old everywhere on fidelity and on the 172 Hz metric, finite, no clipping. The updated
dec_w8a8.tfliteis live on HuggingFace; the previous build is archived attflite/same-s/legacy/dec_w8a8-hasbuzz-2026-09-01.tflite.🤖 Generated with Claude Code