Files
homelab/k8s/apps/llm-serving/reasoning.yaml
T

131 lines
5.2 KiB
YAML
Raw Normal View History

apiVersion: serving.kserve.io/v1beta1
kind: InferenceService
metadata:
annotations:
serving.kserve.io/deploymentMode: RawDeployment
labels:
app.kubernetes.io/name: llm-reasoning
app.kubernetes.io/part-of: llm-serving
name: reasoning
namespace: llm-serving
spec:
predictor:
containers:
- args:
# Swapped off DeepSeek-R1-Distill-Qwen-32B: tool_choice="auto" (what pi
# sends) hit a documented vLLM architecture conflict for R1-family
# models -- the model narrated fake tool-call completions in its
# <think> block instead of emitting real tool_calls, regardless of
# parser combo tried (deepseek_v3 400s outright, hermes parsed but the
# model itself never called out to the real tool-call path). Root
# cause is upstream in the R1 distillation, not this config -- moving
# to a Qwen3-family model with a Kimi-K2.6 reasoning distillation
# instead, since Qwen3's own tool-call format is natively supported.
#
# No pre-quantized AWQ/GPTQ/bnb checkpoint exists for this specific
# distilled model (only a GGUF, which is llama.cpp/Ollama-only and not
# usable here) -- pointing --quantization=bitsandbytes at the full
# bf16 checkpoint directly, which makes vLLM quantize on load instead
# of requiring a pre-quantized repo. This on-the-fly bnb path is
# well-trodden for dense models but less battle-tested for MoE
# (this model is 35B total / ~3B active) -- watch first boot closely;
# if it OOMs or errors on the MoE expert weights, that's the likely
# cause.
- --model=lordx64/Qwen3.6-35B-A3B-Kimi-K2.6-Reasoning-Distilled
- --served-model-name=reasoning
- --quantization=bitsandbytes
- --trust-remote-code
- --dtype=bfloat16
- --kv-cache-dtype=auto
- --tensor-parallel-size=1
- --max-model-len=16384
- --gpu-memory-utilization=0.90
- --max-num-seqs=4
- --enable-chunked-prefill
- --enable-prefix-caching
# qwen3 parser handles this family's <think> reasoning blocks (best
# match for this architecture; unverified against this exact
# checkpoint -- if it 400s or fails to strip <think> tags, that's the
# first thing to check).
- --reasoning-parser=qwen3
# hermes previously verified (on the old model) to work against a
# Qwen tokenizer's plain-text tool-call patterns without needing
# special tokens; Qwen3's native tool-call format is also
# hermes-style, so kept as-is.
- --enable-auto-tool-choice
- --tool-call-parser=hermes
# vLLM 0.11.0's native OffloadingConnector -- spills KV cache blocks
# to CPU DRAM instead of discarding them on preemption (max-num-seqs=4
# + max-model-len=16384 means concurrent long sequences compete for
# the same GPU KV space). No extra dependency, built into vLLM core.
# num_cpu_blocks=2000 hung the pod at startup ("Allocating 64 CPU
# tensors..." then nothing -- 64 is this model's layer count, one
# pinned host tensor per layer, each sized for every CPU block; 2000
# was oversized enough to stall pinning that much host memory, likely
# blowing well past the pod's memory limit). Dropped to a small,
# known-safe starting point -- confirm it actually comes up healthy,
# then watch real host memory usage and raise it deliberately rather
# than guessing a round number again. block_size=128 tokens matches
# vLLM's own example.
# Note: 0.11.0 ships the original (fragmented, small-transfer-block)
# version of this connector -- 0.12.0 consolidates KV data into one
# contiguous block per request and is reported an order of magnitude
# faster for this specific feature, so this is a real but not yet
# optimal implementation until the image gets bumped.
- --kv-transfer-config={"kv_connector":"OffloadingConnector","kv_role":"kv_both","kv_connector_extra_config":{"num_cpu_blocks":32,"block_size":128}}
- --host=0.0.0.0
- --port=8080
env:
- name: VLLM_USE_FLASHINFER_SAMPLER
value: '0'
- name: VLLM_ATTENTION_BACKEND
value: TRITON_ATTN
- name: HF_HOME
value: /mnt/models
image: vllm/vllm-openai:v0.11.0@sha256:014a95f21c9edf6abe0aea6b07353f96baa4ec291c427bb1176dc7c93a85845c
name: kserve-container
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
periodSeconds: 10
resources:
limits:
cpu: '16'
memory: 36Gi
nvidia.com/gpu: '1'
requests:
cpu: '8'
memory: 12Gi
nvidia.com/gpu: '1'
startupProbe:
failureThreshold: 80
httpGet:
path: /health
port: 8080
periodSeconds: 15
volumeMounts:
- mountPath: /mnt/models
name: models
- mountPath: /dev/shm
name: shm
deploymentStrategy:
type: Recreate
maxReplicas: 2
minReplicas: 2
nodeSelector:
kubernetes.io/hostname: worker-1
runtimeClassName: nvidia
volumes:
- name: models
persistentVolumeClaim:
claimName: llm-models
- emptyDir:
medium: Memory
sizeLimit: 2Gi
name: shm