Attention Mask

Quick definition

A matrix or tensor that indicates which token positions may interact in an attention computation.

A matrix or tensor that indicates which token positions may interact in an attention computation.

Attention masks can hide padding, future tokens, or task-specific positions; their exact numeric representation depends on the framework.

Example: A batch of sentences masks unused padded positions so they do not affect attention scores.

Common use cases: Transformer implementation, variable-length sequences, and controlled context.

Examples

  • A batch of sentences masks unused padded positions so they do not affect attention scores.

Use cases

  • Transformer implementation, variable-length sequences, and controlled context.

Frequently asked questions

What is Attention Mask?

A matrix or tensor that indicates which token positions may interact in an attention computation.

What should I know about Attention Mask?

Attention masks can hide padding, future tokens, or task-specific positions; their exact numeric representation depends on the framework.

Categories and tags