Instructions to use krogoldAI/QueryRefiner-0.5B-v0.1-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use krogoldAI/QueryRefiner-0.5B-v0.1-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="krogoldAI/QueryRefiner-0.5B-v0.1-SFT") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("krogoldAI/QueryRefiner-0.5B-v0.1-SFT") model = AutoModelForCausalLM.from_pretrained("krogoldAI/QueryRefiner-0.5B-v0.1-SFT", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use krogoldAI/QueryRefiner-0.5B-v0.1-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "krogoldAI/QueryRefiner-0.5B-v0.1-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "krogoldAI/QueryRefiner-0.5B-v0.1-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/krogoldAI/QueryRefiner-0.5B-v0.1-SFT
- SGLang
How to use krogoldAI/QueryRefiner-0.5B-v0.1-SFT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "krogoldAI/QueryRefiner-0.5B-v0.1-SFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "krogoldAI/QueryRefiner-0.5B-v0.1-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "krogoldAI/QueryRefiner-0.5B-v0.1-SFT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "krogoldAI/QueryRefiner-0.5B-v0.1-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use krogoldAI/QueryRefiner-0.5B-v0.1-SFT with Docker Model Runner:
docker model run hf.co/krogoldAI/QueryRefiner-0.5B-v0.1-SFT
Update README.md
Browse files
README.md
CHANGED
|
@@ -325,69 +325,6 @@ analysis = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
| 325 |
print(analysis)
|
| 326 |
```
|
| 327 |
|
| 328 |
-
## Evaluation and Performance
|
| 329 |
-
|
| 330 |
-
The model was trained on data that passed stringent quality thresholds, with all training examples achieving perfect structural conformance and semantic quality scores of 4 or higher across six evaluation dimensions: domain accuracy, intent accuracy, ambiguity assessment, rephrasing quality, intent preservation, and guideline adherence. This ensures the model learned from consistently high-quality demonstrations of the desired behavior.
|
| 331 |
-
|
| 332 |
-
#### Table 1 - Structural validity metrics (% of outputs meeting each requirement).
|
| 333 |
-
|
| 334 |
-
|Score|Qwen2.5-0.5B-Instruct|QueryRefiner-0.5B-v0.1|
|
| 335 |
-
|----:|:-------------------:|:--------------------:|
|
| 336 |
-
|Tag structure|10.8%|99.9%|
|
| 337 |
-
|XML validity|40.8%|99.6%|
|
| 338 |
-
|Order|2.0%|99.9%|
|
| 339 |
-
|Confidence|3.1%|99.9%|
|
| 340 |
-
|Perfectly structured output|0.0%|99.6%|
|
| 341 |
-
|
| 342 |
-
#### Table 2 - Semantic scores.
|
| 343 |
-
|
| 344 |
-
|Score|QueryRefiner-0.5B-v0.1|
|
| 345 |
-
|----:|:--------------------:|
|
| 346 |
-
|Domain accuracy|98.77 ± 9.51%|
|
| 347 |
-
|Intent accuracy|98 ± 9.87%|
|
| 348 |
-
|Ambiguity assessment|98.85 ± 8.14%|
|
| 349 |
-
|Rephrasing quality|88.05 ± 18.61%|
|
| 350 |
-
|Intent preservation|94.90 ± 16.29%|
|
| 351 |
-
|Follows guidelines|96.83 ± 14.43%|
|
| 352 |
-
|Overall semantic score|95.9 ± 10.64%|
|
| 353 |
-
|
| 354 |
-
<!-- |Score|Qwen2.5-0.5B-Instruct|QueryRefiner-0.5B-v0.1|
|
| 355 |
-
|----:|:-------------------:|:--------------------:|
|
| 356 |
-
|Domain accuracy|3.95 ± 19.3%|98.77 ± 9.51%|
|
| 357 |
-
|Intent accuracy|3.95 ± 19.2%|98 ± 9.87%|
|
| 358 |
-
|Ambiguity assessment|9.67 ± 21.6%|98.85 ± 8.14%|
|
| 359 |
-
|Rephrasing quality|8.5 ± 16.6%|88.05 ± 18.61%|
|
| 360 |
-
|Intent preservation|3.85 ± 18.7%|94.90 ± 16.29%|
|
| 361 |
-
|Follows guidelines|3.6 ± 17.8%|96.83 ± 14.43%|
|
| 362 |
-
|Overall semantic score|4.73 ± 18.1%|95.9 ± 10.64%| -->
|
| 363 |
-
|
| 364 |
-
Semantic metrics are computed only on structurally valid XML outputs. The base model produced too few valid XML samples for meaningful semantic evaluation. All values are reported as mean ± standard deviation (%), computed over test examples. <!-- Symbol "—" indicates no valid XML samples for evaluation. -->
|
| 365 |
-
|
| 366 |
-
<details>
|
| 367 |
-
<summary><i>Unroll to see evaluation detail and methodology</i></summary>
|
| 368 |
-
|
| 369 |
-
Evaluated on 1,000 examples from the test split of [krogoldAI/rag-ambiguous-queries](https://huggingface.co/datasets/krogoldAI/rag-ambiguous-queries).
|
| 370 |
-
|
| 371 |
-
**Structure scores**: Percentage of test examples that satisfied each structural requirement:
|
| 372 |
-
- *Tag structure*: All required XML tags are present
|
| 373 |
-
- *XML validity*: Output is well-formed, valid XML
|
| 374 |
-
- *Order*: Required tags appear in the correct sequence
|
| 375 |
-
- *Confidence*: Confidence values are properly formatted and sum to `1.0`
|
| 376 |
-
|
| 377 |
-
**Semantic scores**: LLM-as-judge ratings on a 1-5 scale, normalized to percentages and averaged across all test examples.
|
| 378 |
-
</details>
|
| 379 |
-
|
| 380 |
-
Performance characteristics will vary based on query type, domain, and ambiguity level. The model is expected to perform strongest on queries similar to those in the training distribution and may require additional fine-tuning or prompt engineering for specialized applications or domains underrepresented in the training data.
|
| 381 |
-
|
| 382 |
-
## Acknowledgments
|
| 383 |
-
|
| 384 |
-
This model builds upon [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) by the Qwen team at Alibaba Cloud. The training data incorporates queries from [rag-datasets/rag-mini-wikipedia](https://huggingface.co/datasets/rag-datasets/rag-mini-wikipedia), [razbit96/Ambiguity-Handling-in-User-Queries](https://huggingface.co/datasets/razbit96/Ambiguity-Handling-in-User-Queries), and [glaiveai/RAG-v1](https://huggingface.co/datasets/glaiveai/RAG-v1).
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
| 390 |
-
|
| 391 |
## Evaluation and Performance
|
| 392 |
|
| 393 |
The model was trained on data that passed stringent quality thresholds, with all training examples achieving perfect structural conformance and semantic quality scores of 4 or higher across six evaluation dimensions: domain accuracy, intent accuracy, ambiguity assessment, rephrasing quality, intent preservation, and guideline adherence. This ensures the model learned from consistently high-quality demonstrations of the desired behavior.
|
|
@@ -432,4 +369,8 @@ The model demonstrates strong performance across all semantic dimensions, with p
|
|
| 432 |
|
| 433 |
### Performance Considerations
|
| 434 |
|
| 435 |
-
Performance characteristics will vary based on query type, domain, and ambiguity level. The model is expected to perform strongest on queries similar to those in the training distribution and may require additional fine-tuning or prompt engineering for specialized applications or domains underrepresented in the training data.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 325 |
print(analysis)
|
| 326 |
```
|
| 327 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 328 |
## Evaluation and Performance
|
| 329 |
|
| 330 |
The model was trained on data that passed stringent quality thresholds, with all training examples achieving perfect structural conformance and semantic quality scores of 4 or higher across six evaluation dimensions: domain accuracy, intent accuracy, ambiguity assessment, rephrasing quality, intent preservation, and guideline adherence. This ensures the model learned from consistently high-quality demonstrations of the desired behavior.
|
|
|
|
| 369 |
|
| 370 |
### Performance Considerations
|
| 371 |
|
| 372 |
+
Performance characteristics will vary based on query type, domain, and ambiguity level. The model is expected to perform strongest on queries similar to those in the training distribution and may require additional fine-tuning or prompt engineering for specialized applications or domains underrepresented in the training data.
|
| 373 |
+
|
| 374 |
+
## Acknowledgments
|
| 375 |
+
|
| 376 |
+
This model builds upon [Qwen2.5-0.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-0.5B-Instruct) by the Qwen team at Alibaba Cloud. The training data incorporates queries from [rag-datasets/rag-mini-wikipedia](https://huggingface.co/datasets/rag-datasets/rag-mini-wikipedia), [razbit96/Ambiguity-Handling-in-User-Queries](https://huggingface.co/datasets/razbit96/Ambiguity-Handling-in-User-Queries), and [glaiveai/RAG-v1](https://huggingface.co/datasets/glaiveai/RAG-v1).
|