# PAWP-TTS **Phoneme-Aware Weight Programming for Ultra-Compact Bilingual (English–Nepali) Neural Speech Synthesis**

Live In-Browser Demo Live Audio Demo Paper PDF PAWP-1.5M Model PAWP-300K Model

Parameters Independent PER Code-mix WER Browser TTS ONNX Latency Sample Rate License

PAWP-TTS: a whole voice in 5.98 MB or 1.12 MB

--- PAWP-TTS investigates how few neural parameters are required for natural, streaming, bilingual **English**, **Nepali**, and **English–Nepali code-mixed** speech when deterministic linguistic knowledge is moved to the frontend and an AI agent (**Gemini 4 Neon**) can inspect and program trained network weights directly ([weight-space programming](https://rikiyat.github.io/blog/weight-space-programming/)). The deployed `PAWP-1.5M` inference graph — **neural iSTFT vocoder included** — totals **1,490,390 parameters** (`5.98 MB` FP32 safetensors; `5.16 MB` folded ONNX) and outputs **24 kHz** audio with single-digit millisecond streaming time-to-first-audio (TTFA). > **Research repository.** Every reported number is tied to a logged experiment in [docs/EXPERIMENTS.md](docs/EXPERIMENTS.md) and [docs/BENCHMARKS.md](docs/BENCHMARKS.md). --- ## Pretrained Releases (Hugging Face) | Release | Hugging Face | Footprint | Highlights | | :--- | :--- | :---: | :--- | | **`PAWP-1.5M` Polished Default** (`EXP-012`) | [Firoj112/pawp-tts-1.5m](https://huggingface.co/Firoj112/pawp-tts-1.5m) | `5.98 MB` FP32 / `5.16 MB` ONNX | Smoothest single-speaker voice timbre (`4.86%` EN, `11.41%` NE, `10.99%` Code-Mix WER) | | **`PAWP-1.5M` Weight-Space Programmed** (`EXP-009`, `WSP-E3`) | [Firoj112/pawp-tts-1.5m-wsp](https://huggingface.co/Firoj112/pawp-tts-1.5m-wsp) | `5.98 MB` FP32 / `5.16 MB` ONNX | Preliminary zero-training weight transplant by Gemini 4 Neon (test-selected; see AUDIT-002) (`3.3%` params edited): `9.93%` NE WER, `9.93%` Code-Mix WER, `0.00%` NE drift | --- ## Audio Samples (24 kHz, Unedited Outputs)

Open Instant Audio Player

All samples below were synthesized directly from our default polished checkpoint ([Firoj112/pawp-tts-1.5m](https://huggingface.co/Firoj112/pawp-tts-1.5m)): | Language / Type | Text | 24 kHz Audio | | :--- | :--- | :---: | | Nepali (Natural) | नेपालको प्राकृतिक सौन्दर्य र अग्ला हिमाल हेर्न संसारभरिबाट मानिसहरू आउँछन्। | [![Play WAV](https://img.shields.io/badge/Play_WAV-4.9s-1F6FEB?style=flat-square)](https://huggingface.co/Firoj112/pawp-tts-1.5m/resolve/main/samples/ne_nature.wav) | | Nepali (Phonology: gemination & `/s/`) | पाता र पत्ता अनि शहर र सहरको उच्चारण मानक नेपालीमा स्पष्ट सुनिन्छ। | [![Play WAV](https://img.shields.io/badge/Play_WAV-4.8s-1F6FEB?style=flat-square)](https://huggingface.co/Firoj112/pawp-tts-1.5m/resolve/main/samples/ne_phonology.wav) | | English (Technical) | Neural speech synthesis can now run completely on edge devices with very low latency. | [![Play WAV](https://img.shields.io/badge/Play_WAV-5.5s-1F6FEB?style=flat-square)](https://huggingface.co/Firoj112/pawp-tts-1.5m/resolve/main/samples/en_edge.wav) | | English (Expressive) | The sudden change in the weather made the evening walk surprisingly refreshing. | [![Play WAV](https://img.shields.io/badge/Play_WAV-4.6s-1F6FEB?style=flat-square)](https://huggingface.co/Firoj112/pawp-tts-1.5m/resolve/main/samples/en_weather.wav) | | Code-Mixed (Everyday) | Flight ticket confirm भइसक्यो, बाँकी details म तिमीलाई WhatsApp मा पठाइदिन्छु। | [![Play WAV](https://img.shields.io/badge/Play_WAV-5.3s-1F6FEB?style=flat-square)](https://huggingface.co/Firoj112/pawp-tts-1.5m/resolve/main/samples/codemix_flight.wav) | | Code-Mixed (Technical) | आज हाम्रो team ले नयाँ AI model deploy गर्‍यो, performance एकदमै smooth देखिन्छ। | [![Play WAV](https://img.shields.io/badge/Play_WAV-5.4s-1F6FEB?style=flat-square)](https://huggingface.co/Firoj112/pawp-tts-1.5m/resolve/main/samples/codemix_deploy.wav) | Additional `WSP-E3` samples with native inline audio players are also hosted on [Firoj112/pawp-tts-1.5m-wsp](https://huggingface.co/Firoj112/pawp-tts-1.5m-wsp). --- ## Benchmark Results ### 1. Current Results (`v3`, independent re-scoring) The training-time metrics are partly circular: the PER recognizer also produced the training durations, and the primary ASR also filtered the synthetic training corpus. All current checkpoints were therefore re-scored with **two recognizers that played no part in training or data filtering**: a second mixed-script ASR, and the public [`wav2vec2-xlsr-53-espeak-cv-ft`](https://huggingface.co/facebook/wav2vec2-xlsr-53-espeak-cv-ft) phone recognizer, with both sides mapped to a shared 39-phone set. See [EXP-018/019](docs/EXPERIMENTS.md). | Model | EN CER (`n=30`) | NE CER (`n=30`) | EN PER (`n=300`) | NE PER (`n=300`) | Code-Mix WER / CER (`n=160`) | | :--- | :---: | :---: | :---: | :---: | :---: | | Human recordings | `0.68%` | `22.65%` | `13.44%` | `34.12%` | — | | **`PAWP-1.5M` v3** | `2.35%` | `19.46%` | `15.14%` | `38.10%` | `18.13% / 8.80%` | | `PAWP-300K` Shared (3 seeds) | `4.10 ± 0.52%` | `21.07 ± 1.93%` | `16.28 ± 1.14%` | `40.51 ± 0.42%` | `18.78% / 9.35%` | | `Dense-300K` (3 seeds) | `2.44 ± 1.20%` | `20.18 ± 0.78%` | **`14.83 ± 0.32%`** | **`38.69 ± 0.62%`** | `18.78% / 9.00%` | How to read this table: - **No synthetic system beats the human recordings** under independent recognizers. An earlier below-human CER was an artifact of the circular recognizer. - **The independent recognizers are weak on Nepali** (human CER 22.65%, human PER 34.12%). Absolute Nepali numbers are coarse; compare models pairwise. - **At equal unique parameters (281K), dense beats shared-basis** on phone error in all 6 seed × language pairs (paired t-test p = 0.010, Wilcoxon p = 0.031) and on code-mix PER in 3/3 seeds. - **Code-mix set:** 160 new sentences, 4.7 language switches per sentence, no textual overlap with training data. It is released at [`data/evaluation/codemix_v1.jsonl`](data/evaluation/codemix_v1.jsonl). - **No listening test (MOS) has been run yet.** Reproduce with `make eval-independent` and `make eval-codemix`.
Earlier results (pre-v3, single training-time recognizer, small sets; superseded) | Model / Checkpoint | English WER / CER (`n=30`) | Nepali WER / CER (`n=30`) | Code-Mixed WER / CER (`n=9`) | | :--- | :---: | :---: | :---: | | Human Studio Recordings | `2.63% / 0.75%` | `11.60% / 3.82%` | `25.91% / 12.88%` | | `PAWP-1.5M` Base ([EXP-007](docs/EXPERIMENTS.md)) | `3.14% / 1.01%` | `12.02% / 3.12%` | `16.18% / 11.02%` | | `PAWP-1.5M` Target Voice ([EXP-008-FT](docs/EXPERIMENTS.md)) | `5.03% / 2.28%` | `9.93% / 1.97%` | `11.99% / 4.92%` | | `PAWP-1.5M` Polished ([EXP-012](docs/EXPERIMENTS.md)) | `4.86% / 2.79%` | `11.41% / 2.66%` | `10.99% / 4.10%` | | `PAWP-1.5M` + WSP `E3` (test-selected, preliminary; [EXP-009](docs/EXPERIMENTS.md)) | `5.03% / 2.20%` | `9.93% / 1.97%` | `9.93% / 3.97%` | This recognizer also filtered the training corpus, so these numbers overstate intelligibility relative to human speech.
### 2. Streaming Latency & ONNX Parity Per-chunk compute after the utterance is encoded (end-to-end streaming time-to-first-audio is not yet measured). Running the code-mixed graph (both language residuals active, not folded) adds +29% at 1.5M (1.24 ms vs 0.96 ms per 60 ms chunk) and +17–19% at 281K ([EXP-019](docs/EXPERIMENTS.md)). Folded monolingual ONNX streaming graphs (`5.16 MB` FP32 each) match PyTorch streaming waveforms to `MAE = 0.000155–0.001389` (`cosine = 0.987–0.99998`): | Backend | Hardware | Streaming TTFA (`p50 / p95 / p99`, 60 ms chunk) | Real-Time Factor (`RTFx / RTF`) | | :--- | :--- | :---: | :---: | | ONNX Runtime (CPU, folded) | CPU (4 threads) | `1.11 / 1.42 / 1.52 ms` | `173.36x` (`0.0058`) | | PyTorch (CPU, folded) | CPU (4 threads) | `3.26 / 3.86 / 4.21 ms` | `74.49x` (`0.0134`) | | PyTorch (CUDA, folded) | NVIDIA RTX 4090 | `3.30 / 3.67 / 3.72 ms` | `96.36x` (`0.0104`) | --- ## Project Milestones | Milestone | Scope | State | | :--- | :--- | :--- | | M1 | Clean Architecture bootstrap, unified 128-token EN/NE phoneme inventory, rule-based Nepali + code-mix G2P, 1.5M blueprint | done | | M2 | Bilingual manifests and leak-free splits, eSpeak English G2P, ONNX chunked streaming path, MR-STFT + MPD/MRD losses | done | | M3 | 105,868-word Kathmandu lexicon (300/300 lexicon self-consistency check; native gold set pending), CTC forced-alignment durations, 92k base + 20k target-voice FT + 10k phase polish | **done** ([EXP-007](docs/EXPERIMENTS.md), [EXP-008-FT](docs/EXPERIMENTS.md), [EXP-012](docs/EXPERIMENTS.md)) | | M4 | Agent-driven weight-space programming (`EXP-009`, Gemini 4 Neon), zero-shot compression frontier (`EXP-010`), and `PAWP-300K` (`281K` unique params, `0.28 MB` INT8) shared-basis training (`EXP-011`) | **done** (EXP-009–017; dense beats shared-basis at 281K, weight edits gave no gain beyond controls) | | M5 | Trained ONNX FP32 export & parity verification, public Hugging Face model cards & audio releases | **done** ([pawp-tts-1.5m](https://huggingface.co/Firoj112/pawp-tts-1.5m), [pawp-tts-1.5m-wsp](https://huggingface.co/Firoj112/pawp-tts-1.5m-wsp)) | --- ## Architecture ### End-to-End Pipeline ```mermaid flowchart LR T(["Text
EN · NE · code-mixed"]) subgraph FRONTEND ["Deterministic frontend (0 learned parameters)"] R{"Script & language
span router"} R -->|Latin| EN["English G2P
(eSpeak NG)"] R -->|Devanagari| NE["Nepali G2P
(105k lexicon, heteronyms,
schwa syncope, gemination, स/श/ष -> s)"] EN --> U["Unified phoneme tokens
phoneme · language · stress · boundaries"] NE --> U end subgraph BACKEND ["Neural synthesis backend (1.49M parameters)"] M["PAWP-1.5M Architecture
text encoder · variance adaptor ·
acoustic net · iSTFT decoder"] end W(["24 kHz waveform"]) T --> R U --> M M --> W ``` ### `PAWP-1.5M` Parameter Breakdown

PAWP-TTS architecture: (a) model overview with parameter counts, (b) language-gated ConvNeXt1D block with English/Nepali low-rank residuals, (c) iSTFT waveform head

| Component | Parameters | Share | | :--- | ---: | ---: | | Embeddings and conditioning | 18,432 | 1.2% | | Text encoder (4 ConvNeXt1D blocks + language residuals) | 366,608 | 24.6% | | Duration, pitch, voicing, energy predictors & length regulator | 62,372 | 4.2% | | Acoustic network + mel head | 378,208 | 25.4% | | Waveform decoder (ConvNeXt1D + iSTFT, Vocos-style) | 664,770 | 44.6% | | **Total deployed inference graph** | **1,490,390** | **100%** | **Core design choices:** - **Non-autoregressive & parallel:** Explicit CTC-aligned durations eliminate skipped, repeated, or hallucinated words. - **Bounded lookahead (`10 ms`):** Every depthwise convolution looks at most 1 frame into the future for low-TTFA chunked streaming. - **Language-gated residuals:** Shared weights carry general acoustics while compact low-rank `EN` and `NE` residuals switch per token (`m_en(t)`, `m_ne(t)`), enabling code-mixing and zero-drift surgical weight-space edits. For monolingual deployment, residuals fold into dense weights at load time with zero overhead. --- ## Code Layout (Clean Architecture) `interfaces -> application -> domain <- infrastructure`, enforced by `import-linter` in `make check`: | Layer | Contents | | :--- | :--- | | [`domain/`](src/pawp_tts/domain/) | Entities, Nepali phonology rules, PAWP budget allocators, metrics, ports (zero ML or I/O imports) | | [`application/`](src/pawp_tts/application/) | Framework-free use cases (phonemization, audits, evaluation orchestration) | | [`infrastructure/`](src/pawp_tts/infrastructure/) | PyTorch models, data/feature pipelines, trainer, ASR adapters, ONNX streaming, experiment ledger | | [`interfaces/`](src/pawp_tts/interfaces/) | DI container and the thin `pawp` CLI used by every `make` target | --- ## Quick Start ```bash git clone https://github.com/Firojpaudel/PAWP_TTS.git cd PAWP_TTS make setup # uv environment (Python 3.12, PyTorch, dev tooling) make check # format, lint, mypy --strict, import-linter, unit tests ``` Download pretrained weights from Hugging Face and synthesize speech: ```bash hf download Firoj112/pawp-tts-1.5m model.safetensors config.yaml --local-dir ./checkpoints/pawp-1.5m uv run pawp synth \ --checkpoint ./checkpoints/pawp-1.5m/model.safetensors \ --config ./checkpoints/pawp-1.5m/config.yaml \ --text "Flight ticket confirm भइसक्यो, बाँकी details म तिमीलाई WhatsApp मा पठाइदिन्छु।" \ --output codemix.wav ``` --- ## Documentation | Document | Purpose | | :--- | :--- | | [docs/EXPERIMENTS.md](docs/EXPERIMENTS.md) | Chronological experiment log (`EXP-001` through `EXP-019`, plus audits) | | [docs/BENCHMARKS.md](docs/BENCHMARKS.md) | 4-metric parameter footprint, latency, and quality scorecards | | [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) | Tensor-level model and PAWP specification | | [docs/DECISIONS.md](docs/DECISIONS.md) | Architecture decision records | | [docs/LITERATURE.md](docs/LITERATURE.md) | Related work | | [docs/NOVELTY.md](docs/NOVELTY.md) | Closest prior work and claimed deltas | | [docs/PHONOLOGY.md](docs/PHONOLOGY.md) | Kathmandu Nepali pronunciation rules and grammatical sources | --- ## License and Citation - **Code:** [Apache License 2.0](LICENSE). Keep the copyright and [NOTICE](NOTICE) when redistributing. - **Model weights, lexicon, documentation and audio samples:** [CC BY 4.0](MODEL_LICENSE.md). You may use them, commercially too, **with attribution to this project**. - **Please cite** PAWP-TTS if you use it (GitHub's *Cite this repository* button reads [CITATION.cff](CITATION.cff)): ```bibtex @software{paudel2026pawptts, author = {Paudel, Firoj}, title = {{PAWP-TTS}: Phoneme-Aware Weight Programming for Compact Bilingual English--Nepali Speech Synthesis}, year = {2026}, url = {https://github.com/Firojpaudel/PAWP_TTS} } ``` ## Scientific Integrity - Parameter counts always include every learned tensor required at inference time (decoder/vocoder included). - TTFA, RTF, and throughput are measured on real hardware and reported separately. - Weight-space programming edits are verified on held-out ASR against equal-norm random controls and rejected if they regress other metrics. - No "zero error" claim is made outside a defined evaluation set.