Downloads · 30 days
12
6% of all-time downloads
cyberandy/sangue-e-grafi-gemma4-e2b-sft-adversarial-v7
sangue-e-grafi-gemma4-e2b-sft-adversarial-v7 is a text generation model from cyberandy. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
Supervised Fine-Tuned LoRA adapter for Italian inheritance-law reasoning over kinship knowledge graphs.
Downloads · 30 days
12
6% of all-time downloads
All-time downloads
212
Public
Repo size
134 MB
Likes
0
Public
Click a slice to open those files.
.safetensors101 MB · 76%
From the Hugging Face model README
<p align="center"> <img src="https://huggingface.co/spaces/cyberandy/sangue-e-grafi/resolve/main/banner.png" alt="Sangue e Grafi banner" width="700"/> </p>Supervised Fine-Tuned LoRA adapter for Italian inheritance-law reasoning over kinship knowledge graphs.
This is a LoRA (PEFT) adapter trained via Supervised Fine-Tuning (SFT) on top of google/gemma-4-E2B-it. It is part of the Sangue e Grafi project — a Hugging Face Build Small Hackathon 2026 entry demonstrating that a small 4B-parameter model, fine-tuned with SFT + GRPO and equipped with a knowledge-graph agent, outperforms frontier models (Gemini 2.5 Flash) on adversarial Italian inheritance-law scenarios.
The adapter teaches the model to:
lookup_relationship, check_degree, etc.) grounded in an OWL kinship ontology.| Parameter | Value |
|---|---|
| Method | SFT (Supervised Fine-Tuning) |
| Base model | google/gemma-4-E2B-it (4B params) |
| Training data | 500 adversarial kinship scenarios with teacher traces |
| Teacher | Gemini 2.5 Flash — generated gold reasoning traces |
| LoRA rank | See adapter config |
| Format | SafeTensors LoRA adapter |
Each training example is a complete agent trace: a kinship scenario (family graph + narrative in Italian), a legal question, and the step-by-step tool-call reasoning produced by Gemini 2.5 Flash acting as a teacher over the ontology-grounded knowledge graph.
| Benchmark | KG Agent (Gemma 4B SFT+GRPO) | Gemini 2.5 Flash (no KG) |
|---|---|---|
| Easy (10 seeds) | 10/10 (100%) | 3/10 (30%) |
| Hard dev-set (10 seeds) | 5/10 (50%) | — |
| Model | Hard Dev-Set Accuracy |
|---|---|
| Gemma 4B (SFT+GRPO) | 5/10 (50%) |
| Nemotron 4B (SFT+GRPO) | 4/10 (40%) |
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base = AutoModelForCausalLM.from_pretrained("google/gemma-4-E2B-it")
model = PeftModel.from_pretrained(base, "cyberandy/sangue-e-grafi-gemma4-e2b-sft-adversarial-v7")
tokenizer = AutoTokenizer.from_pretrained("google/gemma-4-E2B-it")
Note: This is the SFT-only checkpoint. For the full pipeline (SFT → GRPO), merge this adapter first, then apply the GRPO adapter.
Intended uses:
Limitations:
| Resource | Link |
|---|---|
| 🚀 Live Demo | HF Space |
| 📦 GitHub | cyberandy/sangue-e-grafi |
| 📄 Paper | RLM-on-KG (arXiv:2604.17056) |
| 🎯 GRPO Adapter | sangue-e-grafi-gemma4-e2b-grpo-run-f-v7 |
| 📊 Agent Traces Dataset | sangue-e-grafi-agent-traces |
| 🔢 GGUF (quantized) | sangue-e-grafi-gemma4-e2b-gguf |
@misc{sangue-e-grafi-2026,
title = {Sangue e Grafi: Small Models Beat Frontier LLMs on Adversarial Kinship Reasoning with Knowledge Graph Agents},
author = {Andrea Volpini},
year = {2026},
url = {https://github.com/cyberandy/sangue-e-grafi},
note = {Hugging Face Build Small Hackathon 2026}
}