Replies: 1 comment
|
For the mask in the image - a dense shared prefix on the left plus independent block-diagonal local regions on the right - The reason is that the custom-mask prefill path does not really exploit this structure as well: it still treats the problem like one masked attention problem over the full layout, so the block-diagonal sparsity mostly becomes masking overhead. Cascade attention lets you model this as:
For speculative decoding, this is exactly the kind of case where cascade can help, especially when the shared prefix is large and the local verification blocks are relatively small. Each local block can be represented as a separate batch item sharing the same prefix. If the local part also needs causal masking inside each block, use the normal causal/local mask for that per-block suffix attention. |
Uh oh!
There was an error while loading. Please reload this page.
I am trying to evaluate the best way to implement an attention pattern with a dense shared/global prefix plus a local block-diagonal suffix.
The mask pattern is shown below:

I am considering two implementations:
BatchPrefillWithPagedKVCacheWrapper with a custom mask
MultiLevelCascadeAttentionWrapper
Questions:
My use case is speculative decoding, where all verification tokens share the same prefix KV, but each local block should only attend to its own block.
All reactions