Skip to content
HenryZ838978Public

About

Retrieved Interventions: fix what frozen speech models know but cannot say — retrieve edits, not text. 7 models, 0 trained params. doi:10.5281/zenodo.24672318

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

RepRAG · Retrieved Interventions

The model knows it. It just can't say it. Don't ask it — edit it.

模型会,但说不出来;别问它,去改它。

DOI HF License

Paper (Zenodo) · PDF · Knowledge packs on 🤗 · Slides · Cite

RAG puts text in the prompt. RepRAG puts edits in the model's hidden states. It compiles a knowledge base into frame-level corrections, retrieves the ones that match what the model is hearing, and adds them to one mid layer of a frozen model.

  • No training. Model weights never change. To add knowledge, add references. Turn retrieval off and you get the original model back, bit for bit.
  • Text in, speech fixed. The knowledge base can be plain text. A multi-voice TTS turns the text into reference audio, and the audio is compiled into the store.
  • Seven speech models, one recipe. Error rates drop by 30–73% on targets the models claim but handle badly. Examples: Qwen3-ASR Greek 30.1 → 9.9, Qwen3-Omni Wu 40.8 → 15.3, Step-Audio 2 Wu 18.9 → 9.9.
  • Causal, dosed, bounded. Flip the sign of the edit and errors go up on every model. Each model has its own safety envelope, and we chart it.

How it works

from reprag.adapters.qwen3asr import Adapter
from reprag.inject import Injector
from reprag.store import Store

asr = Adapter(language="Chinese")                     # any frozen backbone with an adapter
inj = Injector(asr, layer=13)                         # one mid layer
inj.set_retrieve(Store.load("store.pt"), k=8, lam=2.0, tau=0.05)
asr.transcribe([asr.load_audio("wu.wav")])            # retrieved interventions, frame by frame
inj.off()                                             # gone: the original model

Why not just put it in the context?

Putting the right sentence in the prompt does help. Add 19 distractor sentences and it breaks: Wu CER goes to 128.7% because the model copies the context. The RepRAG store always holds about 900 "distractor documents" and still works, because retrieval happens frame by frame in activation space and there is no context to copy.

A bigger context window doesn't fix this. The prompt-to-activation map is not surjective (arXiv:2604.09839): some of what the model knows cannot be reached through language, however long the prompt.


The model knows it, but can't say it

Qwen3-ASR claims Greek and still transcribes it at 30% WER. Yet on 92% of the tokens it gets wrong, the right token is already in its top-5. The model has the answer; its most-likely prior pushes it down. RepRAG targets exactly this: languages and dialects a model claims to support but handles badly.

  • Store without matching content: only tokens ranked 2–5 get fixed. This is the "known but suppressed" zone.
  • Matching text in the store: fixes reach ranks 6–50.
  • Gold audio in the store: almost everything is fixed, which shows the channel itself is not the bottleneck.

Flip the sign, flip the effect

Take the same retrieved edit and reverse its sign. Error goes up on every model, and it goes up monotonically with |λ|. The controls give nothing: shuffling which value goes with which key, or applying one mean edit everywhere. So the gain comes from the direction of the content-matched edit, not from perturbing the activations.

Every model has its own safety envelope

The best dose differs by about 10× across models: λ ≈ 0.5 for MiniCPM-o, ≈ 2 for Qwen3-ASR and Step-Audio 2, 4–6 for Qwen3-Omni. Some curves have cliffs: MiniCPM-o collapses at λ ≥ 1.5. Normalising by injection magnitude does not explain this. We read it as model-specific safety envelopes shaped by alignment.


Against training on the same data

We trained LoRA (rank 16) on exactly the data RepRAG compiles:

  • Accuracy: a tie on Qwen3-ASR (9.8 vs 9.8) and a win on Step-Audio 2 (9.9 vs 12.2).
  • Side effects: much smaller with RepRAG. Mandarin control rises +0.4 to +1.0 points, against +1.3 to +2.2 for LoRA.
  • Stacking: compile a store on top of the LoRA model and Wu CER reaches 7.8, better than either method alone.

Where LoRA is ahead:

  • On real recordings that don't contain the test sentences, LoRA is slightly better (14.0 vs 14.6).
  • LoRA is cheaper to build: 4.5 min and 70 MB, versus 22 min and 565 MB for the RepRAG store.

So the pitch is after training, and instead of training when you have no paired data.


Models

Model Backbone Injection point Wu / target result
Qwen3-ASR-1.7B audio encoder → Qwen3-1.7B LLM layer 13 / 28 Wu 19.9 → 10.4 · Greek 30.1 → 9.9
FireRedASR2-LLM Conformer → Qwen2-7B LLM layer 13 / 28 Wu 46.6 → 12.8
Step-Audio 2 mini audio encoder → Qwen2.5-7B LLM layer 13 / 28 Wu 18.9 → 9.9
MiniCPM-o 4.5 Whisper-style encoder → Qwen3-8B LLM layer 16 / 36 Wu 64.7 → 34.6 · Cantonese 26.2 → 7.0
Qwen3-Omni-30B-A3B audio encoder → MoE thinker thinker layer 20 / 48 Wu 40.8 → 15.3
Whisper-large-v3 encoder–decoder encoder layer 16 / 32 Cantonese 20.8 → 11.1
Voxtral Mini 3B Whisper encoder → LLM LLM layer 13 / 30 Hindi 15.6 → 14.0

Adding a backbone takes one adapter file (reprag/adapters/). The adapter exposes the decoder layers, a mask of source positions, transcribe, and teacher-forced loss.

Knowledge packs

Validation packs on 🤗 Hugging Face for the frozen Qwen3-ASR-1.7B: attach one and the error rate drops. They are built from text only, via TTS, using the RAG "gold document" setting (see each pack's card).

Pack Before → after Size
Ranger838978/reprag-qwen3asr-wu-tts Wu CER 19.1 → 9.8 ~565 MB
Ranger838978/reprag-qwen3asr-greek-tts Greek WER 30.1 → 9.9 ~0.9 GB

To build your own pack, run TTS over your text, then compile:

python scripts/synth_multi.py <task> <n_sentences> <n_voices>           # VoxCPM2, real prompt voices
python scripts/build_pack.py --model qwen3asr --layer 13 --items items.jsonl --out packs/mine

Reproduce

pip install -r requirements.txt
export REPRAG_ROOT=/path/to/workdir        # data/ runs/ live here; model paths via QWEN3_ASR_PATH etc. (see reprag/adapters)
python scripts/fleurs_baseline.py qwen3asr 200                     # find targets: claimed but weak
python scripts/fleurs_topk.py qwen3asr el_gr,hu_hu 100             # ...and "known but suppressed" (top-5 share)
python scripts/mainline.py fleurs_el_gr 300                        # text KB -> TTS -> store -> evaluate (+ text-RAG controls)
python scripts/lam_sweep.py qwen3asr wu_real 13 <store.pt> 100 "-2,-1,1,2,3"   # dose and direction
python scripts/lora_cmp.py qwen3asr tts 3e-4 5                     # same-data LoRA baseline
python scripts/make_figures.py                                     # every figure in this README

What it is not

  • It cannot add knowledge the model never had. Tokens ranked below 50 are rarely fixed unless the matching document is in the store.
  • The dose must be set per model. A label-free leave-one-out rule we propose lands within 1.0–1.2× of the best dose on four models. It failed our pre-registered blind test on the fifth, so we report it as a starting point, not a solution.
  • Stores are stored per frame and get large. Compression and approximate search are open work.

Part of a research line

RepRAG is the retrieve pillar of a programme that works in latent space instead of fine-tuning (RepELab):

Citation

@misc{zhang2026retrieved,
  title     = {Retrieved Interventions: Fixing What Frozen Speech Models Know but Cannot Say},
  author    = {Zhang, Jing},
  year      = {2026},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.24672318},
  url       = {https://doi.org/10.5281/zenodo.24672318}
}

Acknowledgements

Thanks to ModelBest for compute support. Speech synthesis: VoxCPM2 (OpenBMB). Data: WenetSpeech-Wu-Bench, FLEURS, Common Voice. Code under Apache-2.0.

About

Retrieved Interventions: fix what frozen speech models know but cannot say — retrieve edits, not text. 7 models, 0 trained params. doi:10.5281/zenodo.24672318

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages