Text Generation
Transformers
Safetensors
qwen3
math
reasoning
reinforcement-learning
lora
grpo
conversational
text-generation-inference
Instructions to use willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine") model = AutoModelForCausalLM.from_pretrained("willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine
- SGLang
How to use willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine 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 "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine" \ --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": "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine", "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 "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine" \ --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": "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine with Docker Model Runner:
docker model run hf.co/willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine
File size: 2,617 Bytes
63d4d62 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ---
license: apache-2.0
base_model: Qwen/Qwen3-8B-Base
library_name: transformers
pipeline_tag: text-generation
tags:
- math
- reasoning
- reinforcement-learning
- lora
- grpo
---
# Qwen3-8B SDFT + math GRPO-LoRA (rollout 120)
Qwen3-8B (dense, 36 layers, 8.19B params). **Fully merged bf16 weights** — the LoRA adapter is
folded into the base matrices, so this is a drop-in replacement for `Qwen/Qwen3-8B-Base`; no PEFT
adapter loading required.
## Training pipeline
1. **Base**: `Qwen/Qwen3-8B-Base`.
2. **SFT**: supervised fine-tuning on a balanced oracle mixture (math / retrieval-augmented QA /
tool-use dialogue).
3. **Math RL** (this checkpoint): GRPO on math problems with a verifiable boxed-answer reward,
training LoRA adapters (rank 128, alpha 128 ⇒ scaling 1.0) on `q/k/v`, `o_proj`,
`gate/up_proj` and `down_proj` of every layer, for 120 rollouts. DAPO-style recipe
(clip-higher 0.2/0.28, dynamic sampling, token-level policy-gradient loss) with truncated
importance sampling for the train/rollout mismatch.
Trained with [slime](https://github.com/THUDM/slime) on Megatron-LM (TP=4, CP=1, bf16).
## Honest evaluation note
Over these 120 rollouts the RL stage was **stable but did not measurably improve** the
training-set pass@1 (0.558 → 0.578, linear slope +4e-5 per rollout against a per-rollout standard
deviation of 0.027 — the change is inside the noise). Prompts solved 16/16 rose slightly (50.6 →
56.9 of 256 sampled) and prompts never solved were flat. Treat this as **the SFT model plus a small,
non-degrading RL delta**, not as a demonstrated improvement over the SFT base. It is published for
reproducibility and comparison, and it is the first checkpoint of this line whose frozen base
weights are provably uncorrupted.
## Usage
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "willamazon1/Qwen3-8B-SDFT-Math-LoRA-pristine"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16).to("cuda")
prompt = "Question: What is 12*8?\nAnswer:"
ids = tok(prompt, return_tensors="pt").input_ids.cuda()
print(tok.decode(model.generate(ids, max_new_tokens=64, do_sample=False)[0][ids.shape[1]:],
skip_special_tokens=True))
```
This is a **base-style (completion)** model, not an instruction-tuned chat model: prompt it with
`Question: … \nAnswer:` style completions rather than a chat template.
## Limitations
Inherits the biases and knowledge cutoff of `Qwen3-8B-Base`. Math answers are not guaranteed
correct — verify before relying on them.
|