Skip to main content

Qwen3.6-35B-A3B: เลือก parameters ตาม use case

· 6 min read

Context

Qwen3.6-35B-A3B รันอยู่บน DGX Spark (port 8001, vLLM v0.23.0, 128K context)

ที่ผ่านมาใช้ temperature 0.6 ตาม --override-generation-config ของ recipe แต่พออ่าน HF model card ละเอียด ๆ เจอว่า Qwen team เองใช้ค่า ต่างกัน ในแต่ละ benchmark category

เลยรวบรวมมาเป็น note สั้น ๆ เพื่อใช้อ้างอิง

TL;DR

Qwen3.6-35B-A3B มี sampling parameters ที่แตกต่างกันระหว่าง "eval notes" (สำหรับรายงาน benchmark) กับ "Best Practices" (สำหรับใช้งานจริง) โดยเฉพาะ temperature: eval notes ใช้ temp=1.0 กับ agentic coding (SWE-bench, Terminal-Bench) แต่ Best Practices แนะนำ temp=0.6 สำหรับ precise coding (WebDev) และ temp=1.0 สำหรับ general thinking tasks บทความนี้สรุปทั้งสองมุมมอง พร้อมแผนปรับใช้บน DGX Spark (vLLM 0.23.0, 128K context)

Default server config บน DGX (ปัจจุบัน)

max_model_len: 131072
temperature: 0.6
top_p: 0.95
top_k: 20
min_p: 0.0
enable_thinking: true # จาก default-chat-template-kwargs
preserve_thinking: true
reasoning_parser: qwen3
speculative: mtp k=2

หมายเหตุ: maxOutputTokens เป็น client-side parameter (max_tokens ใน API request) — ไม่มี server default ใน vLLM นอกจากนี้ presence_penalty และ repetition_penalty ไม่ได้ตั้งใน server config ปัจจุบัน แต่ Best Practices ของ Qwen แนะนำให้ใช้ (ดูด้านล่าง)

Qwen's own eval notes (จาก HF model card)

Qwen team ระบุ sampling settings ที่ใช้ในแต่ละ benchmark ไว้ใน evaluation notes:

Benchmarktemperaturetop_ptop_kmax_tokensContext
SWE-bench series1.00.95--200K
Terminal-Bench 2.01.00.952080K256K
QwenClawBench (general agent)0.6---256K
NL2Repo (via Claude Code)1.00.95--max_turns=900

Pattern ที่เห็นจาก eval notes:

  • Agentic coding (SWE-bench, Terminal-Bench) → temperature 1.0
  • General agent (QwenClawBench) → temperature 0.6

สำคัญ: eval notes คือ setting ที่ใช้รายงาน benchmark ไม่ใช่ recommendation สำหรับใช้งานทั่วไป ดู Best Practices ด้านล่างสำหรับค่าที่แนะนำจริง

Best Practices จาก HF model card

Qwen team แบ่ง recommendation ตาม mode/task type:

Mode/Tasktemperaturetop_ptop_kmin_ppresence_penaltyrepetition_penalty
Thinking mode — general tasks1.00.95200.01.51.0
Thinking mode — precise coding (เช่น WebDev)0.60.95200.00.01.0
Instruct / non-thinking mode0.70.80200.01.51.0

หมายเหตุ: presence_penalty ปรับได้ตั้งแต่ 0 ถึง 2 เพื่อลดการวนซ้ำ แต่ค่าสูงอาจทำให้เกิด language mixing และลด performance เล็กน้อย

Output length ที่แนะนำ:

  • ทั่วไป: 32,768 tokens
  • โจทย์ซับซ้อน (math, programming competition): 81,920 tokens

Per-use-case recommendations

1. Coding agent

ParamValueNote
temperature1.0agentic coding (multi-step)
top_p0.95default
presence_penalty1.5ลดการวนซ้ำใน long session
max_tokens16K-80Kขึ้นอยู่กับ task
enable_thinkingtruereasoning ช่วย code quality
Context128K+repo-level tasks ต้องการ

Benchmarks: SWE-bench Verified 73.4, SWE-bench Pro 49.5, Terminal-Bench 51.5, Claw-Eval 68.7 (สูงสุดใน class)

สำหรับ precise coding (เช่น single-shot WebDev) Best Practices แนะนำ temperature=0.6, presence_penalty=0.0

2. General agent (multi-step tool use)

ParamValueNote
temperature0.6ตาม QwenClawBench eval
top_p0.95default
presence_penalty1.5ลดการวนซ้ำ
max_tokens4K-8Kพอสำหรับ tool trace
enable_thinkingtrueช่วยวางแผน
Context128K

Benchmarks: Widesearch 60.1, MCPMark 37.0, Tool Decathlon 26.9, QwenClawBench 52.6

3. STEM / Reasoning

ParamValueNote
temperature1.0ตาม Best Practices (general thinking)
top_p0.95
presence_penalty1.5
max_tokens8K-81Kโจทย์ง่าย 8K ซับซ้อน 81K
enable_thinkingtrueจำเป็น
Context128K

Benchmarks: AIME26 92.7, GPQA Diamond 86.0, HMMT Feb 26 83.6 (สูงสุดใน class)

4. Knowledge Q&A

ParamValueNote
temperature0.6-1.0ลงต่ำถ้าต้องการคำตอบแม่นยำ
top_p0.95
presence_penalty1.5
max_tokens2K-32Kทั่วไป 2-4K, วิเคราะห์ลึก 32K
enable_thinkingtrue
Context32Kส่วนใหญ่พอ

Benchmarks: MMLU-Pro 85.2, C-Eval 90.0, SuperGPQA 64.7

Decision tree

แผนที่จะใช้

Workloadtemperaturemax_tokensthinkingเหตุผล
bot4k backtest0 (reproducibility)3000trueตรรกะแม่นยำแบบ deterministic
bot4k live trading0.23000trueสุ่มเล็กน้อย
Hermes coding1.08000-16000trueตาม Qwen agentic coding recommendation
Long doc analysis0.64000true128K context เพียงพอ
Math/reasoning task1.08000trueAIME26 92.7

Caveats

  • Context length — HF card ระบุชัด: "Maintain at least 128K tokens to preserve thinking capabilities" → recipe 128K ของเราพอดี
  • 128K vs native 262K — model รองรับ 262K แต่เราใช้ 128K (max_model_len ใน recipe) เพราะ memory constraint บน single Spark
  • max_num_seqs drop — 128K recipe ลดจาก 40 เหลือ 12 เพราะ KV cache ใหญ่ขึ้น
  • MTP k=2 — ทดสอบแล้ว stable บน short prompt (58-64 tok/s) แต่ long prompt (16K+) อาจต่างจาก k=1

วิธี override ใน client

vLLM server defaults เป็น temperature 0.6 แต่ client สามารถ override ต่อ request ได้

const result = await generateText({
model,
temperature: 1.0, // override 0.6 → 1.0
maxOutputTokens: 8000, // ขึ้นอยู่กับ task
providerOptions: {
openai: {
reasoningEffort: 'medium' // ใช้ค่านี้ร่วมกับ temperature
}
},
// ...
})

reasoning_effort เป็น vLLM 0.23.0 OpenAI API field — ต่างจาก Qwen eval notes ที่ใช้ temperature เป็นหลัก แต่ใช้ร่วมกันได้

Conclusion

Qwen3.6-35B-A3B ไม่มี "ค่าเดียวที่ใช้ได้ทุกอย่าง" แต่มี eval notes สำหรับ benchmark กับ Best Practices สำหรับใช้งานจริงที่ต่างกัน จุดที่ต้องจำ:

  • Agentic coding (SWE-bench, Terminal-Bench): eval ใช้ temp=1.0 — แต่ถ้าเป็น single-shot precise coding ให้ลงมา 0.6
  • General thinking tasks (STEM, reasoning): Best Practices แนะนำ temp=1.0 + presence_penalty=1.5
  • presence_penalty สำคัญ — ไม่ได้ตั้งใน server config ปัจจุบัน แต่ Best Practices แนะนำ 1.5 สำหรับทั่วไป และ 0.0 สำหรับ precise coding
  • Output length — 32K สำหรับทั่วไป 81K สำหรับโจทย์ซับซ้อน

การ override ผ่าน client ต่อ request เป็นวิธีที่ยืดหยุ่นที่สุด ไม่ต้อง restart server ทุกครั้งที่เปลี่ยน workload

References

  • HF model card — evaluation notes + Best Practices
  • Qwen3.6 blog
  • DGX config: ~/notes/llm-inference/vllm-config-best-value.md
  • vLLM 0.23.0 upgrade notes: ~/notes/llm-inference/vllm-current-status.txt
แชร์บทความ

เนื้อหานี้มีประโยชน์ไหม? ช่วยสนับสนุนค่ากาแฟให้ผู้เขียนสักแก้ว

Buy Me a Coffee
Loading...