[Feature] Avoid gathering full vocabulary logits for plain greedy TP decoding
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 49/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 8.2k
- フォーク
- 797
- 平均マージ
- 3日 15時間
- マージ済み PR(30日)
- 52
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
InternLM/lmdeploy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 2 日以内に返信
-
[Bug] apply_rotary_pos_emb: leaves output tails unwritten with partial rotation対応中かも @shotsan が 15 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
[Bug] PyTorch engine ignores use_rslora, so rsLoRA adapters run sqrt(r) times too weak対応中かも @Andreas-Hum が 25 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
[Feature] Expose `max_model_len` (session_len) in `/v1/models` model card対応中かも @FOWEPJF255 が 37 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
メンテナーはふだん 2 日以内に返信
InternLM/lmdeploy の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
Techiebutler/freeframe#687 ·
メンテナーはふだん 1 日以内に返信
-
bug verbose GC
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
IBM/javacore-analyser#677 ·
メンテナーはふだん 1 日以内に返信
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#163932 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's file対応中かも @Beehtrix が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
zilliztech/memsearch#907 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
external
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
langchain-ai/docs#8386 ·
メンテナーはふだん 1 日以内に返信