Downloads · 30 days
0
teex-pt/AMALIA-9B-0626-DPO-LoRA-legal-v1
AMALIA-9B-0626-DPO-LoRA-legal-v1 is a text generation model from teex-pt. Use it when you need the model to write or continue text. It is set up for mlx. The card lists the license as apache-2.0.
LoRA adapter from a research pilot on AMALIA-9B-0626-DPO, targeting grounded legal citation: answer only from provided excerpts, cite the exact article with [F] tags, and refuse explicitly when the excerpts don't cont…
Downloads · 30 days
0
Access
Public
Updated Jul 13, 2026
Repo size
38.8 MB
Likes
0
Public
Click a slice to open those files.
.safetensors38.8 MB · 100%
From the Hugging Face model README
LoRA adapter from a research pilot on
AMALIA-9B-0626-DPO,
targeting grounded legal citation: answer only from provided excerpts,
cite the exact article with [F#] tags, and refuse explicitly when the
excerpts don't contain the answer. Full methodology and every pilot's
report: github.com/teex-pt/pt-amalia.
Status: research pilot, not a clean accept. The target metric moved dramatically; three secondary categories landed just outside this project's strict acceptance tolerance. Reported as-is below, not oversold as a finished checkpoint.
Update (2026-07-13): legal-v2
supersedes this adapter — same recipe, ~2x the training data, target
climbed 82.0%→94.0% and the variety regression noted below fully
recovered. This repo stays published for reproducibility of the original
small-scale pilot.
This project's own exam-domain pilots (iave-v1/iave-v2) showed
closed-book fact-recall SFT on small specialized data has a low ceiling —
answer format moved, precision didn't. So this adapter trains a
different contract entirely: answer only from context provided at
inference time, cite it, or say explicitly that the context doesn't
answer the question — the same shape a retrieval-augmented legal service
already needs, not a model that memorized the law.
merge-75 is this project's current general-purpose champion (an
unrelated weighted-merge pilot, no legal or exam training in its
lineage) — included to separate "any adapter helps a little" from a
domain-specific effect.
| Category | Baseline | merge-75 | legal-v1 |
|---|---|---|---|
| legal citation (target, n=50) | 16.0% | 16.0% | 82.0% |
| legal refusal (n=10) | 100% | 90.0% | 100% |
| arithmetic (n=100) | 46.0% | 51.0% | 50.0% |
| format (n=30) | 73.3% | 80.0% | 80.0% |
| honesty (n=100) | 50.0% | 96.0% | 78.0% |
| variety (n=30) | 86.7% | 93.3% | 83.3% |
| honesty control (n=36) | 100% | 100% | 97.2% |
| mcq / exam (n=37) | 29.7% | 27.0% | 27.0% |
merge-75 gives essentially zero legal-citation benefit (16.0% either
way) — confirms the +66pp is a real domain-specific effect, not something
any adapter would produce. variety is legal-v1's one real
domain-specific regression (merge-75 improves it, legal-v1 doesn't) —
likely from unstratified general-anchor sampling in the training mix, not
fixed in this pilot. The mcq/exam dip is not legal-specific: merge-75
shows the identical drop despite no legal or exam exposure, so it reads as
generic low-sample-size adapter drift rather than cross-domain
interference.
mlx_lm.lora, base BF16, 500 iterations, batch size 1,
16 layers, LoRA rank 8, learning rate 1e-5, max_seq_length=4096 with
gradient checkpointing (legal citation contexts run considerably
longer than this project's earlier pilots).pip install mlx-lm
mlx_lm.generate --model amalia-llm/AMALIA-9B-0626-DPO --adapter-path <this-repo> \
--prompt "PERGUNTA: <a sua pergunta>
EXCERTOS:
[F1] <fonte> — <texto do excerto>"
Expects excerpts to be provided in the prompt (retrieval is not part of this adapter) — designed to sit behind a retrieval step, not replace one.
Base model by the AMALIA team (Apache 2.0). Adapter, data, and method: teex-pt.