Usage
from transformers import AutoModelForCausalLM, AutoTokenizerfrom peft import PeftModelimport json base = "Qwen/Qwen3-4B"tok = AutoTokenizer.from_pretrained(base)model = AutoModelForCausalLM.from_pretrained(base, torch_dtype="auto", device_map="auto")model = PeftModel.from_pretrained(model, "singhmandavi/kg-slm-scierc-adapter") # prompt: system persona + SciERC ontology + 2 few-shot examples,# enable_thinking=False; greedy decoding; parse with salvage_json# (see kg_slm_phase1_scierc.ipynb, cells 1-4 for exact prompt/eval code)
SciERC test results (n=529, greedy)
Table with columns: metric, base Qwen3-4B, + adapter, + post-processing| metric | base Qwen3-4B | + adapter | + post-processing |
|---|
| schema validity | 0.937 | 1.000 | 1.000 |
| loose F1 | 0.070 | 0.438 | 0.441 |
| boundary (relaxed) F1 | 0.160 | 0.539 | 0.541 |
| Rel+ (published strict) | 0.046 | 0.411 | 0.414 |
| entity typed F1 | 0.316 | 0.666 | 0.669 |
| grounded rate | 0.977 | 0.997 | 1.000 |
Literature comparison: Rel+ 41.1 vs SpERT 38.6, SpERT.PL 39.4, PURE 36.8,
PL-Marker 41.6; boundary 53.9 vs PL-Marker 53.2 (highest verified).
Training
- SciERC train split (1762 docs), 3 epochs, LR 2e-4, seed 42, bf16 on A100
- LoRA r=32, α=64, all 7 projections × 36 layers
- Rank ablation: r=8/16/32 statistically tied on test → r=8 suffices
Limitations
Single domain (CS abstracts), single seed, greedy decoding; entity F1
trails span-pipeline SOTA (~70 vs 66.6).
Citation
See REPORT.md (project report) — key refs: Luan et al. 2018 (SciERC),
Ye et al. 2022 (PL-Marker), Geng et al. 2023 (GCD), Dong et al. 2025
(XGrammar), Hu et al. 2021 (LoRA).