Implement a KV cache + incremental single-token decode loop for a small transformer

Attention Efficiency & Long Context2 / 5

Chapter 032 / 5

Attention Efficiency & Long Context

Implement a KV cache + incremental single-token decode loop for a small transformer

Medium
Target interface
class CachedAttention

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

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