Dividing pre-softmax attention scores by an extra factor > 1 at inference does what?
Dividing pre-softmax logits by a factor greater than 1 flattens the attention distribution, useful for redistributing weight away from over-peaked recent tokens at long context.
Picture a roomful of people voting on what to do next. If everyone's votes are very lopsided, the loudest few decide everything. Dividing every vote count by a number bigger than 1 before tallying brings everyone's totals closer together, so quieter voters get more say. The model works the same way when it picks which earlier words to focus on. Shrinking all the raw scores closer together before the final tally spreads its focus across distant words instead of pinning everything to the few loudest recent ones. That is exactly what you want when a long-prompt model has started ignoring useful information far back in the conversation.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
5m: softmax sensitivity to logit magnitude, why long context causes attention collapse, YaRN-style temperature scaling formula and tuning, interaction with RoPE position interpolation, and when temperature scaling is the wrong fix.
Real products, models, and research that use this idea.
- YaRN (Yet Another RoPE extensioN) by Peng et al. 2023 uses a temperature term in its length-extension recipe and is integrated into Mistral and Llama variants.
- Together AI's long-context Llama 3 70B variants apply YaRN-style temperature scaling when extending to 128k inference.
- TogetherAI's blog post on long-context extension explicitly documents the attention-temperature factor and its tuning.
- vLLM and SGLang both expose attention temperature scaling as a serving-time knob for models that need it.
- Llama 4 Maverick and Mistral Large 3 train natively at long context with the scaling baked in, sidestepping the need for inference-time temperature.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does attention temperature interact with RoPE position interpolation (PI) and YaRN?
QWhy does attention magnitude grow with sequence length even when Q and K vectors stay bounded?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Inverting the direction. Dividing by greater than 1 softens; multiplying by greater than 1 sharpens. Getting this backward will make over-peaked attention worse, not better.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.