Views
No views yet
[Label]...[/Label] tags -- Contribution,
Method, Result, Evidence, Limitation, FutureWork,
Safety. Built as the generative comparison point against a
fine-tuned token classifier
in the same project, to empirically test whether a small generative model's
flexibility beats a purpose-built classifier for this task.| Exact-match micro F1 | Faithful generations | Latency | |
|---|---|---|---|
| This model (faithful examples only) | 0.23 | 9/21 (43%) | ~21.5s/abstract |
| Classifier | 0.16 | n/a (always well-formed) | <1s/abstract |
1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
4
5tokenizer = AutoTokenizer.from_pretrained("Rychanfox/semantic-highlighting-qwen2.5-1.5b-lora")
6quant_config = BitsAndBytesConfig(
7 load_in_4bit=True, bnb_4bit_quant_type="nf4",
8 bnb_4bit_compute_dtype=torch.bfloat16, bnb_4bit_use_double_quant=True,
9)
10base_model = AutoModelForCausalLM.from_pretrained(
11 "Qwen/Qwen2.5-1.5B-Instruct", quantization_config=quant_config, device_map="auto"
12)
13model = PeftModel.from_pretrained(base_model, "Rychanfox/semantic-highlighting-qwen2.5-1.5b-lora")slm/ module (build_messages, parse_tags, predict).Rychanfox/semantic-highlighting-abstracts dataset as
the classifier, serialized into the [Label]...[/Label] inline-tag format
as the target completion (system prompt describes the label schema; loss is
masked to the completion only, not the prompt).