The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
VibeVoice-Realtime-0.5B → SIWIS French voice transfer (LoRA)
End-to-end artefacts for shifting microsoft/VibeVoice-Realtime-0.5B from its
built-in fr-Spk0_man.pt (MS Quebec) French voice to a metropolitan / SIWIS
style voice, via a tiny LoRA on tts_language_model.
Contains:
- Audio samples (8 test cases × {baseline, LoRA}) — what to listen to
lora_best.safetensors— the trained LoRA adapter (6 MB, rank 16)aligned_encoder.safetensors— the aligned 0.5B ↔ 1.5B encoder used to pre-tokenize SIWIS (1.37 GB)scripts/— the exact training + inference + diagnostic code we ran
TL;DR : LoRA on VibeVoice-Realtime only works if training mirrors the inference
pipeline. Concretely, you must load an MS voice prompt as past_key_values prefix
at training time. Training without a prefix produces a LoRA whose weight deltas
look fine (~1 % relative) but have zero audible effect because the training
regime is out-of-distribution vs. inference.
1. What we were trying to do
VibeVoice-Realtime-0.5B is a zero-shot voice-cloning TTS : you pass it a
voice_prompt.pt (a precomputed KV cache of a reference audio) plus text,
and it generates speech in that voice. It ships with 25 voice prompts across
13 languages. The built-in French prompt fr-Spk0_man.pt clearly sounds
Québécois to a European French ear, and we wanted a metropolitan French
voice closer to SIWIS.
Two obvious paths :
- Build a new voice prompt by passing a SIWIS reference audio through
the encoder +
language_model+tts_language_modelprefill flow → save the resulting KV cache as a.pt. - Fine-tune the model (LoRA) so that when it sees an existing MS voice prompt, it generates SIWIS-style output.
Path 1 is the "proper" way but internally VibeVoice's prefill flow for
tts_language_model is non-trivial to reproduce (see
microsoft/VibeVoice#117 and
the multiple create_voice_prompt_v{2..11}.py attempts in the Rcarvalo repo) :
our caches were statistically close to MS Quebec but diverged layer-by-layer by
3–14 %, giving broken audio.
Path 2 → this repo.
2. First attempt : why it failed (the lesson)
Setup
Standard LoRA on attention q/k/v/o of tts_language_model, rank 8, LR 3e-5,
10 epochs, 910 optimizer steps. Training forward was exactly the same as the
pre-existing training/vibevoice/train.py in the repo :
lm_out = model.model.language_model(inputs_embeds=text_embeds, use_cache=False)
tts_out = model.model.tts_language_model(inputs_embeds=seq_embeds, use_cache=False)
loss = ddpm_v_prediction_loss(..., tts_hidden, target_latents, ...)
Loss dropped 0.79 → 0.49 (val 0.4921), which looked healthy.
Inference gave zero audible change
We generated the 5 SIWIS test phrases. The LoRA-merged model produced audio indistinguishable from the base model — still Quebec.
Diagnostic
Ran scripts/diag_lora_merge.py, which snapshots 3 target weights before
merging and compares after :
Adapter state: 280 tensors (140 lora_A + 140 lora_B)
lora_B max_abs = 0.0137 (non-zero ⇒ training did update)
Merge: 140/140 layers merged, 0 missing
tts_language_model.layers.0.self_attn.q_proj.weight
delta norm = 0.148 (rel 0.8 %)
tts_language_model.layers.10.self_attn.q_proj.weight
delta norm = 0.109 (rel 0.6 %)
tts_language_model.layers.19.mlp.down_proj.weight
delta norm = 0.451 (rel 1.5 %)
So :
- LoRA weights did train (non-zero B)
- Merge into the base model did happen (140/140)
- Weight deltas are real but small (~1 % relative)
Something real changed in the weights yet no audible effect. Why ?
Root cause : training-inference regime mismatch
At inference, VibeVoice.generate() does :
all_prefilled_outputs = copy.deepcopy(voice_prompt) # ~323 tokens of frozen KV cache
outputs = model.generate(**inputs, all_prefilled_outputs=...)
The new tokens are prefilled on top of the voice prompt's past_key_values.
The attention patterns for new tokens therefore have ~323 "context" K/V
positions that were computed by the base model at MS training time —
completely out-of-distribution vs. what our LoRA saw during training
(use_cache=False, position 0, no prefix).
Our LoRA's updated q_proj projects new queries that attend over :
- The MS-Quebec cached K (untouched by LoRA — cached values are frozen .pt data)
- Newly computed K for the new tokens (LoRA-modified)
The LoRA was optimized to produce good latents on sequences starting from scratch, not on sequences anchored by a 323-token prefix. At inference, it operates OOD and its effect washes out.
3. What made the difference : prefix-conditioned training
One-line fix : at training time, load an FR voice prompt as
past_key_values for both language_model and tts_language_model, and
continue position_ids past the prefill length. Now training attention
patterns look exactly like inference attention patterns.
Concretely, the v2 training forward
See scripts/train_streaming_lora.py :: training_forward_with_prefix for the
canonical implementation. The only changes vs. v1 are marked ⭐ :
# ⭐ Clone the FR voice prompt's KV cache (one per model sub-module)
lm_past = clone_cache(voice_prompt["lm"]["past_key_values"])
tts_past = clone_cache(voice_prompt["tts_lm"]["past_key_values"])
lm_prefill_len = voice_prompt["lm"]["prefill_len"] # e.g. 118 tokens
tts_prefill_len = voice_prompt["tts_lm"]["prefill_len"] # e.g. 323 tokens
# --- language_model on new text, with FR prefix cache ---
text_embeds = model.model.get_input_embeddings()(text_ids)
# ⭐ Position IDs continue past the prefill
lm_position_ids = torch.arange(lm_prefill_len, lm_prefill_len + T_text, ...)
# ⭐ Attention mask covers prefill + new text
lm_attn_mask = torch.cat([torch.ones(B, lm_prefill_len), text_mask], dim=1)
lm_out = model.model.language_model(
inputs_embeds=text_embeds,
attention_mask=lm_attn_mask,
position_ids=lm_position_ids,
past_key_values=lm_past, # ⭐
use_cache=True, # ⭐
)
new_lm_hidden = lm_out.last_hidden_state
# --- tts_language_model on [new_text_hidden | speech_embs], with tts prefix cache ---
speech_embeds = model.model.acoustic_connector(speech_norm)
seq_embeds = torch.cat([new_lm_hidden, speech_embeds], dim=1)
seq_embeds = seq_embeds + model.model.tts_input_types(type_ids)
tts_position_ids = torch.arange(tts_prefill_len, tts_prefill_len + T_total, ...)
tts_attn_mask = torch.cat([torch.ones(B, tts_prefill_len), combined_mask], dim=1)
tts_out = model.model.tts_language_model(
inputs_embeds=seq_embeds,
attention_mask=tts_attn_mask,
position_ids=tts_position_ids,
past_key_values=tts_past, # ⭐ LoRA now learns to attend FR prefix context
use_cache=False, # don't accumulate
)
Only the last call has grad enabled (the LoRA lives inside tts_language_model).
Everything upstream (get_input_embeddings, language_model, acoustic_connector, tts_input_types) runs under no_grad.
Loss is the same DDPM v-prediction on the speech-position hidden states as in train_base.py.
Hyperparameters (final run)
| Knob | Value | Notes |
|---|---|---|
| LoRA targets | q_proj, k_proj, v_proj, o_proj of tts_language_model |
attention only, no MLP (to limit drift) |
| Rank / alpha | 16 / 32 (scaling = 2.0) | |
| Trainable params | 1.80 M / 675.73 M (0.267 %) | |
| Optimizer | AdamW, betas (0.9, 0.95), weight decay 0.01 | |
| LR | 5e-5, 30-step linear warmup, cosine to 10 % | |
| Epochs | 3 (540 opt steps, grad accum 8) | |
| Prefix sources | fr-Spk0_man.pt, fr-Spk1_woman.pt (FR only) |
random per step |
| Dataset | SIWIS French, 1444 train / 159 val | pre-tokenized with aligned_encoder.safetensors |
| GPU | 1 × RTX A5500 (24 GB) | ~6 min wall-clock |
Loss trajectory (3 epochs)
| Step | Train (batch) | Val |
|---|---|---|
| 50 | 0.70 | 0.6704 (first best) |
| 100 | 0.62 | 0.5871 |
| 150 | 0.58 | 0.5572 |
| 200 | 0.54 | 0.5425 |
| 300 | 0.53 | 0.5319 |
| 500 | 0.52 | 0.5187 (best) |
Δ val 0.67 → 0.52 (-0.15) — descent is continuous and not plateauing, which is a clear sign that the gradients are finally hitting the right components (vs. the v1 run where val loss barely moved once fitted to the no-prefix regime).
4. Results
Quantitative bench (500 SIWIS French phrases, full table in BENCHMARK.md)
| Metric | Baseline | LoRA SIWIS | Δ |
|---|---|---|---|
| WER mean | 16.31 % | 15.19 % | −1.12 pp ✅ |
| RTF mean | 0.4262 | 0.4302 | +0.004 (≈0) |
| NISQA-MOS mean | 2.848 | 3.770 | +0.922 ✅✅ |
Headline: no degradation on WER or RTF, +0.92 on NISQA-MOS. See
BENCHMARK.md for the full breakdown and raw per-phrase CSVs
under benchmark/.
Audible test (listen to the wav pairs)
- FR (4 cases) : voice clearly shifts from Quebec to SIWIS timbre ✅
- EN / JP / IT (4 cases) : speech remains intelligible but the LoRA
imposes the SIWIS timbre on top of the content — the multilingual speaker
diversity is lost. Acceptable for a FR-only deployment, not for a
multilingual app. Mitigations :
- Reduce rank to 8 (less capacity ⇒ less drift on non-FR contexts)
- Reduce merge scaling at inference from 2.0 to ~1.0
- Add non-FR samples in training for regularization (requires EN/etc. target data)
Latency / baseline guarantees
LoRA is additive. With scaling 0.0 the model is exactly the base model
bit-for-bit. With scaling 2.0 we get the SIWIS transfer. Merged weights on
disk are standard .safetensors — no extra inference latency, no architectural
change. Rolling back = reloading the base from_pretrained.
5. Repro
# 1) Install
git clone https://github.com/microsoft/VibeVoice.git && cd VibeVoice
pip install -e .[streamingtts]
# → gets transformers==4.51.3, vibevoice editable
# 2) Fetch SIWIS and pre-tokenize with the aligned encoder
python scripts/tokenize_data.py \
--audio-dir /path/to/SiwisFrenchSpeechSynthesisDatabase/wavs \
--transcripts /path/to/siwis_transcripts.jsonl \
--encoder-path aligned_encoder.safetensors \
--output-dir data/tokenized_siwis
# Split val off based on val_stems.txt (any ~10 % subset works)
python -c "
import shutil; from pathlib import Path
val_stems = set(Path('val_stems.txt').read_text().split())
src = Path('data/tokenized_siwis'); dst = Path('data/tokenized_siwis_val'); dst.mkdir(exist_ok=True)
for p in src.glob('*.pt'):
if p.stem in val_stems: shutil.move(str(p), str(dst / p.name))
"
# 3) Train — 3 epochs, ~6 min on a single A5500
python scripts/train_streaming_lora.py \
--data-dir data/tokenized_siwis \
--val-dir data/tokenized_siwis_val \
--output-dir outputs/lora_siwis \
--epochs 3 --batch-size 1 --grad-accum 8 \
--lr 5e-5 --warmup-steps 30 \
--lora-rank 16 --lora-alpha 32
# 4) Smoke test + generate samples
python scripts/gen_samples_lora.py \
--lora outputs/lora_siwis/lora_best.safetensors \
--out-dir samples/ --lora-rank 16 --lora-alpha 32
# 5) Anti-degradation check (fr/en/jp/it before vs after)
python scripts/test_anti_degradation.py \
--lora outputs/lora_siwis/lora_best.safetensors \
--out-dir samples_antidegrade/ --lora-rank 16 --lora-alpha 32
The scripts are standalone and import only vibevoice, transformers,
torch, safetensors, torchaudio. No custom training framework.
6. File inventory
README.md # this file
baseline_<label>.wav # 8 × base VibeVoice outputs
lora_<label>.wav # 8 × LoRA-merged outputs
# labels: fr_short_male, fr_medium_male,
# fr_practical, fr_female,
# en_short, en_medium, jp_short, it_short
lora_best.safetensors # 6 MB — rank-16 LoRA for tts_language_model
# (q/k/v/o on 20 layers = 80 LoRALinear)
aligned_encoder.safetensors # 1.37 GB — aligned 1.5B encoder for 0.5B decoder
# (needed to pre-tokenize SIWIS; see alignment/align_encoder_v3.py
# in the Microsoft VibeVoice repo)
scripts/
train_streaming_lora.py # ⭐ v2 prefix-conditioned training (the fix)
train_base.py # original no-prefix train.py (v1, failed — kept for reference)
tokenize_data.py # SIWIS wav → .pt via aligned encoder
gen_samples_lora.py # inference helper that merges LoRA at runtime
test_anti_degradation.py # generates 8 (baseline, lora) pairs across languages
diag_lora_merge.py # sanity check: does merging actually change weights ?
7. Credits & data
- Base model : microsoft/VibeVoice-Realtime-0.5B
- SIWIS : SIWIS French Speech Synthesis Database, Univ. of Edinburgh
- Aligned encoder training reference : microsoft/VibeVoice/alignment
- Downloads last month
- 31