LLM Cal

LOCAL LLM FIELD GUIDE

Serving Framework: เลือกตามรูปแบบการให้บริการ

ไม่มี framework เดียวชนะทุกงาน. เริ่มจาก hardware และ artifact, จากนั้นเลือกระหว่าง local single-user, simple API, high-throughput server, หรือ NVIDIA-optimized production path.

มาสคอตแมวดำ STH ประกอบคู่มือ Serving Framework: เลือกตามรูปแบบการให้บริการ

DECISION TREE

เริ่มจากรูปแบบ request ไม่ใช่ชื่อ framework

  1. งาน local บน Mac เริ่มจาก MLX หรือ llama.cpp บน Metal
  2. งาน GGUF หรือ local API เริ่มจาก llama.cpp หรือ Ollama
  3. GPU server ที่รับหลาย request ใช้ vLLM หรือ SGLang
  4. เส้นทาง production เฉพาะ NVIDIA ให้ประเมิน TensorRT-LLM
แมวดำ STH นำ request หลายสายผ่าน cache ไปยัง server
แผนภาพสรุปสรุปกลไกสำหรับใช้เทียบกับค่าใน calculator
แผนภาพอธิบาย Serving Framework: เลือกตามรูปแบบการให้บริการ

ใช้กับงานจริง

เลือก framework จากรูปแบบ request

Local runner เน้นเปิด model และเรียกใช้ไม่กี่คน. Server runtime จัดการ batching, KV cache, concurrency และการสังเกตระบบ.

เลือกจาก artifact ที่มี, hardware ที่ใช้ และคนที่จะดูแล service. อย่าเริ่มจากชื่อ framework ที่กำลังนิยม.

Frameworkเหมาะเริ่มเมื่อสิ่งที่ต้องรับผิดชอบ
llama.cppต้องใช้ GGUF กับ CPU, GPU หรือ Metalmodel file, backend flags, benchmark
Ollamaต้องการ local API และ model management ที่ง่ายmodel lifecycle, memory limit, feature support
MLXทำงานบน Apple Siliconconversion, local API, memory headroom
vLLM / SGLangGPU server ต้องรับหลาย requestbatching, KV, backend, rollout
TensorRT-LLMมี NVIDIA production path ที่ทีมดูแลได้engine build, version compatibility, operations

ก่อนเปิด service

  • bind service กับ 127.0.0.1 จนกว่าจะมีเหตุผลต้อง expose
  • ตั้ง max-model-len และ max-num-seqs ตาม capacity ที่วางไว้
  • บันทึก checkpoint, runtime release และ flags
  • ทำ smoke test, load test และ rollback path
shape ของ vLLM server command
vllm serve <checkpoint> \
  --host 127.0.0.1 \
  --port 8000 \
  --max-model-len <tokens> \
  --max-num-seqs <sequences>

เริ่มด้วยเส้นทาง runtime

Mac/Apple Silicon: เริ่มดู MLX หรือ llama.cpp/Metal. GGUF local: llama.cpp หรือ Ollama. Server GPU ที่ต้อง batching/cache/metrics: vLLM หรือ SGLang. NVIDIA production ที่ต้องการ ecosystem เฉพาะทาง: ประเมิน TensorRT-LLM เมื่อทีมรองรับ.

vLLM และ SGLang

เหมาะกับ GPU serving ที่ต้องการ continuous batching, KV management และ concurrency. vLLM เน้น engine/API ที่ใช้งานกว้าง. SGLang มี serving composition และแนวทางแยก prefill/decode. ตรวจ model, quant และ backend support ของเวอร์ชันจริงเสมอ.

llama.cpp, MLX และ Ollama

llama.cpp ให้เส้นทาง GGUF และ backend กว้างรวม Metal/CPU/GPU. MLX เป็น native Apple Silicon สำหรับ conversion, quantization และ local workflow. Ollama ลด friction ของ local API/model management แต่ไม่ได้แทน capacity planner สำหรับ production.

อย่าเลือกจาก battle card

คำตอบคือ decision tree: ต้อง serve พร้อมกันไหม, ต้อง GGUF หรือ safetensors, เป็น Mac หรือ GPU server, ต้องใช้ prefix cache/spec decode/backend แบบใด, และใครจะ operate observability/rollout. Benchmark path ที่เลือกกับ traffic จริง.

แหล่งอ้างอิง

ลองกับ configuration ของคุณ

นำ model, quantization, context, framework และ hardware ที่คิดไว้ไปลองใน calculator จากนั้นยืนยันด้วย benchmark ที่ใกล้ production.

เปิดเครื่องคำนวณ