[Feature] Avoid gathering full vocabulary logits for plain greedy TP decoding
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 49/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- machine-learning, performance
Hướng nghiên cứu
Start by reading ParallelLMHead and the decode sampling path to find where the model agent passes sampling decisions to the LM head. Check how tensor-parallel ranks coordinate selection and how existing tests cover greedy decoding, logits, and processors. Done means the fast path is limited to eligible plain greedy decode requests, produces the same token IDs across the TP group, and has serving latency measurements against the current path.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Motivation
On a four-GPU PCIe machine I noticed that DeepSeek's ParallelLMHead gathers the entire vocabulary on every rank even when the request only needs a greedy token ID. With DeepSeek-V2-Lite and 32 decoding rows, that materializes 6.25 MiB of BF16 logits per rank before sampling. Each rank already has enough information to choose its best local token.
I tried a small prototype on LMDeploy main at 4a8bdbc0. Each rank finds its local max, exchanges one (score, global token ID) pair per row, and picks the winning rank. Rank order breaks ties the same way as argmax on the concatenated vocabulary. I kept the existing broadcast of the leader's token in both measurements.
What I measured
Four RTX 5090s on one host, no CUDA peer access between these four devices, PyTorch 2.8.0+cu128, NCCL. I loaded the published BF16 lm_head.weight from deepseek-ai/DeepSeek-V2-Lite (102400 × 2048) into LMDeploy's actual ParallelLMHead. Inputs were seeded hidden states. Two fresh four-rank launches gave these median times for projection, selection and broadcast:
| Decode rows | Current path | Local max + gather pairs |
|---|---|---|
| 2 | 0.512–0.517 ms | 0.325–0.512 ms |
| 8 | 1.186–1.273 ms | 0.389–0.520 ms |
| 32 | 2.169–2.801 ms | 0.504–0.518 ms |
Each launch checked 504 selected IDs across batch sizes 1, 2, 4, 8, 16 and 32. All matched. The machine had other workloads, and small batches were noisy. In an earlier collective-only measurement with a 152064-token vocabulary, the prototype was slower at batch 1. These are output-layer measurements. I haven't measured serving throughput or TPOT yet.
Proposed scope
Would you be open to a decode-only fast path for larger batches using ParallelLMHead and plain greedy selection? I'd start with ordinary autoregressive decoding, leaving requests that need logits, logprobs, constraints, token masking or custom processors on the current path. The choice would need to be identical across the TP group. Models with a replicated output head wouldn't use it.
I can work on the integration and compare generated IDs and serving latency. Is there a preferred place for the model agent to pass that sampling decision to the LM head? I found #4915, which improves the full gather on supported hardware; this proposal reduces the amount gathered for this specific sampling case.
- Ngôn ngữ chính
- Python
- Star
- 8.2k
- Fork
- 797
- Merge trung bình
- 3 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 52
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của InternLM/lmdeploy
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] apply_rotary_pos_emb: leaves output tails unwritten with partial rotationCó thể đã có người làm @shotsan đã nhận 15 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Bug] PyTorch engine ignores use_rslora, so rsLoRA adapters run sqrt(r) times too weakCó thể đã có người làm @Andreas-Hum đã nhận 25 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[Feature] Expose `max_model_len` (session_len) in `/v1/models` model cardCó thể đã có người làm @FOWEPJF255 đã nhận 37 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của InternLM/lmdeploy
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
Techiebutler/freeframe#687 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug verbose GC
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
IBM/javacore-analyser#677 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
NousResearch/hermes-agent#163932 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's fileCó thể đã có người làm @Beehtrix đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
zilliztech/memsearch#907 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[integration]: SynapCoresĐang mởexternal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
langchain-ai/docs#8386 ·
Maintainer thường phản hồi trong vòng 1 ngày