Implement grouped-query attention with configurable KV heads plus a KV cache for increment

Transformer Architecture Internals5 / 7

Chapter 015 / 7

Transformer Architecture Internals

Implement grouped-query attention with configurable KV heads plus a KV cache for increment

Hard

Implement grouped-query attention with configurable KV heads plus a KV cache for incremental decoding.

Target interface
class GQA

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.