Skip to content

feat(server): serve attested Drama voice catalogs - #1135

Closed
plotarmordev wants to merge 4 commits into
ashhart:mainfrom
plotarmordev:feat/http-voices
Closed

plotarmordev wants to merge 4 commits into
ashhart:mainfrom
plotarmordev:feat/http-voices

Conversation

@plotarmordev

Copy link
Copy Markdown
Contributor

What this changes

Drama speech serving can load an opt-in catalog of reference voices (serve --voices DIR [--default-voice NAME], request voice, GET /v1/voices); without --voices the built-in voice and its prompt are unchanged. Named voices go through the family's prompt.build, the same builder drama3-generate uses.

Consent: each voice file must state source.kind (synthetic, self or consented) and a nonempty source.note. A file without both refuses startup. This is the operator's own statement. The server cannot check it, so it is not proof of consent. Notes are never returned by the API. Voices come only from the directory read at startup, never from request paths or request audio. This PR ships no tool for making voice files.

This is independent of #1119 and #1120 and can be reviewed in any order.

Receipt

  • Environment, with the TensorFold commit, MLX or PyTorch version, machine and GPU, checkpoint and revision: 73249c5acbc412bfee22d94309cf46b659b6409b on d1018b318fb51981c4a18f12e40269a4d3ee9713. Native CUDA binaries built from this branch, with no MLX or PyTorch, on one CUDA GPU in an aarch64 Linux host. The checkpoint is fishaudio/drama-3 with its codec.pth. The GPU receipts do not record the checkpoint revision, the driver or the library versions. "Stock" is the v1.1.1 release, and git diff v1.1.1 d1018b31 -- zig build.zig build.zig.zon is empty.
  • Exactness, from tools/bench_concurrent.py --alone --serial or token_sha against "draft": false: speech returns PCM, not tokens, so PCM is compared instead. Every server ran with --parallel 1 --no-drafts --prompt-cache-gib 0 --context 4096 and TENSORFOLD_SEED_SALT=0, and every input was "A small cloud passes."
    • Built-in voice: this branch without --voices equals stock byte for byte (196,608 bytes each, same SHA-256).
    • Synthetic voice: one second of a 220 Hz sine, encoded with drama3-generate --encode (22 frames) and served from a catalog file with source.kind synthetic. drama3-generate was run with the same codes and transcript, --max-frames 1024, temperature 1, top-k 30, top-p 0.9, and the seed the server derives from the 73 prompt rows. The HTTP and CLI outputs have the same length (135,168 bytes) and differ by at most 1 LSB per sample. They are not byte-equal. The writers quantize differently: the server truncates float samples toward zero (@intFromFloat(clamp(x) * 32767), quantizeInPlace in zig/src/server/speech.zig), while the CLI rounds them (@round, pcm16 in zig/src/families/drama3/wav.zig). Equal float samples can therefore differ by 1 LSB. This comparison does not establish equality before quantization. The difference is consistent with truncation versus rounding but does not prove that is the only cause. This PR changes neither writer.
  • Decode speed before and after, from tools/bench_openai.py: not measured. Decoding and GPU kernels are unchanged. Peak device memory was the same for stock, the built-in voice and the synthetic voice.
  • Prompt speed before and after: the cold first request's ttft_s from tools/bench_cache.py --require-cold on a long prompt, or "n/a" with the reason when the change cannot reach prompt processing: not measured. Built-in voice prompt rows are unchanged. A named voice adds its reference rows to the prompt, and the existing prefill processes them.
  • Tests run, with pass, fail and skip counts: all reported counts are from uncached runs at 73249c5a. The CUDA-host gate was rerun with a separate cache after an initial run reused cached results.
    • zig fmt --check build.zig zig: clean.
    • zig build test -j8 --summary all: 211/211 steps; 2964/2978 tests passed, 0 failed, 14 skipped. The server suite passed 511/511, including the five new tests.
    • CUDA_VISIBLE_DEVICES= zig build test-cuda-host -j8 --summary all: 129/129 steps; 2183/2188 tests passed, 0 failed, 5 skipped.
    • CUDA_VISIBLE_DEVICES= zig build test-kernel-contract -j8 --summary all: 11/11 steps; 65/65 tests passed.
    • CUDA_VISIBLE_DEVICES= zig build test-golden -j8 --summary all: 5/5 steps. Server cases: 306/319 equal with 13 known differences. Security cases: 26/26 equal. 0 unexpected differences.
  • Not run, and why: Metal, HIP and XPU builds and devices, because only one CUDA host was available. Concurrent and drafted speech, and bench_openai/bench_cache timings, were not run. No recorded human voice was used.

Checklist

  • Every token still goes through the lane rounds. No serial path, and nothing that needs drafts off.
  • Drafted output equals "draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.
  • No precision traded for speed. If the bits change, the description says which sums change and why.
  • A new or changed GPU kernel is registered with the kernel contract (docs/kernel-contract.md); each backend's SUMMARY line is in the receipt.
  • Prompt processing is no slower than the last release.
  • The description says which platforms I ran, Metal M1 to M5 and CUDA, and which I could not.
  • New tests fail before the change, pass after it, and skip cleanly without their dependency.
  • Comments and docstrings are one line. No measurements or history in the source.
  • No personal data, machine names, internal hosts or local paths. No AI attribution lines.

@ashhart

ashhart commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Landed on main with #1153 (23573d3, b7f4666, 02e9660, 35b2afb), thank you @plotarmordev. Opt-in attested voice catalogs are served with --voices, --default-voice and GET /v1/voices. Requests pick voices by validated name only, never by path, and the server and speech host tests pass on current main.

- Synthema, Ash's AI Assistant.

@ashhart

ashhart commented Oct 24, 2026

Copy link
Copy Markdown
Owner

This shipped in TensorFold 1.1.4: https://github.com/ashhart/TensorFold/releases/tag/v1.1.4

Thank you @plotarmordev for the contribution.

- Synthema, Ash's AI Assistant.

@ashhart ashhart added the landed Landed on main by the maintainers; the commits keep the contributor's authorship label Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

landed Landed on main by the maintainers; the commits keep the contributor's authorship

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants