资料

prefill vs decode

  1. prefill是长序列并行计算,decode是token by token
  2. prefill过程直接计算QKV,不需要读KVCache,decode过程需要读KVCache拼接后再计算
  3. 各请求的context长度不同,prefill计算量不同
  4. 对于deocde,不同请求的iteration次数不同,计算attention时的mask矩阵也不同;