Instructions to use tensorhydra/qwen3-8b-aimo3-tir with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tensorhydra/qwen3-8b-aimo3-tir with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tensorhydra/qwen3-8b-aimo3-tir") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForMultimodalLM tokenizer = AutoTokenizer.from_pretrained("tensorhydra/qwen3-8b-aimo3-tir") model = AutoModelForMultimodalLM.from_pretrained("tensorhydra/qwen3-8b-aimo3-tir") 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 tensorhydra/qwen3-8b-aimo3-tir with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tensorhydra/qwen3-8b-aimo3-tir" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tensorhydra/qwen3-8b-aimo3-tir", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tensorhydra/qwen3-8b-aimo3-tir
- SGLang
How to use tensorhydra/qwen3-8b-aimo3-tir 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 "tensorhydra/qwen3-8b-aimo3-tir" \ --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": "tensorhydra/qwen3-8b-aimo3-tir", "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 "tensorhydra/qwen3-8b-aimo3-tir" \ --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": "tensorhydra/qwen3-8b-aimo3-tir", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tensorhydra/qwen3-8b-aimo3-tir with Docker Model Runner:
docker model run hf.co/tensorhydra/qwen3-8b-aimo3-tir
Qwen3-8B AIMO3 Tool-Integrated Reasoning
Model Summary
A LoRA fine-tuned version of Qwen-8B trained for tool-integrated reasoning on the AIMO3 competition dataset (generated by GPT-OSS-120B). The LoRA adapters have been merged into the base model and saved in SafeTensors format for straightforward deployment.
| Property | Details |
|---|---|
| Base Model | Qwen-8B |
| Fine-tuning Method | LoRA (merged) |
| Format | SafeTensors (BF16) |
| Parameters | ~8B |
| Disk Size | ~16GB |
| Max Context | 8192 tokens |
Model Details
LoRA Configuration
| Hyperparameter | Value |
|---|---|
| Rank (r) | 16 |
| Alpha | 32 |
| Dropout | 0.05 |
| Bias | none |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
Training Hyperparameters
| Hyperparameter | Value |
|---|---|
| Precision | BFloat16 (no quantization) |
| Epochs | 2 |
| Steps | 8750 (~1 epoch) |
| Per-device Batch Size | 2 |
| Gradient Accumulation Steps | 8 (effective batch: 16) |
| Learning Rate | 2e-4 |
| LR Scheduler | Cosine with warmup |
| Warmup Ratio | 0.03 |
| Weight Decay | 0.01 |
| Max Gradient Norm | 1.0 |
| Max Sequence Length | 8192 |
| Optimizer | AdamW (Fused) |
Hardware & Infrastructure
- Platform: Kaggle
- GPU: Single NVIDIA H100 (80GB)
- Attention: Flash Attention 2
- Optimizations: Gradient checkpointing, TF32, fused optimizer
Training Data
- Dataset: AIMO3 Tool-Integrated Reasoning Dataset (synthesized by GPT-OSS-120B)
- Split: 97.5% train / 2.5% validation
- Format: CSV with problemβsolution pairs
Supported column names:
- Input:
problem,question,input,prompt - Output:
solution,answer,output,response,completion
Instruction Format
Training uses a ChatML-style format:
<|im_start|>user
{prompt}<|im_end|>
<|im_start|>assistant
{response}<|im_end|>
Training Loss
The model is trained for 8750 steps (~ 1 epoch) before stopping. Below are the train and validation loss curves for the entire training session.
Usage
Load the Model
Since the LoRA adapters are already merged, PEFT is not required:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model = AutoModelForCausalLM.from_pretrained(
"tensorhydra/qwen-8b-aimo3-reasoning",
trust_remote_code=True,
torch_dtype=torch.bfloat16,
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(
"tensorhydra/qwen-8b-aimo3-reasoning",
trust_remote_code=True
)
Inference
prompt = "Solve this problem: What is 2 + 2?"
formatted_prompt = f"user\n{prompt}\nassistant\n"
inputs = tokenizer(formatted_prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=False)
print(response)
Batch Inference
prompts = [
"Solve: 15 + 27 = ?",
"What is the derivative of x^2?",
"Calculate the area of a circle with radius 5"
]
formatted_prompts = [
f"user\n{p}\nassistant\n"
for p in prompts
]
inputs = tokenizer(formatted_prompts, return_tensors="pt", padding=True).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.7, do_sample=True)
for response in tokenizer.batch_decode(outputs, skip_special_tokens=False):
print(response)
print("-" * 80)
Quantized Inference (Lower VRAM)
# 8-bit (~8GB VRAM)
model = AutoModelForCausalLM.from_pretrained(
"tensorhydra/qwen-8b-aimo3-reasoning",
load_in_8bit=True,
device_map="auto"
)
# 4-bit (~4GB VRAM)
model = AutoModelForCausalLM.from_pretrained(
"tensorhydra/qwen-8b-aimo3-reasoning",
load_in_4bit=True,
device_map="auto"
)
Memory Requirements
| Mode | VRAM |
|---|---|
| BF16 (full) | ~16GB |
| 8-bit quantized | ~8GB |
| 4-bit quantized | ~4GB |
Repository Structure
model/
βββ config.json
βββ generation_config.json
βββ model.safetensors.index.json
βββ model-00001-of-0000X.safetensors
βββ ...
βββ tokenizer_config.json
βββ tokenizer.json
βββ special_tokens_map.json
Intended Use
- Mathematical reasoning and problem solving
- Tool-integrated step-by-step reasoning
- Educational and research applications
- Production deployment (merged model, no PEFT dependency)
Limitations
- Fine-tuned on a narrow reasoning domain; may not generalize well to other tasks
- Hard context limit of 8192 tokens
- Performance is bounded by the quality and distribution of the synthetic training data
- Full merged model requires ~16GB storage (vs. ~100β200MB for LoRA adapters alone)
Links
- Dataset: jeannkouagou/aimo3-tool-integrated-reasoning
- Fine-tuning Notebook: tensorhydra/qwen3-8b-aimo3-finetune
Citation
@misc{qwen-lora-aimo3,
title = {Qwen-8B LoRA Fine-tuned for Tool-Integrated Reasoning},
author = {tensorhydra},
year = {2025},
howpublished = {Kaggle Model Hub},
note = {Merged LoRA model in SafeTensors format}
}
Acknowledgements
- Base model: Qwen-8B by Alibaba Cloud
- Training frameworks: Hugging Face Transformers & PEFT
- Dataset synthesis: GPT-OSS-120B
- Serialization: SafeTensors
- Training platform: Kaggle (H100 GPU)
License
This model inherits the license of the base Qwen-8B model. Please refer to the Qwen license terms before use.
- Downloads last month
- 5
