Jordan Painter · Dipankar Srirag · Adarsh Kappiyath · Diptesh Kanojia · Aditya Joshi · Lu Yin
Institute for People-Centered AI, University of Surrey & University of New South Wales
DiaLLM applies a three-stage post-training pipeline to three open-weight LLM families (Llama 3.1-8B, Qwen3-8B, Gemma 3-4B-it) for dialect adaptation across Australian English (en-AU), Indian English (en-IN), and Northern British English (en-UK):
- CPT — continued pre-training on dialectal corpora (not covered here; based on Q-GaLore)
- SFT — supervised fine-tuning on dialectal preference data (
src/sft.py) - DPO — direct preference optimisation (
src/dpo.py) - GRPO / GSPO — online reinforcement learning with a composite dialect reward (
src/train.py)
Two adaptation paradigms are compared:
- Implicit: broad training on all three varieties combined, no variety targeting
- Explicit: single-variety targeting throughout, using dialect-specific reward masking
configs/
sft/ # Example SFT config (see note below)
dpo/ # DPO configs — one per model × variety
grpo/ # GRPO configs — one per model × variety (+ broad -all variants)
gspo/ # GSPO configs — one per model × variety (+ broad -all variants)
src/
sft.py # SFT training script
dpo.py # DPO training script
train.py # Unified GRPO/GSPO training script
formatting.py # Prompt formatting utilities
rewards/
dialect_reward.py # Combined reward function
dialect_reward_model.py # DialectDensityScorer (feature masking)
dialect_feature_model.py # MultiheadDialectFeatureModel (BERT classifier wrapper)
comet_reward.py # COMET meaning-preservation reward
sim_reward.py # Cosine similarity reward
scripts/
train_dialect_classifier.py # Train the dialect feature classifier
run_classifier_inference.py # Run classifier over model outputs
run_feature_inference.py # Extract per-feature probabilities
run_llm_judge.py # LLM-as-judge evaluation
analyse_llm_judge.py # Aggregate LLM judge results
plot_training_dynamics.py # Plot W&B training curves
wandb_summary.py # Summarise W&B runs
gen_configs.py # Generate configs programmatically
gen_sub_files.py # Generate SLURM submission scripts
sub/
dpo/ # SLURM submission scripts for DPO runs
grpo/ # SLURM submission scripts for GRPO runs
gspo/ # SLURM submission scripts for GSPO runs
model_cards/
diallm-dialect-classifier.md # Model card for the dialect feature classifier
linguistic-analysis/
README.md # Full docs — detectors, measures, human-preference bridge
diallm_analysis/ # Package: detectors, density/diversity/stacking measures, JS-divergence
run_analysis.py # Entry point
tests/
Independent, reward-free linguistic analysis of generation outputs (linguistic-analysis/), built to corroborate the paper's reward-quality gap findings with evidence that doesn't reuse the eWAVE feature classifier defining the training reward. See its own README for detectors, measures, and the human-preference bridge.
pip install -r requirements.txtExperiments were run on NVIDIA A100 GPUs using accelerate for distributed execution. All runs use bfloat16 precision.
Note on configs: All training is config-driven. The
configs/sft/directory contains a single example config (example_llama_australian.json) to illustrate the format; the full set of SFT configs used in the paper follows the same structure and targets the dialectal preference datasets on HuggingFace. For GRPO/GSPO/DPO, all 36 configs (3 models × 3 varieties × 4 methods, plus broad-alignment variants) are provided.
Note on SLURM: The
sub/scripts are written for a SLURM-managed cluster. Adjust partition names, paths, and resource requests for your environment. Thescripts/gen_sub_files.pyutility can regenerate these from a template.
python src/sft.py --config configs/sft/example_llama_australian.jsonOr with accelerate for multi-GPU:
accelerate launch --num_processes=4 src/sft.py --config configs/sft/example_llama_australian.jsonpython src/dpo.py --config configs/dpo/llama_aus.jsonBoth methods use the same train.py entry point; the "algorithm" field in the config ("grpo" or "gspo") selects between token-level and sequence-level importance sampling respectively.
accelerate launch --num_processes=1 -m src.train -c configs/gspo/llama_aus.json
accelerate launch --num_processes=1 -m src.train -c configs/grpo/llama_aus.jsonThe composite reward used for GRPO/GSPO is:
where
For explicit (variety-targeted) adaptation, dialect_feature_indices in the config restricts
The dialect feature classifier (srirag/feature-identifier) is a BERT-base encoder with 135 binary classification heads, one per eWAVE morphosyntactic feature.
Main collection (curated model highlights + all preference datasets): huggingface.co/surrey-nlp
| Model | Variety | Method |
|---|---|---|
| Llama 3.1-8B | en-UK | DPO |
| Llama 3.1-8B | en-AU | GSPO |
| Qwen 3-8B | en-AU | GRPO |
| Qwen 3-8B | en-IN | DPO |
| Gemma 3-4B-it | en-AU | DPO |
| Gemma 3-4B-it | en-IN | GRPO |
Full checkpoint set (all methods × all varieties × all families): huggingface.co/jordanpainter
| Resource | Pattern |
|---|---|
| CPT checkpoints | jordanpainter/diallm-{llama,qwen,gemma}-cpt |
| SFT checkpoints (explicit) | jordanpainter/diallm-{llama,qwen,gemma}-sft-{aus,ind,brit} |
| DPO / GRPO / GSPO checkpoints (explicit) | jordanpainter/diallm-{llama,qwen,gemma}-{dpo,grpo,gspo}-{aus,ind,brit} |
| Broad-thread checkpoints (implicit) | jordanpainter/diallm-{llama,qwen,gemma}-{sft,dpo,grpo,gspo}-all |
| Preference datasets | surrey-nlp/alignment-{australian,british,indian}-final |
| Dialect feature classifier (this repo) | jordanpainter/diallm-dialect-classifier |
| Dialect feature classifier (Srirag et al.) | srirag/feature-identifier |
@article{painter2026diallm,
title = {DiaLLM: An Investigation into the Robustness-Generation Gap in English Dialect Adaptation},
author = {Painter, Jordan and Srirag, Dipankar and Kappiyath, Adarsh and Kanojia, Diptesh and Joshi, Aditya and Yin, Lu},
year = {2026}
}