Downloads · 30 days
18
30% of all-time downloads
Nicholas55555/qwen2.5-1.5b-weather-intent-v2
qwen2.5-1.5b-weather-intent-v2 is a text generation model from Nicholas55555. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
QLoRA adapter for Qwen/Qwen2.5-1.5B-Instruct — a production-hardened weather-intent parser (v2). Maps a user message to a structured JSON intent, and rejects what it can't answer instead of confabulating.
Downloads · 30 days
18
30% of all-time downloads
All-time downloads
60
Public
Repo size
48.4 MB
Likes
1
Public
Click a slice to open those files.
.safetensors37 MB · 76%
From the Hugging Face model README
QLoRA adapter for Qwen/Qwen2.5-1.5B-Instruct — a production-hardened weather-intent parser (v2). Maps a user message to a structured JSON intent, and rejects what it can't answer instead of confabulating.
v2 over the v1 SFT baseline (which hit 98.6% exact-match but confabulated on out-of-scope input) adds three independently-measured levers:
intent: "out_of_scope" class + boundary-negative data (fixes confabulation)route() decides accept vs escalate from the structured output (model-cascade){"intent": "weather", "location": "Paris", "date": "this_weekend", "metric": "rain", "time_of_day": null}
{"intent": "out_of_scope", "location": null, "date": null, "metric": null, "time_of_day": null}
| field | values |
|---|---|
intent | weather, out_of_scope |
location | place name, or null |
date | today, tomorrow, day_after_tomorrow, this_weekend, next_weekend, next_week, a weekday, or null |
metric | temperature, rain, snow, wind, humidity, uv, cloud, general |
time_of_day | morning, afternoon, evening, night, or null |
| metric | base | ft | ft_grammar |
|---|---|---|---|
| in-scope slot exact-match | 52.0% | 99.6% | 100.0% |
| OOS recall (rejects unanswerable) | 80.0% | 100.0% | 100.0% |
| FAR — false-accept / confabulation | 20.0% | 0.0% | 0.0% |
| FRR — false-reject | 20.9% | 0.4% | 0.0% |
| out-of-vocab errors | 30 | 1 | 0 |
The honest read: reject-training does the heavy lifting (ft alone drops false-accept to 0); grammar is the last-mile guarantee that drives out-of-vocab to a structural 0. The gate turns structure into a cheap-over-escalation routing decision. Grammar guarantees validity, not correctness — the constraint tax is measured, not assumed.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = "Qwen/Qwen2.5-1.5B-Instruct"
tok = AutoTokenizer.from_pretrained(base)
model = PeftModel.from_pretrained(AutoModelForCausalLM.from_pretrained(base, device_map="auto"), "Nicholas55555/qwen2.5-1.5b-weather-intent-v2")
sys = "You extract structured intent from user messages about weather. Return ONLY a JSON object..."
msgs = [{"role": "system", "content": sys}, {"role": "user", "content": "how's the pollen in Austin?"}]
prompt = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
print(tok.decode(model.generate(**tok(prompt, return_tensors="pt").to(model.device), max_new_tokens=64)[0], skip_special_tokens=True))
# -> {"intent": "out_of_scope", ...} (pollen is not a supported metric)
For guaranteed-valid output, pair with XGrammar constrained decoding against the schema.