Audio-R1
Collection
RL post-training of audio-language models with self-supervised tasks as verifiable rewards β’ 4 items β’ Updated
How to use NearAndDear98/Audio-R1-Gemma-4-E4B-it with PEFT:
from peft import PeftModel
from transformers import AutoModelForCausalLM
base_model = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it")
model = PeftModel.from_pretrained(base_model, "NearAndDear98/Audio-R1-Gemma-4-E4B-it")LoRA adapter for google/gemma-4-E4B-it trained with Audio-R1, an RL post-training framework that uses audio self-supervised tasks as a source of verifiable rewards.
| Hyperparameter | Value |
|---|---|
| Method | GRPO, 1 epoch, LoRA |
| Reward | accuracy (1.0 if the chosen letter is correct) + format (0.2) |
| Format reward | non-empty <think> and an <answer> tag |
| Optimizer / LR schedule | AdamW, cosine |
| Learning rate / warmup ratio | 5e-6 / 0.03 |
| Rollouts per prompt | 8 |
| Sampling temperature / top-p | 0.8 / 0.9 |
| KL coefficient Ξ² | 0.1 |
| Clip Ξ΅ | 0.2 |
| Per-device batch Γ grad. accumulation | 8 Γ 4 |
| GPUs | 8 |
| LoRA rank / Ξ± / dropout | 8 / 32 / 0.05 |
| LoRA targets | all linear layers; audio encoder frozen |
| Precision / seed | bf16 / 42 |
import torch
from peft import PeftModel
from transformers import AutoProcessor, Gemma4ForConditionalGeneration
base = "google/gemma-4-E4B-it"
processor = AutoProcessor.from_pretrained(base)
model = Gemma4ForConditionalGeneration.from_pretrained(base, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, "NearAndDear98/Audio-R1-Gemma-4-E4B-it").eval()
SYSTEM = (
"Your response MUST contain two parts in this exact order:\n"
"1. Your reasoning enclosed within <think> </think> tags.\n"
"2. The final answer β a single letter for the correct option β enclosed "
"within <answer> </answer> tags."
)
messages = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": [
{"type": "text", "text": "Question ...\n(A) ...\n(B) ...\n(C) ...\n(D) ..."},
{"type": "audio", "audio": "example.wav"}, # audio after text, per Gemma 4 docs
]},
]
inputs = processor.apply_chat_template(
messages, add_generation_prompt=True, tokenize=True, return_dict=True,
return_tensors="pt", enable_thinking=False,
).to(model.device)
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False)
print(processor.decode(out[0, inputs["input_ids"].shape[-1]:], skip_special_tokens=True))
The adapter is released under Apache 2.0, the license of the base model.
@article{jeong2026audior1,
title = {Audio-R1: Audio Reasoning through Reinforcement Learning on Self-Supervised Tasks},
author = {Jeong, Jihoon and Ravanelli, Mirco and Wang, Zhepei and Subakan, Cem},
journal = {arXiv preprint arXiv:2610.34609},
year = {2026}
}