Downloads · 30 days
12
5% of all-time downloads
cyberandy/sangue-e-grafi-gemma4-e2b-grpo-run-f-v7
sangue-e-grafi-gemma4-e2b-grpo-run-f-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.
GRPO-reinforced LoRA adapter — the second training stage that sharpens ontology-valid tool use via reward signals.
Downloads · 30 days
12
5% of all-time downloads
All-time downloads
232
Public
Repo size
235 MB
Likes
0
Public
Click a slice to open those files.
.safetensors203 MB · 86%
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>GRPO-reinforced LoRA adapter — the second training stage that sharpens ontology-valid tool use via reward signals.
This is a LoRA (PEFT) adapter trained via Group Relative Policy Optimization (GRPO) on top of the SFT adapter (already merged into google/gemma-4-E2B-it). It is the second and final training stage in the Sangue e Grafi pipeline.
GRPO refines the model by:
This approach is inspired by the RLM-on-KG paradigm: using reinforcement learning to align a language model's behaviour with structured knowledge-graph constraints.
google/gemma-4-E2B-it (4B)
│
▼
┌─────────┐ 500 adversarial scenarios
│ SFT │◄─── teacher traces (Gemini 2.5 Flash)
└────┬────┘
│ merge adapter
▼
┌─────────┐ reward: correct answer + valid tool use
│ GRPO │◄─── ontology constraint checking
└────┬────┘
│
▼
THIS ADAPTER (apply on merged SFT base)
| Parameter | Value |
|---|---|
| Method | GRPO (Group Relative Policy Optimization) |
| Base | google/gemma-4-E2B-it + merged SFT adapter |
| Reward signals | Answer correctness + ontology-valid tool usage |
| Format | SafeTensors LoRA adapter |
| 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
# Step 1: Load base + merge SFT
base = AutoModelForCausalLM.from_pretrained("google/gemma-4-E2B-it")
sft_model = PeftModel.from_pretrained(base, "cyberandy/sangue-e-grafi-gemma4-e2b-sft-adversarial-v7")
merged = sft_model.merge_and_unload()
# Step 2: Apply GRPO adapter
model = PeftModel.from_pretrained(merged, "cyberandy/sangue-e-grafi-gemma4-e2b-grpo-run-f-v7")
tokenizer = AutoTokenizer.from_pretrained("google/gemma-4-E2B-it")
Tip: For a single ready-to-run file, use the GGUF quantized version instead.
Intended uses:
Limitations:
| Resource | Link |
|---|---|
| 🚀 Live Demo | HF Space |
| 📦 GitHub | cyberandy/sangue-e-grafi |
| 📄 Paper | RLM-on-KG (arXiv:2604.17056) |
| 🎓 SFT Adapter | sangue-e-grafi-gemma4-e2b-sft-adversarial-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}
}