← Questions

Block-wise attention forward pass without the full score matrix

0
Hugging FacePerplexityCodingLast asked Jul 2025

A coding interview question asked in Perplexity's technical screen or assessment and at Hugging Face, last asked Jul 2025. It tests attention, transformer and pytorch.

Implement scaled dot-product attention, softmax(Q K^T / sqrt(d)) V, without ever building the full n x m matrix of scores. Process the keys and values in blocks and keep a running softmax for each query (the running maximum, the running…

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

What it tests

attention · transformer · pytorch · numpy

Your code and the AI tutor open when you unlock this question.