Advocate Remuneration Assistant: on-policy DPO adapter
A LoRA adapter for Qwen/Qwen2.5-7B-Instruct, trained with on-policy DPO on top of the SFT stage, for a retrieval-augmented assistant that answers questions about Kenya's Advocates (Remuneration) Order and Kenyan case law on taxation of costs.
The SFT stage is mikekeror/qwen2.5-7b-advocate-sft-lora-ep1.
Not legal advice. This is a research prototype. Figures reflect the Order as revised to 2022 and may not reflect later amendments or a taxing officer's discretion.
Read this first: what this adapter does and does not do
In a pre-registered evaluation on a frozen 236-question held-out set, DPO did not show a detectable accuracy gain over the SFT adapter (DPO vs SFT: +0.8 points, 95% interval [-2.6, +4.4]), and it did not beat the base model. The accuracy gains in this project came from the retrieval and calculation pipeline around the model, not from fine-tuning.
On an earlier 62-question set, this adapter cited the case a question asked about in 92.3% of answers (base 87.2%, SFT 89.7%), with no fabricated citations. That set was used while the pipeline was being tuned, so treat it as a development result.
Full write-up: https://mikekeror-rgb.github.io/advocate_renumeration_assistant_v1/report.pdf
How it is meant to be used
The adapter is trained for use inside the full pipeline, not on its own: hybrid retrieval (dense + BM25 + reciprocal rank fusion), case-scoped retrieval when a question names a ruling, and a deterministic fee calculator whose result the model is told to state. Prompts contain numbered source chunks, and the model is trained to cite them and to say "Not covered in the provided documents" when the sources do not answer.
Used without retrieved context, it has no reliable legal knowledge of its own. Code for the pipeline: https://github.com/mikekeror-rgb/advocate_renumeration_assistant_v1
Usage
With transformers and peft:
python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = "Qwen/Qwen2.5-7B-Instruct"
tok = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, device_map="auto", torch_dtype="auto")
model = PeftModel.from_pretrained(model, "mikekeror/qwen2.5-7b-advocate-dpo-lora")
With vLLM (multi-LoRA, base and adapters served side by side):
bash
vllm serve Qwen/Qwen2.5-7B-Instruct --enable-lora
--lora-modules advocate-dpo=mikekeror/qwen2.5-7b-advocate-dpo-lora
Training
Starting point: the SFT adapter (QLoRA, r=16 on all linear layers). See its card for the SFT data and settings.
Preference data (on-policy): the SFT model answered 448 training prompts. Failures (a wrong answer or a missing source citation) became the rejected sample, and the gold answer became the chosen sample, giving 81 pairs.
Method: DPO with the SFT adapter as the reference model (reference log-probs computed once up front), beta=0.1, learning rate 2e-5, 2 epochs, NLL regulariser 0.2.
Result of training: validation preference accuracy rose from 0 to 0.917 on held-out pairs.
Evaluation (frozen 236-question held-out set, pipeline fixed)
Accuracy, percent, judged against reference answers (numeric answers checked deterministically):
Model Overall Unseen rulings Seen rulings
Base Qwen2.5-7B-Instruct 87.7 78.3 79.2
SFT, epoch 1 85.2 75.4 72.9
This adapter (SFT + DPO) 86.0 72.5 81.2
DPO vs SFT on unseen rulings: -2.9 [-12.5, +5.6]. Judge faithfulness (1 to 5): base 4.59, SFT 4.59, this adapter 4.47. None of the differences between the three models is distinguishable from noise on this test. The seen-versus-unseen gap for this adapter is an observation I did not investigate further. The judge (gpt-5.4-mini) was hand-checked on 30 verdicts, with 30 of 30 agreeing.
Limitations
One domain, one base model. Do not generalise from this to other settings.
Only 81 preference pairs, all mined from one SFT model's mistakes.
Training data is synthetic, written by a 20B teacher and filtered by rules. It was not reviewed by a lawyer.
The adapter should not be used to give legal advice.
Citation
Keror, M. (2026). Advocate Remuneration Assistant: pipeline engineering vs fine-tuning (software and evaluation). https://doi.org/10.5281/zenodo.23603007