Downloads · 30 days
0
tobil/qmd-query-expansion-1.7B-v2
qmd-query-expansion-1.7B-v2 is a machine learning model from tobil. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
Fine-tuned Qwen3-1.7B for query expansion in QMD's hybrid retrieval pipeline.
Downloads · 30 days
0
Access
Public
Updated Apr 24, 2026
Repo size
3.1 GB
Likes
1
Public
Click a slice to open those files.
.safetensors1.5 GB · 99%
From the Hugging Face model README
Fine-tuned Qwen3-1.7B for query expansion in QMD's hybrid retrieval pipeline.
hyde: A hypothetical document passage that would answer the query.
lex: keyword1
lex: keyword2
vec: semantic query reformulation
vec: another semantic variation
| Improvement | v1 | v2 |
|---|---|---|
| LoRA rank | 16 | 64 |
| LoRA target | q/k/v/o/gate/up/down_proj | all-linear |
| LoRA alpha | 32 | 64 |
| LoRA dropout | 0.0 | 0.05 |
| Epochs | 5 | 2 |
| Max length | 512 | 1024 |
| Gradient checkpointing | ❌ | ✅ |
| Dataset size | 2806 train (unversioned) | 2806 train (v2 on Hub) |
Tested on 51 queries covering technical docs, short queries, named entities, personal notes, research, errors, temporal, complex, entity preservation, quoted phrases, negation, and /only: modes.
| Metric | v1 | v2 | Delta |
|---|---|---|---|
| Average score | 36.6/100 | 40.4/100 | +3.8 |
| v2 wins / v1 wins / ties | — | 11 | 2 |
Biggest improvements (all on /only: mode — the hardest edge cases):
| Query | v1 | v2 |
|---|---|---|
auth /only:lex | 20 | 50 |
React hooks tutorial /only:lex | 20 | 50 |
kubernetes pod deployment /only:vec | 20 | 50 |
how to configure authentication /only:vec | 20 | 50 |
TDS motorsports history /only:hyde | 10 | 40 |
AWS Lambda cold start /only:hyde | 5 | 40 |
v2 is significantly better at respecting /only: constraints and generating the correct output type.
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
import torch
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-1.7B",
torch_dtype=torch.bfloat16,
device_map="auto",
)
model = PeftModel.from_pretrained(base, "tobil/qmd-query-expansion-1.7B-v2")
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-1.7B")
prompt = tokenizer.apply_chat_template(
[{"role": "user", "content": "/no_think Expand this search query: kubernetes pod networking"}],
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=400, do_sample=False)
result = tokenizer.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(result)
@software{vonwerra2020trl,
title = {{TRL: Transformers Reinforcement Learning}},
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
license = {Apache-2.0},
url = {https://github.com/huggingface/trl},
year = {2020}
}