a-ivanovitch/RegTech-7B-Instruct
π¦ RegTech-7B-Instruct
Fine-tuned for RAG-powered banking compliance β not general knowledge.
A specialized Qwen2.5-7B-Instruct model fine-tuned to excel within a Retrieval-Augmented Generation (RAG) pipeline for Italian banking regulatory compliance.
This model doesn't try to memorize regulations β it's trained to work with retrieved context: follow instructions precisely, produce structured outputs, call compliance tools, and maintain the right tone and terminology when grounded on regulatory documents.
π― What This Model Does
This fine-tuning optimizes the model's behavior within a RAG system, not its factual knowledge. Specifically:
π Evaluation β LLM-as-Judge
Evaluated by Claude Opus 4.6 (Anthropic) across 11 blind test scenarios. The judge compared base vs fine-tuned model outputs without knowing which was which.
π Head-to-Head
βββββββββββββββββββββββββββββββββββββββββββ
β π’ Tuned Wins 7/11 (68.2%) β
β π΄ Base Wins 3/11 (31.8%) β
β βͺ Ties 1/11 β
βββββββββββββββββββββββββββββββββββββββββββπ Quality Scores (1β5)
Largest improvement across all model sizes. Instruction following jumps +1.55 and context adherence reaches a perfect 5.00 β the fine-tuning transforms this model's ability to follow retrieved regulatory context.
π Results by Category
π Comparison Across Model Sizes
The 7B shows the highest delta (+0.95) β it benefits the most from fine-tuning, reaching near-parity with the 32B tuned model (4.78 vs 4.80).
π‘ Usage Examples
π RAG Q&A β Answering from Retrieved Context
The model is designed to receive retrieved regulatory documents as context and answer based on them:
messages = [
{
"role": "system",
"content": """Sei un assistente per la compliance bancaria.
Rispondi SOLO basandoti sul contesto fornito.
<contesto_recuperato>
Art. 92 CRR - Gli enti soddisfano in qualsiasi momento i seguenti
requisiti: a) CET1 del 4,5%; b) Tier 1 del 6%; c) capitale totale dell'8%.
Il coefficiente Γ¨ calcolato come rapporto tra i fondi propri e
l'importo complessivo dell'esposizione al rischio.
</contesto_recuperato>"""
},
{
"role": "user",
"content": "Quali sono i requisiti minimi di capitale secondo il CRR?"
}
]π Query Expansion β Improving RAG Retrieval
messages = [
{
"role": "system",
"content": "Riscrivi la query dell'utente in una versione piΓΉ ricca per migliorare il recupero documentale (RAG). Aggiungi termini tecnici e riferimenti normativi. Rispondi SOLO con il JSON richiesto."
},
{
"role": "user",
"content": "## QUERY ORIGINALE: [obblighi segnalazione operazioni sospette]"
}
]
# Expected output:
# {"query": "obblighi segnalazione operazioni sospette SOS UIF D.Lgs. 231/2007
# art. 35 riciclaggio finanziamento terrorismo portale RADAR tempistiche
# invio indicatori anomalia"}π§ Tool Calling β Compliance Workflows
messages = [
{
"role": "system",
"content": """Sei un assistente operativo per la compliance.
<tools>
{"name": "calcola_scoring_rischio", "parameters": {...}}
{"name": "controlla_liste_pep", "parameters": {...}}
{"name": "verifica_kyc", "parameters": {...}}
</tools>
<contesto_recuperato>
Procedura AML-003: L'adeguata verifica rafforzata (EDD) deve essere
applicata per PEP, paesi ad alto rischio e profili con scoring > 60.
</contesto_recuperato>"""
},
{
"role": "user",
"content": "Devo aprire un conto per una societΓ con sede a Dubai. Il legale rappresentante Γ¨ il sig. Al-Rashid."
}
]
# The model will:
# 1. Call controlla_liste_pep for the representative
# 2. Call calcola_scoring_rischio based on risk factors
# 3. Recommend EDD procedure per AML-003, grounded on retrieved policyπ Document Reranking
messages = [
{
"role": "system",
"content": "Valuta la rilevanza di ciascun candidato rispetto alla query. Restituisci solo i candidati rilevanti con score 0-100. Rispondi SOLO con il JSON richiesto."
},
{
"role": "user",
"content": '{"query": "requisiti CET1 fondi propri", "candidates": [{"id": "doc_001", "title": "Art. 92 CRR", "content": "..."}, {"id": "doc_002", "title": "DORA Art. 5", "content": "..."}]}'
}
]
# Expected: {"matches": [{"id": "doc_001", "relevance": 95}]}βοΈ Training Details
π Training Metrics
Gap of 0.083 indicates stable training with no overfitting.
π Dataset Coverage
The training data covers the full lifecycle of a RAG-based compliance assistant:
Regulatory sources covered: CRR/CRR3, DORA (UE 2022/2554), D.Lgs. 231/2007 (AML), D.Lgs. 385/1993 (TUB), Circolare 285, PSD2, MiFID II/MiFIR, D.P.R. 180/1950 and related Banca d'Italia provisions.
π Deployment
With vLLM
vllm serve ./models/RegTech-7B-Instruct --dtype bfloat16With Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("YOUR_REPO_ID", torch_dtype="bfloat16", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("YOUR_REPO_ID")
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))β οΈ Important Notes
- π― RAG-optimized β trained to work with retrieved context, not to memorize regulations. Always provide relevant documents in the system prompt.
- π¦ Domain-specific β optimized for Italian banking compliance. General capabilities may differ from the base model.
- βοΈ Not legal advice β a tool to assist compliance professionals, not a substitute for regulatory expertise.
- π§ Tool schemas β tool calling works best with the specific function signatures used during training.
- π Best cost/performance ratio β shows the largest improvement from fine-tuning (+0.95 delta) while reaching near-parity with the 32B model.
<p align="center"> Built with β€οΈ for banking RAG<br> <em>Fine-tuned with LoRA β’ Evaluated by Claude Opus 4.6 β’ Powered by Qwen2.5</em><br> <em>Contact For Commercial Use: https://landing.2sophia.ai</em> </p>
