ModelEngine-Group / ModelEngine-Group/unified-cache-management
[Bug]: In PD decoupled deployment, using toy_proxy_server to send proxy requests will trigger an error when the `min_tokens` parameter is added, and the proxy service cannot process requests normally.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 334
- Forks
- 119
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 82
Description
Your current environment
910B-Prefill,H20-Deocode
910B-Prefill
#!/bin/sh unset ftp_proxy unset https_proxy unset http_proxy rm -rf ~/ascend/log# jemalloc
export LD_PRELOAD=/usr/lib64/libjemalloc.so.2:$LD_PRELOAD
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
# Set the operator dispatch pipeline level to 1 and disable manual memory control in ACLGraph
export OMP_PROC_BIND=false
export OMP_NUM_THREADS=1
export TASK_QUEUE_ENABLE=1
export VLLM_ALLOW_BAD_CHECKPOINT=1
# Enable the AIVector core to directly schedule ROCE communication
export ASCEND_RT_VISIBLE_DEVICES=8,9,10,11,12,13,14,15
Reduce memory fragmentation and avoid out-of-memory errors.
export PYTORCH_NPU_ALLOC_CONF=expandable_segments:True
export HCCL_OP_EXPANSION_MODE="AIV"
export HCCL_BUFFSIZE=1024
export OMP_NUM_THREADS=1
export TASK_QUEUE_ENABLE=1
echo performance | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
sysctl -w vm.swappiness=0
sysctl -w kernel.numa_balancing=0
sysctl kernel.sched_migration_cost_ns=50000
export HCCL_INTRA_ROCE_ENABLE=1
export HCCL_INTRA_PCIE_ENABLE=0
export VLLM_RPC_TIMEOUT=3600000
export VLLM_EXECUTE_MODEL_TIMEOUT_SECONDS=30000
export HCCL_EXEC_TIMEOUT=204
export HCCL_CONNECT_TIMEOUT=1200
export VLLM_ENGINE_READY_TIMEOUT_S=120000
nohup vllm serve /mnt/nfs_hw/weight/Qwen3.6-35B-A3B
--host 0.0.0.0
--port 13900
--data-parallel-size 1
--tensor-parallel-size 2
--seed 1024
--served-model-name qwen3.6
--max-num-seqs 128
--max-model-len 262144
--max-num-batched-tokens 16384
--trust-remote-code
--block-size 128
--dtype bfloat16
--gpu-memory-utilization 0.95
--enable-prefix-caching
--enable-chunked-prefill
--speculative-config '{"method": "qwen3_5_mtp", "num_speculative_tokens": 3, "enforce_eager": true}'
--compilation-config '{"cudagraph_mode":"FULL_DECODE_ONLY"}'
--additional-config '{"enable_cpu_binding":true}'
--async-scheduling
--reasoning-parser qwen3
--enable-auto-tool-choice
--tool-call-parser qwen3_coder
--kv-transfer-config
'{
"kv_connector": "UCMConnector",
"kv_role": "kv_both",
"kv_connector_module_path": "ucm.integration.vllm.ucm_connector",
"kv_connector_extra_config": {
"UCM_CONFIG_FILE": "/data/xpyd/ucm_config_hetero_pd.yaml"
}
}' \
/data/xpyd/qwen.log 2>&1 &
H20-Decode
export CUDA_VISIBLE_DEVICES=6,7
nohup vllm serve /mnt/nfs_hw/weight/Qwen3.6-35B-A3B
--max-model-len 262144
--tensor-parallel-size 2
--served-model-name qwen3.6
--gpu_memory_utilization 0.87
--trust-remote-code
--port 13700
--block-size 128
--dtype bfloat16
--kv-transfer-config
'{
"kv_connector": "UCMConnector",
"kv_role": "kv_both",
"kv_connector_module_path": "ucm.integration.vllm.ucm_connector",
"kv_connector_extra_config": {
"UCM_CONFIG_FILE": "/data/xpyd/ucm_config_hetero_pd.yaml"
}
}' \
/data/xpyd/qwen.log 2>&1 &
PD-Proxy
cd /path/to/unified-cache-management/ucm/pd python3 toy_proxy_server.py \ --pd-disaggregation \ --host 0.0.0.0 \ --port 7802 \ --prefiller-host \ --prefiller-port 13900 \ --decoder-host \ --decoder-port 13700ucm_config_hetero_pd.yaml
ucm_connectors: - ucm_connector_name: "UcmPipelineStore" ucm_connector_config: # 存储 pipeline:Cache(DRAM 缓存)+ Posix(NFS 共享存储) # 这是异构 PD 的推荐 pipeline store_pipeline: "Cache|Posix" # 共享 NFS 路径,需从 Ascend 和 CUDA 节点均可访问 # 请替换为实际的共享存储路径 storage_backends: "/nfs_sharedata" # 每张卡的 DRAM 缓存容量(单位:GB) cache_buffer_capacity_gb: 256 # 存储健康检查 store_health: enabled: true # 启用事件同步(流同步) enable_event_sync: true # 异构 PD 场景建议关闭 layerwise 模式 # layerwise 模式针对同平台的计算-加载重叠优化 use_layerwise: false # 关闭请求 trace 记录(调试时可开启) enable_record_traces: false # KV 持久化的最小 token 阈值 persist_token_threshold: 0🐛 Describe the bug
When using the PD disaggregation mode, the proxy server modifies the prefill request by setting max_tokens=1 (since the prefill stage only
needs to compute KV cache, not generate full output). However, if the original request contains a min_tokens parameter, it is passed through
unchanged. This causes a conflict where min_tokens > max_tokens (e.g., min_tokens=100, max_tokens=1), resulting in an Internal Server Error
(HTTP 500) from the vLLM backend.
curl -s -X POST http://:/v1/chat/completions
-H 'Content-Type: application/json'
-d '{"model":"qwen3.6","messages":[{"role":"user","content":"你好"}],"stream":true,"max_tokens":500,"min_tokens":100}'
The same request without min_tokens works correctly.
curl -s -X POST http://:/v1/chat/completions
-H 'Content-Type: application/json'
-d '{"model":"qwen3.6","messages":[{"role":"user","content":"你好"}],"stream":true,"max_tokens":500}'
I have submitted a PR https://github.com/ModelEngine-Group/unified-cache-management/pull/1295 for this fix. Kindly review it at your convenience. Thank you.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ucm/pd/toy_proxy_server.py, where PD prefill requests are adjusted before forwarding to vLLM. Reproduce the chat-completions request with min_tokens and verify the forwarded request no longer conflicts with the prefill max_tokens setting; review PR #1295 for the proposed fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100