---
title: "Q, K, V & Causal Attention During Inference"
description: "What queries, keys and values do in attention, why generation needs a causal mask, and what a real attention pattern captured from Llama 3.1 8B looks like."
canonical_url: "https://fanout.sh/inference-eng/curriculum/02-02"
md_url: "https://fanout.sh/inference-eng/curriculum/02-02.md"
access: "public"
---

# Q, K, V & Causal Attention During Inference

What queries, keys and values do in attention, why generation needs a causal mask, and what a real attention pattern captured from Llama 3.1 8B looks like.

---
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
