---
title: "Masked attention"
description: "Why a generator can't peek: causal masking zeroes attention to future positions so training (all positions at once, teacher-forced) matches generation (one"
canonical_url: "https://fanout.sh/ai-engineering/lessons/masked-attention"
md_url: "https://fanout.sh/ai-engineering/lessons/masked-attention.md"
access: "public"
---

# Masked attention

Why a generator can't peek: causal masking zeroes attention to future positions so training (all positions at once, teacher-forced) matches generation (one

## Public overview

Why a generator can't peek: causal masking zeroes attention to future positions so training (all positions at once, teacher-forced) matches generation (one token at a time). The mask is the difference between BERT-style encoders that see everything and GPT-style decoders that must predict it.

---
This representation contains public Fanout content only. Protected Pro lessons, account data, billing, checkout, and pricing are not included.

Browse the public content map: https://fanout.sh/sitemap.md
