I fit a 24 kHz bilingual TTS into 1.49M parameters. Then I let an AI agent edit its weights.
Moving English–Nepali phonology out of the network got a full 24 kHz TTS, vocoder included, down to 5.98 MB and 1.11 ms per chunk. Then Gemini 4 Neon tried editing its weights directly, under proper controls.
Most text-to-speech models these days are secretly language models. Hundreds of millions of parameters, neural audio codecs, autoregressive token loops. They sound amazing on a datacenter GPU. They're also useless if you want natural Nepali, English, and the Nepali–English mix people actually speak, running locally on a laptop CPU or a phone.
So I went the other way, as far as I could: what if you throw out the language model entirely, move all the linguistics into a frontend with zero learned parameters, and let the neural network do acoustics and nothing else?
That became PAWP-TTS (Phoneme-Aware Weight Programming). Counting every learned tensor you need at inference, waveform decoder included, PAWP-1.5M is 1,490,390 parameters. That's 5.98 MB as FP32 safetensors and 5.16 MB as a folded ONNX graph. It decodes a 60 ms chunk of audio in 1.11 ms on a 4-thread CPU, about 173× faster than real time. And a 281K-parameter sibling (1.12 MB) still stays intelligible in both languages.
Then there's the second half of the project, which honestly ended up being my favorite part: weight-space programming. That means reading a trained network's weights and editing them directly, with zero gradient steps, to fix pronunciation and timing bugs. I didn't do the edits myself. I handed that part to an AI research agent, Gemini 4 Neon, which designed and ran the edit experiments while I set the rules and checked the results. Once proper controls were in place, it mostly taught me how easy it is to fool yourself. Here's the whole story, including the parts that humbled me.
Don't take my word for it, though. The demo below runs the actual model, right here in your browser. Type anything in English, Nepali or both and hit Speak.
Weights and lexicon: PAWP-TTS, CC BY 4.0. Runtime: onnxruntime-web and eSpeak-ng (English phonemes), loaded only when you use the demo.
Why multilingual TTS gets Nepali wrong
Here's the boring truth before any neural nets show up: a lot of multilingual and Indic TTS treats Nepali like Hindi with different words. Native speakers hear the difference instantly.
Everyday Kathmandu Nepali has:
- One /s/ for three letters.
स,शandषall collapse to/s/in normal speech, not Hindi's/ʃ/. - Alveolar affricates (
/ts, tsʰ, dz, dzʰ/) where Hindi has postalveolars. - Gemination that changes meaning.
पाताandपत्ताare different words. - A different inherent vowel, open-mid back unrounded instead of Hindi's central schwa, plus its own schwa deletion and retroflex flapping rules.
- English dropped in mid-sentence, all the time: "Flight ticket confirm भइसक्यो, बाँकी details म तिमीलाई WhatsApp मा पठाइदिन्छु।"
If you feed raw Devanagari and Latin characters into a tiny network, it has to spend a big chunk of its weights memorizing spelling rules, heteronyms and where one script ends and the other starts. A 1.5M-parameter model can't afford that.
Splitting the job: zero parameters for spelling, 1.49M for sound
So PAWP-TTS splits the problem down the middle.
The frontend is fully deterministic. Zero learned parameters, 0.16 ms per sentence. It splits the text into Devanagari and Latin spans, sends English through libespeak-ng (called in-process via ctypes, under 0.20 ms a sentence), and sends Nepali through Kathmandu phonology rules backed by a 105,868-word lexicon and 76 heteronyms with 152 readings. Everything lands in one shared 128-token IPA inventory, tagged with language, stress and word boundaries.
That leaves the whole neural budget for acoustics and the waveform:
Component Parameters Share-----------------------------------------------------------------------Embeddings & conditioning 18,432 1.2%Text encoder (4 ConvNeXt1D + language residuals) 366,608 24.6%Variance predictors (dur, F0, voicing, energy) 62,372 4.2%Acoustic network + mel head 378,208 25.4%Waveform decoder (ConvNeXt1D + 24 kHz iSTFT) 664,770 44.6%-----------------------------------------------------------------------Total deployed inference graph 1,490,390 100.0%Look where almost half the model lives: 44.6% of the parameters are in the iSTFT waveform decoder. Once you go below 2M parameters, the vocoder is the last thing you should starve.
Two more choices keep it fast and stable. Every depthwise convolution looks at most one frame (10 ms) into the future, so chunked streaming works. And durations come from an explicit predictor trained on CTC forced alignments, with no autoregressive attention, so the model can't skip words, repeat phrases or make up an ending.
Language-gated weights (that fold away for free)
To get one small backbone to speak English, Nepali and the mix without the two languages fighting over the same weights, every pointwise projection in the encoder and acoustic blocks gets language-gated low-rank residuals:
Each is a rank-16 residual for one language, and the masks and come straight from the frontend's script router. In a code-mixed sentence the gates flip at exactly the token where the language switches.
The nice bonus: if you only need one language, the residual folds into at export time. Zero extra ops at inference.
def forward( self, x: torch.Tensor, lang_masks: torch.Tensor | None = None,) -> torch.Tensor: """ Forward pass on `(B, T, in_features)` with optional `(B, T, 2)` `[m_en, m_ne]` gates. """ out = F.linear(x, self.weight, self.bias) if self.residual_rank <= 0 or lang_masks is None: return out m_en = lang_masks[..., 0:1] m_ne = lang_masks[..., 1:2] if torch.any(m_en != 0): res_en = F.linear(F.linear(x, self.v_en), self.u_en) out = out + (m_en * self.gate_en) * res_en if torch.any(m_ne != 0): res_ne = F.linear(F.linear(x, self.v_ne), self.u_ne) out = out + (m_ne * self.gate_ne) * res_ne return out def fold_language(self, language: Literal["en", "ne"]) -> nn.Linear: """Materialize dense monolingual weights `W_shared + g_lang * U_lang @ V_lang`.""" folded = nn.Linear(self.in_features, self.out_features, bias=self.bias is not None) with torch.no_grad(): merged = self.weight.detach().clone() if self.residual_rank > 0: if language == "en": merged = merged + self.gate_en.detach() * ( self.u_en.detach() @ self.v_en.detach() ) else: merged = merged + self.gate_ne.detach() * ( self.u_ne.detach() @ self.v_ne.detach() ) folded.weight.copy_(merged) if self.bias is not None and folded.bias is not None: folded.bias.copy_(self.bias.detach()) return foldedOne training trick mattered way more than I expected: scheduled sampling on prosody. On half of all training steps, the acoustic network gets its own predicted pitch and energy instead of the ground truth. Without it, the model sounds crisp on teacher-forced validation and flat when you actually use it. With it, that gap mostly went away.

The biggest win wasn't an architecture change
Before the small models and the weight editing, I want to show the single biggest jump in the whole project. It wasn't a clever layer or a new loss.
My early runs (v2) trained on a feature cache I'd built before the final Nepali lexicon and the व → /b/ rule existed. So the phoneme labels and CTC durations in the cache came from an older frontend than the one I used at inference. The model was quietly learning from labels that disagreed with what it would see later.
When I rebuilt the whole 136,807-utterance cache (v3), retrained the CTC aligner (loss went from about 1.0 to 0.614) and re-extracted the durations:
- Single-frame duration collapses dropped by about 3×.
- On 300 Nepali test utterances,
वwords wrongly pronounced with/w/instead of/b/went from 55.1% (65/118) to 0.0% (0/118). - Nepali validation PER nearly halved, 7.06% → 3.96%, and English went 5.29% → 4.33%.
Fixing a silent version mismatch between the frontend and the cache did more than every architecture tweak and weight edit combined. Even worse: before I caught it, those व errors looked exactly like a neural bug. A whole weight-editing experiment had already gone into trying to "surgically repair" something that was really a data problem.
The aligner that makes the duration labels also got better: CTC loss about 1.0 → 0.614.
How small can it go? 1.49M vs. 281K
Training data was about 219 hours of speech: 77 h of English LibriSpeech, 108 h of Nepali studio and read speech (including OpenSLR) and 34 h of code-mixed speech. On top of that sits a single-voice bilingual target corpus, synthesized by a fine-tuned OmniVoice teacher and filtered with an independent ASR model (CER ≤ 0.10 for English, ≤ 0.12 for Nepali). Everything trained in BF16 on one RTX 4090.
Once PAWP-1.5M worked on v3, I wanted to find the floor. First I tried the lazy route, one-shot SVD compression of the 1.5M model (EXP-010). It fell apart completely by 500K parameters without retraining. You can't just slice a model down and hope.
So I trained two 281K-parameter models from scratch on v3, same recipe, 36k steps each, and repeated both with three seeds (42, 101, 202):
- Shared-300K shares weight bases across depth: 281,078 unique parameters (328,158 once materialized),
1.12 MB. - Dense-300K has no sharing at all: 281,442 parameters,
1.13 MB.
Here's everything on clean v3 data. The ASR columns are held-out live recognition (n=30 English, 30 Nepali, 9 code-mixed, seed 42), shown next to the score real human recordings get, as an intelligibility check rather than a naturalness one. The last column is phoneme error on 600 untouched test utterances, as the mean ± std over the three seeds for the 281K models.
Model (v3) Unique Params FP32 EN WER/CER NE WER/CER Mix WER/CER Test NE / EN PER------------------------------------------------------------------------------------------------------Human Floor (ASR) --- --- 2.63 / 0.75 11.60 / 3.82 25.91 / 12.88 ---PAWP-1.5M v3 1,490,390 5.98M 4.02 / 1.50 12.35 / 1.75 12.32 / 5.32 5.04% / 4.02%PAWP-300K Shared 281,078 1.12M 6.88 / 2.93 19.71 / 5.93 12.02 / 5.01 6.35±0.11 / 6.57±0.47%Dense-300K 281,442 1.13M 6.15 / 2.42 20.21 / 6.59 18.09 / 9.01 5.53±0.08 / 5.34±0.28%Two things jumped out:
- 281K parameters really does speak both languages. With 5.3× fewer parameters than
PAWP-1.5M,Dense-300Kaverages 5.53% Nepali PER and 5.34% English PER on the 600 test utterances across three seeds, and tells apart 79.2% of my 77 Nepali/bilingual minimal pairs. - Plain dense beat weight sharing on the big test set.
Shared-300Kwas slightly ahead on validation mel loss and on the tiny 9-sentence code-mix set. But on the 600 untouched test utterances,Dense-300Kwon on all three seeds in both languages, with no overlap: 0.82 pp better on Nepali PER and 1.23 pp on English, on average (paired bootstrap on seed 42, ). Sharing weights across layers just doesn't pay at this size.
On speed (4-thread x86_64 CPU, folded 5.16 MB ONNX), a 60 ms chunk takes 1.11 ms at the median and 1.52 ms at p99. That's 173.36× real time (RTF 0.0058), and the output matches the PyTorch streaming waveform with cosine similarity between 0.987 and 0.99998. To be clear about what that measures: it's per-chunk compute after the sentence is encoded. True end-to-end streaming latency is still on my list.
Dense-300K beats Shared-300K on all three seeds: 0.82 pp better in Nepali and 1.23 pp in English on average. 281K rows show the mean ± std over seeds 42, 101, 202.
Lower is easier to understand. This measures intelligibility, not how natural the voice sounds.
Weight-space programming: what actually held up
Now the wild part. Inspired by weight-space programming and ROME-style rank-one model editing, I wanted to know: can you look inside a trained TTS network and patch a pronunciation or timing bug with zero training, without breaking the other language?
Instead of hand-crafting edits myself, I gave this whole track to Gemini 4 Neon as a research agent. It read activations, proposed edits, applied them and ran the evaluations. My job was the rules of the game and deciding what counted as a real result.
The first round (EXP-009) was an unconstrained weight transplant. On my small held-out ASR set it took code-mix WER from 11.99% to 9.93%. Looked exciting. But that edit had been picked while looking at the test set, which is a great way to fool yourself, and the gain was within noise anyway. So I locked everything down before the agent ran anything else:
- Hyperparameters chosen on
val.jsonlonly. - Evaluated once on the untouched
300 Nepali + 300 Englishtest set. - Paired-bootstrap 95% confidence intervals.
- Two controls every time: a random edit with the same norm in the exact same weights, and gradient fine-tuning of the exact same parameters.
Three experiments came out of that.

1. Shared edits hurt everything; language residuals isolate perfectly
In EXP-013a, an unconstrained rank-1 edit to the shared weight acoustic_blocks.3.pw2.weight fixed the targeted confusion but made overall PER worse in both languages (Nepali +1.22%, English +1.75%). And when I checked which words those /b/ → /w/ errors came from, 90.3% (65/72) were व words, the stale v2 cache problem from earlier. I'd been editing weights to fix bad data.
Compare that with EXP-017: a ROME null-space rank-1 edit placed strictly inside the Nepali-only residual encoder_blocks.0.pw2.{u_ne, v_ne} (6,144 parameters, 0.41% of the model). English collateral was exactly 0.000%, by construction, and Nepali PER didn't move (5.036% → 5.026%, ). The language residuals really do behave like separate circuits.

2. 27:1 surgical selectivity on pauses, beaten by a single scalar
On clean v3 validation data (EXP-016), word-boundary <sp> pauses came out too short (6.16 frames predicted vs. 10.38 real). And at the 96-dim input to duration_predictor.proj.weight, pause tokens were 90.8% linearly separable from normal phonemes. Those are just 96 weights, 0.0064% of the model:
class DurationPredictor(nn.Module): """Predicts log-duration per phonological token.""" def __init__(self, d_model: int = 128, hidden: int = 96, kernel_size: int = 3) -> None: super().__init__() self.block1 = _DWSepPredictorBlock(d_model, hidden, kernel_size) self.block2 = _DWSepPredictorBlock(hidden, hidden, kernel_size) self.proj = nn.Linear(hidden, 1) def forward(self, x: torch.Tensor) -> torch.Tensor: """Return positive predicted frame durations `(B, L)` from `(B, L, D)`.""" h = self.block2(self.block1(x)) log_dur = self.proj(h).squeeze(-1) return F.softplus(log_dur)The agent's ROME-whitened rank-1 update to those 96 weights did something genuinely cool. On untouched test data it made pauses 1.001 frames longer while regular phonemes moved only 0.037 frames. That's 27:1 selectivity. It cut deletions (19 fewer in Nepali, 21 in English) and beat gradient fine-tuning of the same 96 weights (4.93% vs. 5.55% Nepali PER).
Then the random control humbled us both. A random edit with the same norm in those same 96 weights scored 4.84% Nepali PER (), better than the surgical edit (4.93%, ).
How does random beat 27:1? I went through all 13,450 phonemes in 169 Nepali validation utterances, class by class, and found it: every single phoneme class was predicted 3.5% to 13% too short. Overall it was −7.3% (6.105 predicted vs. 6.585 real frames). That's Jensen's inequality, from training durations in the log domain. Any edit that happened to stretch durations a bit was going to help.
So I tried the dumbest baseline possible: change one number, duration_predictor.proj.bias. I picked the shift on validation only (+0.10) and ran it once on the test set. This comparison has its own evaluation baseline, and Nepali PER went from 4.744% to 4.513% (−0.27 pp, 95% CI [−0.41, −0.12], ) with no English regression (4.044% → 4.016%, ). One scalar beat 96-weight ROME and 96-weight fine-tuning, and it points straight at the real fix: correct for the bias in the duration loss during training.
3. When the "model error" is just how people talk
After v3, the most common remaining Nepali substitution on validation was the retroflex nasal /ɳ/ coming out as dental /n/ (EXP-017). Before blaming the weights again, I ran the aligner on the real human studio recordings in the test set: 62 occurrences across 52 utterances.
The humans said ण as dental /n/ 90.3% of the time (56/62). That matches how linguists describe spoken Kathmandu Nepali: only three nasals actually contrast (/m, n, ŋ/), and ण is dental except right before a retroflex stop. The model had learned real spoken Nepali. My lexicon was the one being too literal about spelling.
Update: paper on arXiv and #1 & #3 on the Open TTS Leaderboard
Two quick updates since I first wrote this post.
First, the paper is officially out on arXiv: arxiv.org/pdf/2611.29455.
Second, I submitted both models to Hugging Face's Open TTS Leaderboard — and on CPU streaming (batch size 1, 3-sample warmup, timed across 497 utterances from CV3-Eval's English split), PAWP-300K landed at global rank #1 and PAWP-1.5M at global rank #3:
Rank Model TTFA p95 TTFA p50 RTFx Streaming Size (B)---------------------------------------------------------------------------------------- 1 Firoj112/pawp-tts-300k 4.4 ms 2.2 ms 172.00 yes 0.0003 3 Firoj112/pawp-tts-1.5m 6.0 ms 3.3 ms 75.08 yes 0.0015To keep the record reproducible, those leaderboard numbers come from commit 2356518 ("Optimize streaming inference with 30ms TTFA, comfort padding, and fast in-memory lexicon", built on the slim HF Jobs evaluation backend added in 699d027–cd3002f). Three small engineering changes did the heavy lifting:
- 3-frame initial micro-chunk (
30 mswindow): emitting the first audio chunk after 3 frames (720samples at24 kHz) instead of 6 cut end-to-end CPU TTFA down to2.2 ms/3.3 msp50. - In-memory fast English lexicon: O(1) dictionary lookup for common words so the frontend doesn't pay per-word G2P overhead on the hot path.
1.04×pacing calibration &80 mscomfort silence padding: relaxes tight consonant clusters and prevents startup pops or clipped final releases.

What I'm honest about
- No human listening (MOS) study yet. Live ASR (
n=30/30/9) and test-set PER measure intelligibility, not naturalness. You can judge the voice yourself in the comparisons. - One voice. Training is multi-speaker (1,815 speakers), but the exported model speaks as one fixed bilingual speaker. No voice cloning.
- The target voice is teacher-generated. The single voice was distilled from a fine-tuned TTS teacher, and how that affects perceived quality hasn't been measured yet.
- The lexicon isn't gold-audited. The 105,868 words are about 99% generated from rules and paradigms and haven't been checked against an independent native gold set. The
ण → /n/fix is queued forv4. - Streaming latency. The earlier
1.11 msnumber was per-chunk compute after encoding. The Hugging Face Open TTS Leaderboard now gives independent end-to-end CPU streaming TTFA (2.2 msp50 /4.4 msp95 forPAWP-300K;3.3 msp50 /6.0 msp95 forPAWP-1.5M, commit2356518). - The weight-edited checkpoint is older. The 1.5M release on Hugging Face is the
v3model behind these numbers, but the weight-editedE3checkpoint is still an earlierv2model.
Wrapping up
Two things stuck with me. First, you don't need a 500M-parameter language model for crisp 24 kHz bilingual and code-mixed speech. 1.49M parameters, vocoder included, runs at 75× real time end-to-end on CPU (and 281K hits 172× real time and 2.2 ms TTFA, good enough for #1 on Hugging Face's Open TTS CPU streaming leaderboard) when you give the vocoder most of the budget and keep the frontend deterministic.
Second, letting an agent poke at the weights is an amazing diagnostic tool, even when the edits lose to simple baselines. Gemini 4 Neon's experiments forced me to find a stale cache, a −7.3% duration bias and a lexicon rule that was too literal. Every one of those fixes belongs upstream, in the data, the loss or the frontend. I'd never have seen them so clearly without the weight edits first.
Code, ONNX graphs, weights, paper and audio samples are all open:
- Paper (arXiv): arxiv.org/pdf/2611.29455
- Open TTS Leaderboard (CPU Streaming #1 & #3): huggingface.co/spaces/hf-audio/open_tts_leaderboard
- Listen to comparisons: huggingface.co/spaces/Firoj112/pawp-tts-demo
- Code: github.com/Firojpaudel/PAWP_TTS (leaderboard commit
2356518) - Weights, 1.5M (v3): huggingface.co/Firoj112/pawp-tts-1.5m
- Weights, 300K: huggingface.co/Firoj112/pawp-tts-300k
- Weights, weight-edited E3 (v2): huggingface.co/Firoj112/pawp-tts-1.5m-wsp