阅读 Orca 论文
这篇文章早于Vllm,于2022年发表。
- 迭代级调度
- 选择性批处理
迭代级调度
当执行引擎完成一次迭代并反馈结果时,调度器立即对相关请求进行完成状态评估。
多个请求放入请求池,选择其中一些让 Excution Engine 生成下一个 Token。 如果某个请求结束了,直接返回。
选择性批处理
批处理必须张量形状和运算方式均一致。
不能Batch的三种情况
- 两个请求都在 initiation phase,但输入长度不同
- 两个请求都在 increment phase,但 token index 不一样
- 一个在 initiation phase,另一个在 increment phase
Batching is only applicable when the two selected requests are in the same phase, with the same number of input tokens (in case of the initiation phase) or with the same token index (in case of the increment phase).
Attention操作基本无法Batch。
对于非 Attention 操作,比如Relu等可以不要求张量形状相同,Orca 通过将批处理后的输入张量进行扁平化处理,使其能够适应不规则形状的张量输入。
Orca 为每个请求单独处理,并借助拆分和合并操作来维持批处理的整体流程。
Distributed Architecture
层内和层间并行???
这些层级切分啥的感觉确实不大好理解
Intra-layer parallelism [55, 58] splits matrix multiplications (i.e., Linear and Attention operations) and their associated parameters over multiple GPUs.
inter-layer parallelism splits Transformer layers over multiple GPUs.
Enjoy Reading This Article?
Here are some more articles you might like to read next: