qwen3.5-4b-lisa-sparql-agent-lora
SPARQL knowledge graph agent LoRA
2 min readupdated
This LoRA adapter based on Qwen/Qwen3.5-4B turns the language model into an agent that can search for information in the French UNESS LISA medical knowledge graph using the SPARQL query language. The model is trained in multiple stages, including SFT warm-up and GRPO (Group Relative Policy Optimization, a reinforcement learning algorithm), enabling it to systematically explore knowledge pages and rely accurately on retrieved facts. The release suits researchers and developers building RAG systems with knowledge graphs and interactive search tools.
Key features
- Based on the Qwen/Qwen3.5-4B model using the LoRA architecture (rank 32, about 1% trainable parameters).
- Integrates SPARQL queries directly into the generation process to traverse the UNESS LISA knowledge graph.
- Trained using two-stage GRPO with a modified weight update rule for stable graph exploration.
- Specializes in French medical educational content.
What you can do
- Deploy locally as an intelligent assistant for searching SPARQL endpoints.
- Connect to frameworks like vLLM for serving requests with hot-swappable LoRA modules.
- Test agent capabilities on multi-source search and fact-matching tasks from the knowledge base.
Example
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "Qwen/Qwen3.5-4B"
adapter_id = "asanchez75/qwen3.5-4b-lisa-sparql-agent-lora"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base_model = AutoModelForCausalLM.from_pretrained(
base_id, dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()Read more
DetailsBenchmarks: overall global score increased to 0.786 on the test set.
Hardware requirements: training was performed on 1 NVIDIA H100 GPU.
Limitations: intended exclusively for research and educational purposes, not for real medical diagnostics.
Training details: peft==0.21.3, r=32, lora_alpha=64.










Comments