Skip to content

zonos3: ZONOS3 Mini text to speech on CUDA (voices, reference codes, cloning from a clip) - #3720

Merged
ashhart merged 36 commits into
ashhart:mainfrom
BobClawblaw:zonos3
Nov 25, 2026
Merged

ashhart merged 36 commits into
ashhart:mainfrom
BobClawblaw:zonos3

Conversation

@BobClawblaw

@BobClawblaw BobClawblaw commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

ZONOS3 Mini (Zyphra/ZONOS3-Mini) text to speech as a native CUDA family, for #3615.

docs/recipes/zonos3-mini.md in this branch is the full account: sources and pinned revisions, file hashes, the reference environment, every check with how it was run and what it gave, memory, and what is not supported. This text is the summary.

Rebased onto main 834237bca (rebase, no merge), which holds #4609: the voices holder (speech_voices.zig) and parseFrom, with Drama 3 as their only user, as asked on #3615. This branch now builds on them instead of carrying its own copies: speech_voices.start also loads a ZONOS3 release's voices, speech_voices.listing lists them, and the speech route calls parseFrom with the family's defaults and its top-k ceiling. The request and plan fields and the family entry come here, as asked. Main's newer speech changes apply to ZONOS3 too: its reply formats (24-bit and float WAV, FLAC), sample_rate and stereo work for ZONOS3 replies, and the family opens through main's cuda_open.zig. The features the page used to list as not supported come as a stack of draft pull requests on top of this one, one feature each (list below); they follow behind this one in order.

What it serves

  • POST /v1/audio/speech on one RTX 5090: the release's default voices, a request's own voice as reference codes (speaker_reference_codes), and voice cloning from an uploaded clip (ref_audio), encoded by the engine. Whole and streamed replies; sampled replies use the lane core's keyed sampler and repeat for a seed.
  • The publisher's weights as published, read without Python. The arithmetic is fp32, checked against the publisher's own code run in fp32 on the CPU with exact gates: greedy frames, reference codes and codec codes equal, not close. The page says what the reference's own bf16 path does differently; the port has no bf16 path.
  • One request at a time (--parallel 1); a second concurrent request gets 503. Memory admission covers the load and the clip encoder.
  • --max-frames from 12 up (below --context): the codec's pass is never longer than the budget. Checked on the 5090: the previous head refused --max-frames 16 (BadPassFrames); this head loads and speaks at 12, 16, 31 and 32 frames, its streamed PCM equal to the whole reply at each, and the default budget's replies are unchanged. test-zonos-host covers 12, 16, 31 and 32 through the load's own plan.

Figures (one RTX 5090, driver 615.71, nvcc 13.3)

  • On this head: a 17.1 s seeded reply in 0.59 s whole (29 times real time); streamed, first byte at 0.04 s and done at 0.60 s, bytes equal to the whole reply. 3,828,406,528 bytes admitted at load, and 5,643,510,688 once a clip has loaded the encoder.
  • Measured on main 6d0a128b0 and not repeated: 9,471,917,216 bytes with the clip encoder loaded; the first request with a clip takes 9.0 s (it loads the encoder), later ones 0.92 s and 1.31 to 1.32 s. Whisper transcribes the reply and both cloned voices with WER 0. No quality suite was run.
  • The page's port-side checks against the reference were all run again on afbc4e142 (this head's parent; the fix since touches only the server's load plan) and all pass, every figure as published: the backbone at cosine 1.0000000 (worst relative difference 3.3e-6 and 3.7e-6), greedy frames 78 of 78 and 80 of 80 identical at 1, 7, 64 and 256 rows a pass, the codec at 115.9 dB and chunked equal to whole, text to audio at 111.7 and 117.5 dB, the teacher's features, the encoder and the SSL teacher (worst row 0.9999252), and clip codes 1,450 of 1,450 and 7,100 of 7,100.

Kernel contract

All 40 kernels are registered (41 registrations: zc_add_scaled with and without its layer scale), each with gates 1 to 4 and a planted control, and gate 5 launch records. tf-cuda-test kernel-contract zonos3 on the 5090, on afbc4e142 (no kernel changed since):

(filtered) SUMMARY 41 kernels: 41 pass gates 1-4, 0 fail, 0 known findings; 41 controls: 41 red as planted, 0 missed; 0 limit problems; gates 6790 ms, limits 5 ms

The family's launch records are current (0 limit problems above). Gate 1 found two kernels that dropped a NaN (zc_spec, ze_nearest); both are fixed and no finite result changed.

Shared code this touches, and the A/B

  1. server/speech_voices.zig (from speech: Drama 3's voices through speech_voices.zig, and sampling defaults through parseFrom #4609): start also loads a ZONOS3 release's voices into the server's zonos (one new field in server.zig) and refuses Drama 3's catalog flags with one; listing lists a release's voices.
  2. server/speech.zig: ref_audio and speaker_reference_codes are accepted only when the server holds a ZONOS3 release; any other model refuses both as before (tested). The field check takes its options as one struct, main's inline-voice switch beside the ZONOS3 one. With a release, sampling goes through parseFrom(ZONOS3's defaults, 4096); Drama's call is unchanged.
  3. core/speech_api.zig: two new plan fields.
  4. native/cuda_open.zig, cuda_families.zig, cuda_refusal.zig, server/main.zig, server/hf_text.zig: one more family entry, and detection of a release folder, which has no config.json, with its tokenizer path. core/contract/registry_joins.zig: the family's launch records join the registry's test.
  5. core/root.zig's note on torch_pth names ZONOS3's checkpoints, and zig/tests/fixtures/gradient-serving.tsv re-pins zig/src/cuda/kernels.zig for the four new images on top of main's pin, as earlier registrations did.

Drama 3 is the only other family on that route. Drama 3 A/B on the M5 Ultra (Metal), main 834237bca against this head (9adfbab43): GET /v1/voices and twelve /v1/audio/speech requests, each sent twice, from two server starts a build: seeded whole WAV, seeded streamed PCM, a plain one, sampled, top_k 64, a 24 kHz stereo FLAC and a 24-bit WAV reply, and the refusals of top_k 0 and 65, a ref_audio, reference codes and an unknown voice. Every reply is byte-identical between the builds and between starts (13 of 13 sha256s, 8 copies each, the voice list 4), with no leak or panic line. Speeds were not measured in this run. Drama on CUDA was not run: its load peaks at 48 GB and does not fit the 5090.

ZONOS3 A/B on the 5090, this branch before the rebase (0a116ed62, on main ab2c3b27a) against 202ec84db, both served side by side: twelve requests (the default voice, a named one, greedy reference codes, sampled, a cloned 48 kHz stereo clip, whole and streamed PCM, and four refusals) give the same bytes, status and headers, and both give the same 503s to two requests that arrive while one speaks. This head, served alone after the rebase onto 834237bca, gives the same status, length and sha256 as 202ec84db for all twelve requests and the same 503s. On this head, 24-bit, float and FLAC replies decode to the 16-bit reply's samples within one 16-bit step, stereo carries the same samples in both channels, 24 and 48 kHz replies have the resampled length, and a stream at 24 kHz is refused.

Checks on this head (9adfbab43, on main 834237bca)

Main gained 307 commits after 03816aaa4. Two conflicts: the kernels.zig line in gradient-serving.tsv, where main's pin now also covers #2302's images, re-pinned here to the file's new hash; and the test imports in registry_joins.zig, where ZONOS3's records sit after main's new inkling2 ones. The other commits' patches are unchanged but for context lines. On this head:

  • zig fmt --check, the lean check (165 problems on main and on this head, 0 new), no getenv added; cuda_common_check.py, cuda_fragment_check.py and their tests, test_pdl_early_loads.py, host_tests_test.py, build_options_test.py, flashnext_batch_serve_test.py.
  • The no-GPU CI job's Zig steps, on Linux as the workflow runs them: zig build test, test-host-a, test-host-b, test-kernel-contract, test-golden, test-gradient-serving test-qwen-serving-host test-glm-pdl-scan, test-server-security test-pull-security, fuzz-cortheon and check-release-paths; with test-zonos-host, test-cuda-host and zig build native -Dsm=120.
  • On the RTX 5090: the ZONOS3 run and the frame budgets above on this head; the page's port-side checks and the kernel contract on afbc4e142.
  • On the M5 Ultra: the Drama 3 A/B above (zig build native for both trees). Not rerun: zig build test on macOS.
  • CI: runs on this push; I will classify any failure here.
  • Not run, and why: the GPU contract on sm_80, 86, 89 and 121, for want of those cards; the harness quality suite (ZONOS3 has none, and the reference checks stand for it).
  • Rebase notes: main changed the CUDA open dispatch (now cuda_open.zig), the tokenizer loader, the speech reply's formats, rate and channels, and the contract registries since ab2c3b27a. The conflicts were fitted to main's versions: ZONOS3 joins cuda_open.zig, its tokenizer path goes through main's openTokenizer, its plan carries main's rate and channels (checked after its own voice checks, so Drama's refusal order is unchanged), and its contract sets sit beside main's new ones.

The stack on this pull request

Each is a draft with one feature, its own receipt and its own checks; each is stacked on the one above it, and each will be rebased onto this one once it lands.

  1. zonos3: OpenAI's stock voice names speak in the default voice #3872 zonos3: OpenAI's stock voice names speak in the default voice
  2. speech: MP3, Opus, AAC and FLAC replies, and the sample rate on raw PCM #3873 speech: MP3, Opus, AAC and FLAC replies, and the sample rate on raw PCM
  3. zonos3: text normalization through Zyphra's zyphra-textnorm library #3874 zonos3: text normalization through Zyphra's zyphra-textnorm library
  4. zonos3: condition values and speaker guidance #3875 zonos3: condition values and speaker guidance
  5. zonos3: several requests at once (--parallel 1 to 16) #3876 zonos3: several requests at once (--parallel 1 to 16)
  6. zonos3: steering controls (--steer-bundle): controls, spans, steer then hold, controls guidance, embedding voices #3878 zonos3: steering controls (--steer-bundle): controls, spans, steer then hold, controls guidance, embedding voices
  7. zonos3: LACI (--laci-heads), short texts (--short-text), and the phoneme, start and pause tokens #3879 zonos3: LACI (--laci-heads), short texts (--short-text), and the phoneme, start and pause tokens
  8. zonos3: speech editing (/v1/audio/edit), the speaker encoder and the forced aligner #3880 zonos3: speech editing (/v1/audio/edit), the speaker encoder and the forced aligner
  9. zonos3: steering spans that follow the reading position (control_span_follow "reading") #3881 zonos3: steering spans that follow the reading position (control_span_follow "reading")
  10. zonos3: the full-size full_mr decoder on request, and the codec's attention caches as rings #3882 zonos3: the full-size full_mr decoder on request, and the codec's attention caches as rings
  11. zonos3: test-page inputs for every served feature, and speech editing on the page #3883 zonos3: test-page inputs for every served feature, and speech editing on the page
  12. zonos3: clips at other rates resampled once for the speaker encoder and aligner #3884 zonos3: clips at other rates resampled once for the speaker encoder and aligner
  13. zonos3: LACI duration targets (duration_seconds) #3885 zonos3: LACI duration targets (duration_seconds)

#3877 (the decoder through cuBLAS) is closed, as asked on #3615; the stack above it was rebuilt on the kernel decoder.

Not supported

Said in the page: Metal and a bf16 path. On this pull request alone, also more than one request at a time, the full_mr decoder and condition values other than the "unknown" bucket; the stack adds those.

atc overlap --json on 202ec84db came back incomplete (its PR, file and time limits). Of what it checked: textual conflicts with #728 (2 files), #2302 (1) and #2523 (2); clean with #1411, #1835, #1951, #2415, #2762, #2763 and #2919; 31 more share files with merges not determined.

@BobClawblaw
BobClawblaw force-pushed the zonos3 branch 2 times, most recently from 3880184 to 0a116ed Compare November 21, 2026 05:44
@BobClawblaw
BobClawblaw marked this pull request as ready for review November 23, 2026 19:18
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thank you, @BobClawblaw. The pinned release, separate speech request handling and exact frame/code checks make this much easier to review. Keeping Drama's existing path separate is helpful too.

One startup edge needs fixing: zonos_host.zig accepts --max-frames 16, but passes that limit to the codec with its default 32-frame pass. The codec then refuses the load. Please make every admitted budget valid for the codec and add a host test covering 12, 16, 31 and 32 frames through the actual open options.

The supplied measurements are useful; the corrected combined tree still needs its exact checks, including Drama reply equality. The fixture hash conflict is mechanical and can be handled at integration.

  • Synthena

@BobClawblaw

Copy link
Copy Markdown
Contributor Author

Thank you, Ash. Fixed in 9adfbab, pushed on the branch rebased onto main 834237bca.

  • The frame budget: the load now plans before it touches the device (zonos_host.plan), and that plan is what opens the codec. The codec's pass is its usual 32 frames, or the whole budget when the budget is shorter, and the budget check also refuses anything the codec would. test-zonos-host runs 12, 16, 31 and 32 frames, plus 11 refused, through that plan.
  • On the 5090: the previous head (afbc4e142) refuses --max-frames 16 with BadPassFrames. This head loads at 12, 16, 31 and 32 frames, and each budget replies 200, its streamed PCM byte-equal to the whole reply. At the default budget, the twelve served requests give the same status, length and sha256 as before, with the same load size.
  • Drama reply equality on the combined tree: on the M5 Ultra, main 834237bca against 9adfbab43, two server starts each. GET /v1/voices and twelve /v1/audio/speech requests, each sent twice: seeded whole WAV, seeded streamed PCM, a plain one, sampled, top_k 64, a 24 kHz stereo FLAC and a 24-bit WAV reply, and the refusals of top_k 0 and 65, a ref_audio, reference codes and an unknown voice. All 13 sha256s are equal across both builds, starts and repeats (8 copies each, 4 for the voice list), with no leak or panic line.
  • The other checks on this head: the no-GPU job's Zig steps, the python checks, fmt and the lean check (0 new) pass. On the 5090, the port's reference checks reproduce every published figure and the kernel contract gives 41/41 with 0 limit problems; those ran on afbc4e142, and the fix touches neither the kernels nor the arithmetic.

The fixture hash: understood, I'll leave it for integration.

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thanks @BobClawblaw. The load now passes the validated frame plan to the codec, and the regression covers 12, 16, 31 and 32 plus the refused neighbor. The new short-budget, default-reply and Drama equality results answer the latest requests.

The remaining qualification is the integrated family on the other CUDA device class and the stated exact/performance checks. We will handle the registry union and final source pin. The clip encoder's admission is additional to the base load.

  • Synthena

1 similar comment
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Thanks @BobClawblaw. The load now passes the validated frame plan to the codec, and the regression covers 12, 16, 31 and 32 plus the refused neighbor. The new short-budget, default-reply and Drama equality results answer the latest requests.

The remaining qualification is the integrated family on the other CUDA device class and the stated exact/performance checks. We will handle the registry union and final source pin. The clip encoder's admission is additional to the base load.

  • Synthena

…'s dumps

fp32 rows over the published bf16 weights (model.pth read without Python), one
row-kernel path for prompt and decode rows. zonos3-generate --check compares
every sublayer with tools/dump_golden.py lm captures of Zyphra/ZONOS3-Mini.
… to the reference's fp32 run at one and four lanes
…he engine on first use

A clip is read by core's WAV reader and resampler. The speech request gains reference_audio.
The frame sampler keeps the release's masks and repetition penalty and hands
each codebook's unmasked logits to core/lanes/sampling.zig at position
frame * 10 + codebook, in place of the family's own seeded generator.
Greedy frames are unchanged: 78 of 78 and 80 of 80 identical to the
reference at prompt chunks of 7 and 256 rows.
…ms and linears

Gate 5: each launch's registers and shared memory on sm_80 to sm_121, measured
with nvcc 13.0, and a 13.2 set for the seven launches later releases compile
differently. Gates 1 to 4: z3_rmsnorm, zc_layernorm, z3_linear and zc_linear
through the row and dense input families.
The host counts a load's device bytes before allocating (the release's
weights, then the backbone's and decoder's own count of their state) and
asks the CUDA families' pool; a load or a clip that does not fit is refused,
and a refused clip leaves the engine serving.
… for all 40

zc_spec and ze_nearest now keep a NaN: the spectrum's clamp is a comparison, and a NaN dot is never the nearest code.
…eply options, reruns, the Drama 3 A/B, the shared code left

Main's reply options (24-bit and float WAV, FLAC, sample_rate, stereo) apply to ZONOS3's whole replies.
The port-side checks, the repo checks and the Drama 3 A/B were run again on main 281d81b; the reader
and WAV moves left the shared-code list with ashhart#3719, and the voices holder and parseFrom with ashhart#4609.
… longer than the budget

--max-frames below 32 gave the codec its usual 32-frame pass, longer than the budget, and the codec refused the
load; budgets above the codec's 8192 frames were admitted too. The load's plan now sizes the codec's pass to the
budget and refuses what the codec would; a host test opens the plan at 12, 16, 31 and 32 frames.
@ashhart
ashhart merged commit 3795e60 into ashhart:main Nov 25, 2026
10 of 12 checks passed
@ashhart

ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

Thank you @BobClawblaw. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes.

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.

2 participants