Downloads · 30 days
0
Nitin1211/dbpedia-hindi-gemma3-4b-lr2e4
dbpedia-hindi-gemma3-4b-lr2e4 is a machine learning model from Nitin1211. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
markdown --- basemodel: google/gemma-3-4b-it libraryname: peft tags: - lora - qlora - hindi - relation-extraction - knowledge-graph - dbpedia license: gemma language: - hi ---
Downloads · 30 days
0
Access
Public
Updated Aug 7, 2026
Repo size
99.1 MB
Likes
0
Public
Click a slice to open those files.
.safetensors65.7 MB · 66%
From the Hugging Face model README
base_model: google/gemma-3-4b-it library_name: peft tags:
A QLoRA fine-tuned adapter for Gemma 3 4B, trained to extract subject-relation-object triples directly from Hindi sentences, as part of the DBpedia Hindi Chapter (Google Summer of Code 2026).
google/gemma-3-4b-itGiven a raw Hindi sentence, the model outputs every extractable (subject, relation, object) triple, one per line, in the format:
subject | relation | object
Each relation is also tagged as either a genuine relational fact or property (a non-relational descriptive fragment, e.g. adjective+noun) — property-type triples are excluded from downstream DBpedia matching.
Evaluated across three sources: 1,817 Wikipedia sentences, 50 Train sentences, 112 BenchIE sentences (an independent, human-verified benchmark).
| Source | Precision | Recall | F1 |
|---|---|---|---|
| Wikipedia | 0.569 | 0.555 | 0.554 |
| Train | 0.608 | 0.630 | 0.610 |
| BenchIE | 0.050 | 0.068 | 0.056 |
| Source | Precision | Recall | F1 |
|---|---|---|---|
| Wikipedia | 0.498 | 0.493 | 0.493 |
| Train | 0.550 | 0.530 | 0.537 |
| BenchIE | 0.192 | 0.165 | 0.173 |
Compared against an untrained base Gemma 3 4B (same prompt, zero fine-tuning), extraction-only F1: Wikipedia 0.024, Train 0.014, BenchIE 0.016 — fine-tuning improved Wikipedia F1 by roughly 23x and Train F1 by roughly 44x.
Honest note on BenchIE: BenchIE's extraction-only F1 is substantially lower than its full-pipeline F1. Manual inspection found the model consistently trims Hindi postpositions (का/की/में) that BenchIE's gold spans retain, causing exact-match failures despite the core relation being correctly identified in nearly every checked case.
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
BASE_MODEL = "google/gemma-3-4b-it"
ADAPTER = "Nitin1211/dbpedia-hindi-gemma3-4b-lr2e4"
tokenizer = AutoTokenizer.from_pretrained(ADAPTER)
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
)
base_model = AutoModelForCausalLM.from_pretrained(
BASE_MODEL, quantization_config=bnb_config, device_map="auto"
)
model = PeftModel.from_pretrained(base_model, ADAPTER)
model.eval()
Important: generation must stop on either the base eos_token_id or Gemma's <end_of_turn> token — relying on eos_token_id alone causes valid outputs to loop past their real answer.
This extraction model is the first stage of a full pipeline: extraction → predicate normalization (F2LLM-1.7B) → human review → DBpedia knowledge graph. Full code, documentation, and the normalization model: https://github.com/singhhnitin/neural-extraction-framework/tree/gsoc26h-development/GSoC26_H
Inherits Gemma's license terms (see base model). This adapter itself contains no base model weights, only the trained LoRA delta.