RunLLM
January 7, 2026, 8:18am
61
propose_draft_token_ids 接口用于为每个请求生成一组“草稿”token(draft tokens),以支持speculative decoding加速推理。它会根据当前采样的token,调用不同drafter(如NgramProposer、EagleProposer等)生成draft tokens,供后续主模型验证。API文档说明 。
需要详细说明各drafter的draft token生成逻辑或接口参数吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM bonus_logits_indices和 bonus_logits 这个是什么含义?
RunLLM
January 7, 2026, 8:44am
63
bonus_logits_indices 表示在speculative decoding中,用于索引“bonus token”对应logits的下标;bonus_logits 则是根据这些下标从logits张量中取出的bonus token的logits值。bonus token用于在所有draft tokens都被接受时,额外采样一个token以提升吞吐量。API文档说明 。
需要详细举例说明bonus token的采样和作用吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
RunLLM
January 7, 2026, 8:45am
65
bonus token(奖励token)是在speculative decoding中,如果所有draft tokens都被主模型接受,则额外采样的一个token,用于提升推理吞吐量。它只在全部draft tokens被接受时才会被加入输出序列。官方API文档 有明确说明。
需要详细举例说明bonus token的采样流程和性能影响吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM 如果使能了chunk prefill,在schedule里面会将一个request 切分成多个running队列的请求计算吗
RunLLM
January 7, 2026, 9:47am
67
不会。即使启用了chunk prefill,调度器(scheduler)也不会把一个request切分成多个running队列的请求;同一个request始终只在running队列中保留一份,只是每轮调度时分批处理其prompt tokens(即分多轮prefill)。官方文档说明 。
需要详细说明chunk prefill下调度器的分批处理机制吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM 如果某一个chunk的输入执行完了,也不会标记该request执行完吗,还在running队列中?
RunLLM
January 7, 2026, 9:52am
69
是的,某个chunk的输入执行完后,并不会标记该request为已完成,只有当该request的所有prompt tokens都prefill完毕,才会被标记为prefill完成并进入decode阶段。官方调度策略说明 。
需要详细说明chunk调度和request状态转移的流程吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM 某个chunk的输入执行完了之后,该request还在running队列里,直到所有chunk都执行完才标记完成吗
RunLLM
January 7, 2026, 11:48am
71
是的,每个chunk执行完后,该request仍然保留在running队列中,只有当所有chunk(即全部prompt tokens)都prefill完毕,request才会被标记为prefill完成并进入decode阶段。官方文档说明 。
需要详细说明chunk调度和request状态转移的具体流程吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM sampled_token_ids 是什么数据,什么情况下是空
RunLLM
January 7, 2026, 1:13pm
73
sampled_token_ids 表示每个请求在当前推理/采样步骤中生成的token id列表(二维list或tensor),即本轮新采样出来的token序列。当没有生成新token(如推理尚未开始、采样被拒绝、或请求无效)时,sampled_token_ids 可能为空。API文档说明 。
需要详细举例说明哪些场景下sampled_token_ids会为空吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM valid_sampled_token_ids 和 sampled_token_ids 是什么关系,包含spec token id吗
RunLLM
January 7, 2026, 2:12pm
75
sampled_token_ids 表示本轮采样/推理得到的所有token id,可能包含speculative decoding生成的spec token;valid_sampled_token_ids 是对 sampled_token_ids 进一步处理后,去除无效或被拒绝的token,仅保留有效(被接受)的token id,通常也包含spec token(如果被接受)。官方API文档 明确说明两者关系。
需要详细举例说明spec token在两者中的分布和处理流程吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
output_token_ids = self.rejection_sampler(
spec_decode_metadata,
None, # draft_probs
target_logits,
bonus_token_ids,
sampling_metadata,
)
sampler_output.sampled_token_ids = output_token_ids
@RunLLM self.rejection_sampler 的输出包含spec decoding生成的spec token吗,还没有做采样验证的吧
RunLLM
January 7, 2026, 2:16pm
77
是的,self.rejection_sampler 的输出 output_token_ids 会包含speculative decoding生成的spec token(即draft tokens),这些token还未经过采样验收(accept/reject)流程。API文档说明 明确,rejection_sampler的输入是spec decode的draft tokens,输出是包含所有spec token和bonus token的token id序列,后续还需进一步处理验收。
需要详细说明采样验收流程和token状态转移吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM cpu_offload_gb 是什么功能
RunLLM
January 7, 2026, 2:18pm
79
cpu_offload_gb 用于指定每个GPU可用的CPU内存(以GiB为单位)来“虚拟扩展”GPU显存,实现模型权重的CPU侧分流(offload)。这样可以在GPU显存不足时,将部分模型权重存放在CPU内存,推理时动态加载,允许加载更大模型,但会带来CPU-GPU数据传输的性能损耗。官方文档说明 。
需要详细说明使用场景、性能影响或配置方法吗?
Sources:
Hint: Mention @RunLLM in the post for followups.
@RunLLM
req_index = self.input_batch.req_id_to_index.get(req_id)
if req_index is None:
\# The request is not in the persistent batch.
\# The request was either preempted and resumed later, or was not
\# scheduled in the previous step and needs to be added again.
req_ids_to_add.append(req_id)
continue
update_states 当中,这个代码是什么逻辑