Skip to content

server: expose per-request Drama speech sampling controls - #1277

Closed
krunkosaurus wants to merge 2 commits into
ashhart:mainfrom
krunkosaurus:drama-http/sampling-controls
Closed

krunkosaurus wants to merge 2 commits into
ashhart:mainfrom
krunkosaurus:drama-http/sampling-controls

Conversation

@krunkosaurus

@krunkosaurus krunkosaurus commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

What this changes

POST /v1/audio/speech accepts request-local temperature, top_p, top_k and exact unsigned 64-bit seed, including streamed and reference-conditioned speech. Omitted/null fields retain the existing 1.0/0.9/30 values and prompt-derived seeds. Fixes #1273.

Validation rejects wrong types, nonfinite/out-of-range values and positive parsed values that underflow when narrowed to f32. top_k is 1..64 across native backends. Seeds are parsed from integer text, including values above 2^53. Explicit redraw seeds add the existing take ordinal with u64 wrap; controls survive reference rebuilding, stripped prompts and silence/register redraws.

The public Sogni-AI/drama3-mlx API is the behavioral reference. This independently extends the native server; it does not copy Python implementation or change native sampling arithmetic.

Receipt

Base 2ff01910; Zig 0.17.0, macOS arm64. Scripted HTTP tests use synthetic PCM, not model inference.

  • Before production changes: 742/749 passed, 3 skipped, four override-route regressions failed as intended.
  • Final zig build test-server-cpu -j2 --summary all: server 742/745 passed, 3 skipped; JSON target passed/cached; 5/5 build steps.
  • Socket tests cover null/default settings and PCM, whole/streamed requests, exact u64 boundaries, malformed-input refusal before submission, reference/control-stripped redraws, wrapping seeds and combined silence/register retries.
  • Formatting and diff checks pass; no new lean findings.
  • Independent adversarial agent review found an overstrong float-documentation claim: shared JSON decoding has already converted ±1e-400 to signed f64 zero. The final contract explicitly validates parsed f64 values; HTTP tests accept those temperatures as zero and refuse them for top_p. Positive f64 values such as 1e-100 still cannot silently become f32 zero.
  • Full-model and Metal NVFP4 recipe backports compile and their focused suites pass. They preserve their existing prompt and CFG paths.

Repository-wide checks on speaker commit 945c797b reached 499/502 build steps and 5,862/5,897 passed tests, 34 skipped and one crash: unchanged test-pull-host aborts with macOS ISCONN. The untouched base reproduces 20/21 passed and one crash. Plain zig build reached 223/226 steps with one compilation failure: unchanged tf-flashnext-run assigns SharedEvent to Event; the untouched base reproduces it (50/53 steps). These are recorded failures, not passing whole-upstream receipts.

Draft qualification limit: no real-model determinism/audio identity, CUDA/Metal device comparison, acoustic listening or performance study. The local launcher memory floor was not met and was not overridden. Equal fields/seeds do not promise identical audio across backends or legacy RAS behavior.

During final CPU replays, two unchanged recall tests failed while the volume had about 3.3 GiB free, below their existing 4 GiB admission floor. Removing only task-created compiler caches restored 5.043 GiB; the identical commands passed with no source, environment or admission-guard change. Original failure receipts were retained.

Integration

ATC issue/session coordination and independent review completed. Merge-tree checks against #1268 introduce README/CHANGELOG conflicts only; native code merges cleanly, and the Metal recipe backport retains its CFG behavior. The oversized #728 file list was inspected in full (446 files); its 163 conflict paths against the base remain the same with this contribution. Unchecked PR pairs are not claimed clean.

  • Existing native request/scheduler/sampler path retained.
  • Exact integer parsing and actual submitted parameters tested.
  • Independent adversarial findings resolved.
  • No precision/kernel, weight or private-voice changes.
  • Real-model/device/listening qualification.

Pinned-engine packaging and user documentation: drama-tensorfold companion PR.

@ashhart

ashhart commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Landed on main in e19b807 and 9008255, thanks @krunkosaurus. We added 4a55624 on top: -0 and -1e-400 now reach the engine as +0, as the docs say (both were already greedy, so nothing audible changes), plus a changelog line.

Device check on an M3 Ultra with Drama 3, main against this stack: default requests give the same PCM byte for byte, every repeat equal (6/6) and concurrent equal to solo on both builds. Host suites pass. Per-request fields only change behaviour when a request sets them.

@ashhart ashhart closed this Oct 26, 2026
@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.

Drama speech: expose request sampling controls

2 participants