Instructions to use Levi980623/Qwen3-4B-Plan-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Levi980623/Qwen3-4B-Plan-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Levi980623/Qwen3-4B-Plan-SFT") 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("Levi980623/Qwen3-4B-Plan-SFT") model = AutoModelForCausalLM.from_pretrained("Levi980623/Qwen3-4B-Plan-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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Levi980623/Qwen3-4B-Plan-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Levi980623/Qwen3-4B-Plan-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": "Levi980623/Qwen3-4B-Plan-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Levi980623/Qwen3-4B-Plan-SFT
- SGLang
How to use Levi980623/Qwen3-4B-Plan-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 "Levi980623/Qwen3-4B-Plan-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": "Levi980623/Qwen3-4B-Plan-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 "Levi980623/Qwen3-4B-Plan-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": "Levi980623/Qwen3-4B-Plan-SFT", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Levi980623/Qwen3-4B-Plan-SFT with Docker Model Runner:
docker model run hf.co/Levi980623/Qwen3-4B-Plan-SFT
Qwen3-4B-Plan-SFT
SURE-style Stage 1 strategy-guided SFT of Qwen/Qwen3-4B: given a math problem, the model
first writes a concise high-level strategy, then an execution that follows it, then the final answer in \boxed{}.
Full-parameter fine-tune (no LoRA), one causal LM, one autoregressive response; no planner/executor bridge, no latent/RL stage.
Output format (Qwen3-native thinking container)
<think>
<strategy>
...high-level plan...
</strategy>
<execution>
...detailed reasoning...
</execution>
</think>
\boxed{...}
Prompt (user turn), applied with add_generation_prompt=True, enable_thinking=True:
Solve the following mathematics problem.
First write a concise high-level plan inside <strategy>...</strategy>.
Then follow that plan in <execution>...</execution> with detailed reasoning.
Finally provide the answer in \boxed{...}.
Do not include the answer or detailed calculations in the strategy.
Problem:
{question}
Decoding used for all evaluations below: temperature 0.6, top_p 0.95, top_k 20, max 8192 new tokens.
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("Levi980623/Qwen3-4B-Plan-SFT")
model = AutoModelForCausalLM.from_pretrained("Levi980623/Qwen3-4B-Plan-SFT", dtype="auto", device_map="auto")
msgs = [{"role": "user", "content": PROMPT.format(question="What is the sum of the first 100 positive integers?")}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, enable_thinking=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=4096, do_sample=True, temperature=0.6, top_p=0.95, top_k=20)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=False))
Training data
- Source:
open-thoughts/OpenThoughts3-1.2M@61bcf9d4eb38b30295efc2021227a63cc5bb34c8, math domain only, seed 42 streaming sample, deduplicated by normalized question; 9800 train / 200 validation rows. - Execution = the reference write-up after
</think>(300–1,500 tokens); answer = its\boxed{}. Full-row lengths for this tokenizer: max 2994 tokens, mean 808.0 (cap 8192, nothing truncated). - Strategies were extracted from (question, reference) by
Qwen/Qwen3-235B-A22B-Instruct-2507-FP8(revisione156cb4efae4, the official FP8 release of the 235B teacher, self-hosted with vLLM, temperature 0), gated by hard rules (no answer leakage, no tags) and a consistency judge; 2219 rows use a single automatic re-extraction after a leak. - Benchmark contamination filter (exact + 8-gram near-duplicate) against MATH-500, AIME24, AIME25, AMC23: all checked.
reference_verificationper row (advisory 235B judge, not a gold check): judge_approved 3664, judge_flagged 6336, unverified 0. OpenThoughts3 has no gold answers; no accuracy is claimed.
Training (SURE Appendix D / Table 8 Stage-1 settings)
| epochs | lr | warmup | global batch | micro batch | max len | precision | optimizer | sched | wd | clip | distributed |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 3 | 4e-05 | 0.05 | 32 | 1 | 8192 | bf16 compute / fp32 master | AdamW | cosine | 0.01 | 1.0 | FSDP2, 2× L40S |
921 optimizer steps, completion-only token-weighted CE (prompt masked), activation checkpointing, wall-clock ≈ 11.7 h. Final train loss 0.073; validation loss 0.506 (epoch-1 ≈ 0.42: the third epoch over-fits in the usual 3-epoch-SFT way; kept as prescribed).
Evaluation on 200 held-out validation questions (never trained on)
| test | n | result |
|---|---|---|
fresh-process reload (from_pretrained) |
– | PASS; 24/24 sampled tensors changed vs base |
| smoke generation format success | 20 | 95.0% (boxed answer present 95.0%) |
| natural generation: strategy / execution / transition / answer parse | 100 | 100.0% / 100.0% / 100.0% / 100.0% |
natural generation: matches reference \boxed{} |
100 | 24.0% (reference-match, not gold accuracy) |
| self-plan adherence, rubric v1 (strict, penalises arithmetic slips) | 100 | 16.5% followed; undecidable/judge-error 9.0% |
| self-plan adherence, rubric v2 (method-naming) | 100 | 55.0% followed |
| fixed-plan continuation: format / adherence v1 / v2 | 50 | 100.0% / 23.9% / 56.0% |
| valid Plan-A/Plan-B intervention: pairs / method switch success | 26 | 26 valid of 30 (4 not constructible) / 53.8% |
Judge for the adherence tests: Qwen/Qwen3-235B-A22B-Instruct-2507-FP8 (non-thinking, temperature 0).
Status flag: LOW_PLAN_ADHERENCE — the task's acceptance rule treats adherence below 0.70 as low; rubric v2 gives 55.0%, so this is reported as a finding, not hidden. Caveat: under rubric v1 the judge marked most executions "contradicted" for arithmetic or verification mistakes even
when the execution used exactly the strategy's method; rubric v2 asks it to name the method actually used and compare
methods only. Both are reported; neither is a ground-truth measurement. Format compliance is near-perfect, answer
agreement with the (unverified) references is low — this checkpoint is a Stage-1 initialization for later latent-planning
work, not a tuned math solver.
Provenance
Pipeline, tests, dry-runs, decisions and blockers: /PHShome/yl463/sure_stage1_autonomous/ (RESULTS.md, wiki/decisions.md).
Card regenerated 2026-10-10T01:29:07-0400 from the evaluation files; weights unchanged since the training export.
- Downloads last month
- 36