Downloads · 30 days
0
caraman/Qwen2.5-7B-query-rewriter-lora
Qwen2.5-7B-query-rewriter-lora is a text generation model from caraman. Use it when you need the model to write or continue text. It is set up for mlx. The card lists the license as apache-2.0.
Fine-tuned LoRA adapter for query rewriting in multi-turn conversational retrieval (MTRAGEval Task A).
Downloads · 30 days
0
Access
Public
Updated Jan 8, 2026
Repo size
162 MB
Likes
0
Public
Click a slice to open those files.
.safetensors162 MB · 100%
From the Hugging Face model README
Fine-tuned LoRA adapter for query rewriting in multi-turn conversational retrieval (MTRAGEval Task A).
The model resolves pronouns and includes necessary context from conversation history:
| Original Query | Rewritten Query |
|---|---|
| "What about Germany?" (after asking about France's capital) | "What is the capital of Germany?" |
| "How much does it cost?" (after discussing iPhone 15 Pro) | "What is the price of the iPhone 15 Pro?" |
from mlx_lm import load, generate
# Load base model with adapter
model, tokenizer = load(
"Qwen/Qwen2.5-7B-Instruct",
adapter_path="caraman/Qwen2.5-7B-query-rewriter-lora"
)
# Prepare prompt
system_prompt = """You are a query rewriting assistant for information retrieval. Given a conversation history and a current question, rewrite the question to be completely standalone and self-contained."""
messages = [
{"role": "system", "content": system_prompt},
{"role": "user", "content": """CONVERSATION HISTORY:
USER: Tell me about the Eiffel Tower
ASSISTANT: The Eiffel Tower is in Paris, France.
CURRENT QUESTION: When was it built?
Rewrite this question to be standalone:"""}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
response = generate(model, tokenizer, prompt=prompt, max_tokens=256)
print(response) # "When was the Eiffel Tower built?"
Extracted from MTRAG Benchmark human query rewrites across 4 domains:
Evaluated on 164 holdout conversation queries with nDCG@10 for retrieval performance.
@inproceedings{mtrageval2026,
title={MTRAGEval: Multi-Turn Retrieval-Augmented Generation Evaluation},
booktitle={SemEval 2026 Task 8},
year={2026}
}
Apache 2.0