Instructions to use mohar07/qwen3-0.6b-kg-triplets with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mohar07/qwen3-0.6b-kg-triplets with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mohar07/qwen3-0.6b-kg-triplets") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("mohar07/qwen3-0.6b-kg-triplets") model = AutoModelForCausalLM.from_pretrained("mohar07/qwen3-0.6b-kg-triplets", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use mohar07/qwen3-0.6b-kg-triplets with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf mohar07/qwen3-0.6b-kg-triplets:F16 # Run inference directly in the terminal: llama cli -hf mohar07/qwen3-0.6b-kg-triplets:F16
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf mohar07/qwen3-0.6b-kg-triplets:F16 # Run inference directly in the terminal: llama cli -hf mohar07/qwen3-0.6b-kg-triplets:F16
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf mohar07/qwen3-0.6b-kg-triplets:F16 # Run inference directly in the terminal: ./llama-cli -hf mohar07/qwen3-0.6b-kg-triplets:F16
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf mohar07/qwen3-0.6b-kg-triplets:F16 # Run inference directly in the terminal: ./build/bin/llama-cli -hf mohar07/qwen3-0.6b-kg-triplets:F16
Use Docker
docker model run hf.co/mohar07/qwen3-0.6b-kg-triplets:F16
- LM Studio
- Jan
- vLLM
How to use mohar07/qwen3-0.6b-kg-triplets with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mohar07/qwen3-0.6b-kg-triplets" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohar07/qwen3-0.6b-kg-triplets", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mohar07/qwen3-0.6b-kg-triplets:F16
- SGLang
How to use mohar07/qwen3-0.6b-kg-triplets with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "mohar07/qwen3-0.6b-kg-triplets" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohar07/qwen3-0.6b-kg-triplets", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "mohar07/qwen3-0.6b-kg-triplets" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mohar07/qwen3-0.6b-kg-triplets", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use mohar07/qwen3-0.6b-kg-triplets with Ollama:
ollama run hf.co/mohar07/qwen3-0.6b-kg-triplets:F16
- Unsloth Desktop
- Pi
How to use mohar07/qwen3-0.6b-kg-triplets with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mohar07/qwen3-0.6b-kg-triplets:F16
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mohar07/qwen3-0.6b-kg-triplets:F16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use mohar07/qwen3-0.6b-kg-triplets with Docker Model Runner:
docker model run hf.co/mohar07/qwen3-0.6b-kg-triplets:F16
- Lemonade
How to use mohar07/qwen3-0.6b-kg-triplets with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull mohar07/qwen3-0.6b-kg-triplets:F16
Run and chat with the model
lemonade run user.qwen3-0.6b-kg-triplets-F16
List all available models
lemonade list
- Hermes Agent
How to use mohar07/qwen3-0.6b-kg-triplets with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mohar07/qwen3-0.6b-kg-triplets:F16
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mohar07/qwen3-0.6b-kg-triplets:F16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mohar07/qwen3-0.6b-kg-triplets with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf mohar07/qwen3-0.6b-kg-triplets:F16
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mohar07/qwen3-0.6b-kg-triplets:F16" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Qwen3-0.6B-KG-Triplets
Qwen3-0.6B-KG-Triplets is a LoRA finetuned version of Qwen3-0.6B specialized for ontology-constrained knowledge graph extraction.
Given a passage of text, the model generates structured triplets in the form:
source -> relation -> target
where:
"source"contains an entity title and type"relation"contains a relation type and confidence weight"target"contains an entity title and type
The output is designed for direct ingestion into graph databases and GraphRAG pipelines with minimal post-processing.
Motivation
Most instruction-tuned LLMs can extract entities and relations, but their outputs are difficult to ingest directly into graph databases because of:
- inconsistent entity naming
- out-of-schema relations
- poorly calibrated confidence scores
- inconsistent JSON formatting
This model was finetuned specifically to produce:
- ontology-constrained outputs
- normalized entity names
- calibrated relation confidence weights
- graph-ingestable JSON
Model Details
| Property | Value |
|---|---|
| Base Model | unsloth/qwen3-0.6b |
| Finetuning | LoRA |
| Rank (r) | 32 |
| Alpha | 32 |
| Context Length | 2048 |
| Epochs | 5 |
| Optimizer | AdamW 8-bit |
| Framework | Unsloth + TRL |
| Training Type | Instruction Finetuning |
| License | MIT |
Training Configuration
model = FastLanguageModel.get_peft_model(
model,
r=32,
target_modules=[
"q_proj",
"k_proj",
"v_proj",
"o_proj",
"gate_proj",
"up_proj",
"down_proj",
],
lora_alpha=32,
lora_dropout=0,
bias="none",
use_gradient_checkpointing="unsloth",
)
| Parameter | Value |
|---|---|
| Batch size | 2 |
| Gradient accumulation | 4 |
| Learning rate | 5e-5 |
| Epochs | 5 |
| Warmup steps | 50 |
| Max sequence length | 2048 |
| Optimizer | AdamW 8-bit |
| Seed | 42 |
Dataset
The model was trained on a custom instruction dataset for structured knowledge graph extraction.
Corpus Sources
- Wikipedia
- arXiv papers
Dataset Statistics
| Split | Examples |
|---|---|
| Train | 2575 |
| Validation | 75 |
| Test | 700 |
| Total | 3350 |
Additional properties:
- 20 ontology relations
- 15% hard negatives in training
- Entity-level train/test decontamination
- Curriculum ordering (easy → hard)
- Zero schema errors
Relation Schema
The model predicts only the following ontology:
implements
trained_on
evaluates
part_of
introduces
extends
depends_on
contrasts_with
applied_to
measured_by
founded_by
developed_by
defined_as
consists_of
is_type_of
based_on
used_for
created_by
located_in
predecessor_of
Relations outside this ontology are intentionally not generated.
Dataset Creation Pipeline
The training corpus was built using a multi-stage pipeline:
- Corpus collection from Wikipedia and arXiv
- Language and quality filtering
- MinHash deduplication
- LLM triplet generation using DeepSeek V4-Flash
- Schema validation
- Semantic validation
- Hard negative generation
- Curriculum ordering
- Entity-level train/test decontamination
- Train / Validation / Test split
Training Example
Input:
{
"role": "user",
"content": "Extract knowledge graph triplets..."
}
Output:
[
{
"source": {
"title": "September",
"type": "entity"
},
"relation": {
"type": "part_of",
"weight": 0.92
},
"target": {
"title": "Gregorian calendar",
"type": "entity"
}
},
{
"source": {
"title": "September",
"type": "entity"
},
"relation": {
"type": "defined_as",
"weight": 0.92
},
"target": {
"title": "ninth month",
"type": "concept"
}
}
]
Evaluation
Evaluation was performed using a custom triplet extraction benchmark with Hungarian bipartite matching alignment on 700 held-out entries.
Metrics
| Metric | Score | Weight |
|---|---|---|
| Schema score | 1.000 | 0.30 |
| Entity F1 | 0.179 | 0.25 |
| Relation accuracy | 0.680 | 0.20 |
| Grounding | 0.969 | 0.15 |
| Weight score | 0.526 | 0.10 |
| Triplet F1 (info only) | 0.122 | — |
| Type agreement (info only) | 0.854 | — |
| Hallucination rate | 0.033 | — |
Composite Score: 0.6583
What Finetuning Fixed
Finetuning addressed three major failure modes of the base model.
1. Entity Normalization
Input passage:
Studies of the Cambrian period document the rapid diversification of animal life and the emergence of most major animal phyla, with some researchers proposing that a celestial body impact may have triggered the extinction events that preceded this radiation.
Base entity title extracted:
After a thorough research on the circumstantial changes and the great evolution of life in the Cambrian period
Finetuned entity title extracted:
Celestial body impact hypothesis
The finetuned model learns reusable and atomic graph nodes rather than copying passage fragments.
2. Schema Adherence
Base relations generated:
released
benefited_from
Finetuned relations generated:
based_on
used_for
applied_to
introduces
All generated relations belong to the predefined ontology.
3. Confidence Calibration
Base weights:
0.8
0.8
0.8
0.8
Finetuned weights:
0.23
0.41
0.59
0.77
The model learns meaningful confidence distributions where stronger relations receive higher scores.
Intended Use
This model is intended for:
- Knowledge Graph Construction
- GraphRAG pipelines
- Structured Information Extraction
- Entity-Relation Extraction
- Automated KG population
- Document-to-Graph conversion
Limitations
While the model demonstrates strong schema adherence and grounding, several limitations remain.
Shallow Entity Abstraction
The model favors concise and reusable entities but may miss deeper semantic abstractions or hierarchical entity relationships.
Limited Recall
The model prioritizes schema correctness and grounded extraction over exhaustive triplet recall. Entity F1 of 0.179 reflects strict Hungarian-matching alignment on a 20-relation ontology-constrained task; recall is intentionally traded for precision and schema adherence.
English-Centric Training
Training was primarily conducted on English Wikipedia and arXiv passages.
Ontology Constrained
Only the predefined 20 relation types are supported.
Model Size Constraints
Despite the relatively small size (0.6B parameters) and a modest training corpus (~3K examples), the model learns stable ontology-constrained extraction behavior. Larger models may achieve deeper entity understanding and broader relation coverage.
Repository
Evaluation Pipeline: https://github.com/mohar-xe/HGR-finetuned-model-evaluation-pipeline
Model: https://huggingface.co/mohar07/qwen3-0.6b-kg-triplets
Citation
@misc{das2026qwenkgtriplets,
title={Qwen3-0.6B-KG-Triplets},
author={Mohar Das},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/mohar07/qwen3-0.6b-kg-triplets}
}
- Downloads last month
- 35