Instructions to use rst0070/tiny-graph-extractor-qwen3.5-0.8b-lora with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use rst0070/tiny-graph-extractor-qwen3.5-0.8b-lora with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen3.5-0.8B") model = PeftModel.from_pretrained(base_model, "rst0070/tiny-graph-extractor-qwen3.5-0.8b-lora") - Notebooks
- Google Colab
- Kaggle
tiny-graph-extractor-qwen3.5-0.8b-lora
A LoRA adapter for unsloth/Qwen3.5-0.8B, fine-tuned to extract entities and (subject, relation, object) triplets from sentences for knowledge graph ingestion.
This repository contains adapter weights only.
The goal of this project is to replace expensive frontier-LLM calls in the knowledge graph extraction pipeline of rst0070/knowledge-base with a tiny model that runs locally.
- Base model:
unsloth/Qwen3.5-0.8B(Instruct) - Method: QLoRA SFT (4-bit frozen base + LoRA adapters)
- Training data: REBEL — Wikipedia sentences paired with Wikidata triplets
- Hardware: single 16GB GPU (RTX 4060 Ti)
- Source: github.com/rst0070/tiny-entity-extractor
Known Contract: Wikipedia Style
The adapter was trained on REBEL, so its output follows a Wikipedia-style contract:
- Entity surface forms follow Wikipedia conventions
- Relations follow Wikidata definitions and granularity
This is the contract the model is built against. Inputs and evaluation should stay inside that contract — domain-specific terminology, informal text, or alternate relation ontologies are out of scope and will degrade quality.
Output Format
The model emits structured JSON:
{
"entities": ["Entity A", "Entity B"],
"relations": [
{"head": "Entity A", "relation": "relation_type", "tail": "Entity B"}
]
}
Usage
from transformers import pipeline
pipe = pipeline(
"text-generation", model="rst0070/tiny-graph-extractor-qwen3.5-0.8b-lora",
max_new_tokens=1024,
)
messages = [
{
"role": "system",
"content": (
"You are a knowledge graph extraction assistant. "
"Given a text, extract all entities and their relations as JSON. "
"Output only valid JSON with no additional text."
)
},
{
"role": "user",
"content": "Apple was founded by Steve Jobs, Steve Wozniak, and Ronald Wayne in 1976. Steve Jobs served as the CEO of Apple.",
},
]
result = pipe(messages)
response = result[0]['generated_text'][-1]
print(response)
import re
import json
fence_re = re.compile(r"```(?:json)?\s*\n(.*?)\n```", re.DOTALL)
match = fence_re.search(response["content"])
if match:
print(json.loads(match.group(1)))
Training
The training target was constructed to deviate as little as possible from the base model's natural output, so SFT only has to close the smallest possible gap:
- Observe how the base model formats answers on REBEL inputs with no fine-tuning.
- Align the SFT target to match that observed format/phrasing where possible, while staying factually correct.
- Train with QLoRA SFT against that aligned target.
Limitations
- English / Wikipedia distribution only. Performance on other languages, domains (medical, legal, financial), or informal text is unknown and likely poor.
- Wikidata relation ontology. Relations outside the Wikidata vocabulary will not be produced reliably.
- Sentence-level inputs. Trained on REBEL sentence-level examples; not validated on long documents.
- No factual grounding. The model extracts what it reads; it does not verify claims.
License
Apache 2.0, inheriting from the base model and dataset license terms.
- Downloads last month
- 80