Hasse Diagrams for Attention: A Partial Order Framework for Designing Transformer Masks

Chentao Li, Han Guo
6/8/2026
cs.LG
transformer-attention

No confident code implementation found for this paper.

Abstract

During the training of large Transformer models, attention masks regulate the scope and direction of information flow across a sequence. Numerous mask variants exist, and operators such as FlexAttention already support arbitrary attention masks.

Show full abstract

Nevertheless, a systematic formal analysis of the information-flow structure induced by arbitrary masks has been missing. This paper develops a complete theoretical framework. We prove that, with sufficient depth, the information flow of a multi-layer Transformer converges to a Hasse diagram -- a directed acyclic graph representing a partial order. Building on this, we recast the design of parallel training tasks as the problem of finding a minimal common supergraph of Hasse diagrams, and we establish a criterion for the minimal common supergraph. This yields a constructive method to derive attention masks directly from a family of tasks. Applying the framework, we design two novel masks: a block-generation attention mask that ensures training-inference consistency (Block Two-Stream Attention), and a fully supervised bidirectional attention mask (Butterfly Attention). These results demonstrate the framework's capacity to discover new structures.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2026hasse,
  title  = {Hasse Diagrams for Attention: A Partial Order Framework for Designing Transformer Masks},
  author = {Chentao Li and Han Guo},
  year   = {2026},
  eprint = {2606.09951},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2606.09951v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2606.09951.svg)](https://codeofpaper.com/paper/2606.09951)

Discussion