In a Transformer decoder with causal (masked) self-attention, consider a sequence of…
- User
In a Transformer decoder with causal (masked) self-attention, consider a sequence of length 4 (positions are 0,1,2,3). If the attention scores (before masking and softmax) between position 2 and all positions are [0.3, 0.7, 0.9, 0.5], what will be the attention weights after applying the causal mask and softmax? (4 Points)
[0.2318, 0.3458, 0.4224, 0]
[0.25, 0.25, 0.25, 0.25]
[0.2689, 0.5030, 0.2281, 0]
[0.3, 0.7, 0.9, 0]
Assistant
To solve this problem, I need to apply the causal mask and then the softmax function.
Step 1: Apply the causal mask In a causal (masked) self-attention, position 2 can only attend to positions 0, 1, and 2 (not future position 3).
Original scores: [0.3, 0.7, 0.9, 0.5] After masking: [0.3, 0.7, 0.9, -∞] (position 3 is masked out)
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.