German Legal QA 3B: Domain-Adapted LLM for German Law
A LoRA-adapted Llama 3.2 3B model fine-tuned on German legal question-answering data. Designed for use with a RAG (Retrieval-Augmented Generation) pipeline that grounds answers in actual statutory text.
This model answers questions about German civil, criminal, and procedural law with paragraph citations (§-references).
Note: This model is for educational and research purposes only. It does not constitute legal advice.
The adapter was trained using Apple MLX on an M1 Pro MacBook, demonstrating efficient legal domain adaptation on consumer hardware.
Component
Configuration
Base Model
Llama-3.2-3B-Instruct (4-bit quantized)
Adapter
LoRA, rank 16, 16 layers
Training Data
10,000 German legal Q&A pairs
Training Framework
MLX (Apple Silicon native)
Training Steps
500
Final Train Loss
1.874
Final Val Loss
1.908
Peak Memory
4.3 GB
Adapter Size
46 MB
Training Data
Trained on GerLayQA (EACL 2024) — real legal questions from German citizens paired with expert lawyer answers.
Source
Examples
Coverage
GerLayQA (BGB)
8,000+
Civil law, contracts, liability
GerLayQA (StGB)
1,000+
Criminal law, sentencing
GerLayQA (ZPO)
500+
Procedural law
RAG Pipeline (Recommended)
This adapter works best combined with retrieval over German federal statutes. The full system indexes 103,000+ legal text chunks from 6,111 German federal laws.
Evaluated on held-out GerLayQA test set with RAG retrieval (50 samples):
Metric
Score
Description
Token F1
0.218
Word overlap with reference
ROUGE-L
0.101
Longest common subsequence
BERTScore F1
0.652
Semantic similarity
Citation Accuracy
0.059
Correct §-reference matching
Scores reflect comparison against verbose forum-style lawyer answers. The system provides concise statutory answers — different style, same meaning (shown by BERTScore).
Example Output
Q: Was besagt §823 BGB?
A: § 823 BGB besagt, dass wer vorsätzlich oder fahrlässig das Leben, den Körper, die Gesundheit, die Freiheit, das Eigentum oder ein sonstiges Recht eines anderen widerrechtlich verletzt, dem anderen zum Ersatz des daraus entstehenden Schadens verpflichtet ist.
Limitations
Requires RAG retrieval for factually accurate answers
Trained on German law only — not applicable to other jurisdictions
Should not be used as a substitute for professional legal advice
May produce hallucinations without retrieval context
Early-stage model (500 training steps) — answer quality improves with further training
Full System
The complete RAG pipeline (data acquisition, indexing, training, evaluation, demo) is available at: