Implement YaRN RoPE scaling (frequency grouping + attention-logit scaling) and demonstrate

Attention Efficiency & Long Context5 / 5

Chapter 035 / 5

Attention Efficiency & Long Context

Implement YaRN RoPE scaling (frequency grouping + attention-logit scaling) and demonstrate

Super-hard

Implement YaRN RoPE scaling (frequency grouping + attention-logit scaling) and demonstrate length extrapolation on a toy retrieval task.

Target interface
yarn_freqs(d, base=10000.0, L=256, scale=8.0, alpha=1.0, beta=32.0)

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

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