---
title: Induced Substructure Filtration (ISF)
url: https://www.emergentmind.com/topics/induced-substructure-filtration-isf
type: topic
---

# Induced Substructure Filtration (ISF)

Searching arXiv for the specified paper to ground the article and citation.
Induced Substructure Filtration (ISF) is a perspective for modeling how a decoder-only Transformer progressively identifies a target subgraph across layers when solving graph substructure extraction tasks from textual graph descriptions. In the formulation introduced in "From Sequence to Structure: Uncovering Substructure Reasoning in Transformers" [2507.10435], ISF treats Transformer depth as a filtration index: early layers recover graph-level structure from sequence inputs, intermediate layers represent partial induced subgraphs, and later layers refine these partial matches into full substructure identifications. The framework is both formal and mechanistic: it defines filtrations over induced subgraphs, specifies tensor representations for subgraph isomorphism, proves expressiveness results for progressive identification, and validates the resulting dynamics empirically in GPT-2-like models and fine-tuned LLaMA-3.1-8B-Instruct [2507.10435].

## 1. Formal definition and core objects

The paper defines a fixed target substructure \(G'=(V',E')\) with \(|V'|=k\), together with a nested sequence of vertex subsets that grows to the full pattern. A \(k\)-node \(m\)-filtration on \(V'\) is
\[
(V')=(V_1',\dots,V_m')
\]
with
\[
\varnothing \neq V_1' \subseteq \dots \subseteq V_m' = V'.
\]
For \(G'=(V',E')\), this induces an induced subgraph filtration \((G_1',\dots,G_m')\) where
\[
G_i' = G'[V_i'].
\]
This gives a discrete filtration of vertex sets and induced subgraphs: the model is interpreted as moving through a sequence of nested partial patterns until the full target substructure is reached [2507.10435].

To encode all possible occurrences of a pattern \(G'\) in a host graph \(G\), the paper introduces the subgraph isomorphism indicator tensor. For a host graph \(G=(V,E)\) with \(|V|=n\) and a pattern graph \(G'=(V',E')\) with \(|V'|=k\), the tensor \(\mathcal{T}(G,G')\) is a \(k\)-dimensional tensor of size \(n \times \dots \times n\). For each tuple \((j_1,\dots,j_k)\), the entry \(\mathcal{T}(G,G')_{j_1,\dots,j_k}\) equals \(1\) if the mapping \(f(v_l')=v_{j_l}\) is injective and edge-preserving, and \(\le 0\) otherwise. The injectivity condition requires that \(v_{j_1},\dots,v_{j_k}\) are all distinct, while edge preservation requires that for every \((v_p',v_q') \in E'\), the edge \((v_{j_p},v_{j_q}) \in E\) [2507.10435]. A vectorized form,
\[
\mathsf{vec}(\mathcal{T}(G,G')) \in \mathbb{R}^{n^k},
\]
serves as the principal latent representation for pattern matching.

The central ISF theorem states that, given a \(k\)-node \(m\)-filtration \((V')=(V_1',\dots,V_m')\), for any directed graphs \(G=(V,E)\) and \(G'=(V',E')\), a log-precision Transformer with \(m+2\) layers, constant number of heads, and hidden dimension \(O(n^k)\) can output
\[
\mathsf{vec}\big(\mathcal{T}(G,G'[V_i'])\big)
\]
at layer \(i+2\), for each \(i \in \{1,\dots,m\}\) [2507.10435]. In this formulation, each layer corresponds to one filtration step.

Conceptually, ISF treats Transformer computation as a monotone refinement of candidate tuples. The model starts with trivial or partial matches, filters out inconsistent assignments as more structural constraints are introduced, and ends with tuples that remain consistent with the full induced pattern. The paper explicitly relates this interpretation to filtrations in algebraic topology, graph theory, and measure theory, while keeping the construction discrete and combinatorial [2507.10435].

## 2. Transformer mechanism and sequence-to-graph reconstruction

ISF is not a new architecture. It is an interpretation of how a standard decoder-only Transformer can implement substructure filtering. The paper uses a GPT-2-like decoder in which, at layer \(l\) and token position \(t\),
\[
Q_t^{(l)} = W_Q h_t^{(l)},\quad
K_s^{(l)} = W_K h_s^{(l)},\quad
V_s^{(l)} = W_V h_s^{(l)},
\]
with attention weights
\[
\alpha_{t,s}^{(l)} = \text{softmax}_s\left(\frac{Q_t^{(l)} \cdot K_s^{(l)}}{\sqrt{d}}\right),
\]
attention output
\[
z_t^{(l)} = \sum_s \alpha_{t,s}^{(l)} V_s^{(l)},
\]
and residual-plus-MLP updates
\[
\tilde h_t^{(l)} = h_t^{(l)} + z_t^{(l)},\quad
h_t^{(l+1)} = \tilde h_t^{(l)} + \text{MLP}^{(l)}(\tilde h_t^{(l)}).
\]
The significance of ISF lies in interpreting this standard pipeline as a layerwise substructure extractor rather than as a purely sequential processor [2507.10435].

A foundational result is the adjacency matrix extraction lemma. For any \(n\), there exists a 2-layer log-precision Transformer with one head and hidden dimension \(O(n^2)\) such that, for any \(G=(V,E)\) with \(|V|=n\), the Transformer outputs \(\mathsf{vec}(A(G))\) from either adjacency-list \(\mathsf{AL}(G)\) or edge-list \(\mathsf{EL}(G)\) representations [2507.10435]. The paper’s sketch consists of three steps: attention copies node indices across list positions, an MLP maps each local edge to a one-hot location in \(\mathsf{vec}(A(G))\), and a second attention-plus-MLP stage aggregates these contributions through a MEAN and threshold to recover exact adjacency.

The local edge-to-vector encoding is written as
\[
(\mathsf{vec}(A(G[\{v_i,v_j\}])) )_k
= \text{ReLU}[k - n(i-1) - j + 1]
+ \text{ReLU}[k - n(i-1) - j - 1]
- 2\text{ReLU}[k - n(i-1) - j].
\]
Once adjacency is reconstructed internally, subsequent layers can operate on a latent graph representation independent of the original tokenization [2507.10435]. This is a key mechanistic claim: the sequence input is first normalized into graph structure before substructure reasoning proceeds.

After adjacency is available, the feed-forward networks implement the filtration steps. Given \(\mathsf{vec}(A(G))\), \(\mathsf{vec}(A(G'))\), and \(\mathsf{vec}(\mathcal{T}(G,G'[V_{i-1}']))\), the paper proves that there exists a 2-layer MLP with hidden dimension \(O(n^2 k^2)\) that outputs \(\mathsf{vec}(\mathcal{T}(G,G'[V_i']))\) [2507.10435]. The MLP extends partial matches by enumerating candidate tuples, checking newly introduced edge constraints, enforcing injectivity, and preserving earlier-valid assignments. Attention is used to copy global graph tensors from designated summary tokens into positionwise computations, allowing the MLPs to operate on global structural information.

## 3. Layerwise filtration and internal dynamics

The empirical interpretation of ISF divides Transformer depth into distinct functional regimes. Layers 1–2 primarily reconstruct adjacency and simple edge-level patterns; in t-SNE visualizations of final-graph token embeddings, answer classes remain mixed at this stage [2507.10435]. Middle layers begin to cluster graphs that share partial pattern matches. In square detection, answers such as “2431”, “0431”, and “2413” share overlaps in node IDs and begin to cluster together at layer 2, which the paper interprets as alignment with induced subgraphs of smaller size in the filtration. Late layers show clear separation of answer classes, indicating that the full substructure has been disambiguated [2507.10435].

A salient observation is that, in decoder-only generation, the answer is already organized in the hidden state before the first answer token is emitted. For both small Transformers and fine-tuned LLaMA-3.1-8B-Instruct, Adjusted Rand Index (ARI) and NMI between representation clustering and true answer labels increase with depth and peak before the final layers [2507.10435]. This suggests that autoregressive decoding is not performing token-by-token search for the structure; rather, the latent representation already contains the relevant subgraph identification.

The square-extraction task provides the paper’s most detailed walkthrough. The pattern \(G'\) is a 4-cycle, represented in \(\mathsf{AL}(G)\), and the model outputs a sequence such as “0 4 3 1,” indicating the ordered node tuple corresponding to the square [2507.10435]. The filtration is presented as a sequence from smaller induced patterns to the full 4-node cycle. Layers 1–2 reconstruct adjacency, layer 3 computes tensor representations for smaller filtered subgraphs, layer 4 extends to a 3-node induced pattern, and layer 5 computes the full \(\mathcal{T}(G,G')\), which can then be decoded to the textual answer [2507.10435].

This layerwise interpretation supplies the mechanistic content of the term “filtration.” It is not merely that deeper representations become more informative; rather, each depth increment corresponds to the inclusion of additional structural constraints. A plausible implication is that depth is functioning as an explicit combinatorial budget for partial-to-complete pattern assembly.

## 4. Expressive power, tensor computation, and “thinking in substructures”

The theoretical analysis isolates four principal expressivity results. First, adjacency extraction requires 2 layers, \(O(n^2)\) width, and one head. Second, progressive identification through ISF requires \(m+2\) layers, constant heads, and hidden dimension \(O(n^k)\) to compute \(\mathsf{vec}(\mathcal{T}(G,G'[V_i']))\) at layer \(i+2\). Third, under a unique-instance assumption, constant depth and hidden dimension \(O(n^k)\) suffice to output the unique matching tuple. Fourth, the Multi-Num and Multi-Shape results show that constant depth and width \(O(n^k)\) suffice to output all matches of a pattern or to support multiple pattern sizes up to \(k\) [2507.10435].

The unique-instance assumption is stated as follows: for graphs \(G,G'\), there is a unique \(k\)-tuple \((i_1,\dots,i_k)\) with \(\mathcal{T}(G,G')_{i_1,\dots,i_k}=1\) [2507.10435]. Under this assumption, the pattern extraction theorem guarantees that a log-precision Transformer with constant depth, constant heads, and hidden dimension \(O(n^k)\) can output the unique tuple \((v_{i_1},\dots,v_{i_k})\). The Multi-Num theorem removes uniqueness and establishes that all matching tuples can be output. The Multi-Shape theorem extends this further to any target \(G'\) with \(|V'|=k' \le k\), provided the unique-instance assumption holds [2507.10435].

The combinatorial heart of the construction is the recursive computation of \(\mathcal{T}\) from adjacency matrices. When moving from \(V_{i-1}'\) to \(V_i'\), each tuple indicator combines the previous match indicator with terms enforcing new edge constraints and a penalty for repeated indices. The paper writes the edge-consistency contribution as
\[
\sum_{x,y \in V_i', \; x>k_{i-1} \vee y>k_{i-1}}
\left[
A(G')_{x,y} A(G)_{j_x,j_y} - A(G')_{x,y}
\right],
\]
together with a distinctness penalty to enforce injectivity [2507.10435]. The implementation claim is that all such operations can be realized by polynomially sized MLPs using ReLUs and products via composition.

The paper also introduces the phrase “thinking in substructures.” In this framework, complex patterns are decomposed into smaller subpatterns \(G'[V_1'],\dots,G'[V_t']\) such that
\[
V' = \bigcup_{j=1}^t V'_j,\quad
E' \subseteq \bigcup_{j=1}^t E(G'[V'_j]).
\]
Letting \(q = \max_j |V_j'|\), the model first outputs matches for each decomposing substructure and then produces the final full-pattern answer [2507.10435]. Under a technical assumption that each partial subpattern has at most \(c\) matches, the paper proves the existence of a Transformer with constant depth, constant heads, and hidden dimension
\[
O(n^q + c^t + c^2 t^2 n),
\]
capable of outputting all matches for each decomposing substructure and then the unique full pattern match [2507.10435]. If \(c\) and \(t\) are constants, this reduces to \(O(n^q)\), which is better than \(O(n^k)\) when \(q<k\). This suggests a theoretical basis for chain-of-thought-style decomposition in graph reasoning.

## 5. Empirical validation in small Transformers and LLMs

The main empirical setup uses a GPT-2-like decoder with hidden dimension 384, 12 heads, and 2–5 layers depending on the task, trained by next-token prediction on \(\mathsf{ANS}(\hat G)\). Training uses up to approximately 400k graphs with 4–16 nodes and 3–120 edges, with train and test graphs non-isomorphic. Evaluation uses exact sequence accuracy, meaning the prediction must match the ground-truth \(\mathsf{ANS}(\hat G)\) exactly [2507.10435].

For single substructure extraction, the tasks include triangle, path, square, diagonal, T-triangle, fan-triangle, diamond, pentagon, and house. With 400k training examples and 5 layers, the reported accuracies are Triangle: \(0.9977\), Square: \(0.9679\), Pentagon: \(0.8922\), and House (5 nodes): \(0.8530\) [2507.10435]. The paper reports that more complex or larger structures require more layers and data, and that the minimum number of layers needed to reach approximately \(85\%\) accuracy often matches the number of nodes in the substructure. This is presented as consistent with the theoretical idea that each filtration step requires at least one layer [2507.10435].

The visualization evidence is central to the empirical argument. In square extraction, the embedding of the last graph token at each layer is projected with t-SNE and colored by answer. Layer 1 shows mixed embeddings; layer 2 shows clustering by partial node overlaps; layer 3 tightens clusters; and the final layer shows distinct clusters for each answer [2507.10435]. The paper interprets this as direct evidence of progressive filtration: hidden representations are reorganized in a pattern-structured manner before output generation.

The Multi-Num setting considers multiple instances of the same substructure, with up to 5 triangles or squares in one graph. A 4-layer Transformer reaches greater than \(85\%\) accuracy across different copy numbers [2507.10435]. The Multi-Shape setting mixes different substructures such as triangle and square, square and diamond, fan-triangle and T-triangle, or square and path. Separate query prompts are used for each pattern, and the last query-token embedding is visualized. Simpler patterns are often resolved by layer 3 in a 4-layer model, while more complex patterns require deeper layers, consistent with simultaneous ISF processes for multiple filtrations [2507.10435].

The LLM experiments fine-tune LLaMA-3.1-8B-Instruct on triangle and square detection. For square detection on 283 test samples with 4 answer types, accuracy before fine-tuning is reported as close to random, in the range \(0.0035\)–\(0.0141\), and after fine-tuning reaches up to \(0.6572\) [2507.10435]. Intermediate-layer embeddings again show the same qualitative pattern: ARI and NMI increase with depth up to mid-late layers and then slightly drop at the final layers, where the model tends to generate additional explanatory text or code [2507.10435]. The paper takes this as evidence that ISF-like internal dynamics are not restricted to small, task-specific Transformers.

## 6. Encodings, attributed graphs, relations to prior work, and limitations

ISF is validated on synthetic directed graphs, multiple motif types, and multiple textual encodings. The paper proves that both \(\mathsf{AL}(G)\) and \(\mathsf{EL}(G)\) can be mapped to the same \(\mathsf{vec}(A(G))\), and states that they have equal expressive power for ISF [2507.10435]. Empirically, adjacency lists tend to perform better or require fewer layers because edge lists use more tokens and impose greater context-length and attention burdens [2507.10435]. This supports the mechanistic view that the principal bottleneck is the cost of recovering a usable latent adjacency representation from text.

The framework extends to attributed graphs by augmenting adjacency-list descriptions with node features \(f_i\):
\[
\mathsf{AL_f}(G)
= (v_1 f_1; \text{``:''}; v_1^1 f_1^1; \dots; v_1^{m_1} f_1^{m_1}; \text{``,''}; \dots; v_n f_n; \text{``:''}; v_n^1 f_n^1; \dots).
\]
For graphs \(G,G'\) and a feature function \(\varphi: V \cup V' \to \mathbb{R}\), the attributed substructure extraction theorem states that there exists a Transformer with constant depth, constant heads, and hidden dimension \(O(n^k)\) that can output all tuples \((v_{i_1},\dots,v_{i_k})\) such that \(\mathcal{T}(G,G')_{i_1,\dots,i_k}=1\) and \(\varphi(v_{i_p})=\varphi(v_p')\) for all \(p\) [2507.10435]. The implementation uses the same ISF pipeline with additional MLP terms checking feature equality.

The molecular experiments instantiate this extension on QM9 and PCBA molecular graphs, where atoms are nodes, bonds are edges, and atom types are node attributes. The tasks are functional-group detection for hydroxyl C–O(H), carboxyl COO(H), benzene ring \(\ce{C6(H6)}\), and a mixed task combining hydroxyl and carboxyl [2507.10435].

| Functional group | Max nodes | ACC |
|---|---:|---:|
| C–O(H) | 9 | 0.9207 |
| COO(H) | 121 | 0.9159 |
| \(\ce{C6(H6)}\) | 121 | 0.7245 |
| Mix | 121 | 0.8946 |

These results are presented as evidence that the same ISF mechanism applies to attributed molecular graphs and that mixed training is consistent with Multi-Shape ISF [2507.10435].

In relation to prior work, the paper distinguishes ISF from graph-transformer and GNN literature framed around message passing and Weisfeiler–Leman-style expressivity, citing Dwivedi & Bresson, Ying et al., Müller et al., and Shehzad et al. It also contrasts ISF with work on shortest path and planning, including ALPINE and Spectral Journey, and with graph algorithm analyses by Sanford et al. and Yehudai et al. [2507.10435]. The specific distinction drawn is that ISF focuses on explicit subgraph extraction, provides a constructive layerwise mechanism for decoder-only sequence models, and ties expressivity to hidden-dimension scaling \(O(n^k)\) and filtration length.

The paper also identifies several limitations. The width requirement \(O(n^k)\) is impractical for large graphs or large patterns; the log-precision assumption is theoretical; some theorems depend on the unique-instance assumption; edge-list representations exhibit sequence-length sensitivity not fully captured by theory; and prompt dependence can cause models to rely heavily on specific tokens rather than full structural understanding [2507.10435]. Open questions include scaling ISF to realistic widths, regularizing training toward ISF-like multistep reasoning, understanding interactions with other implicit-structure modalities, leveraging ISF for prompting strategies, and evaluating robustness under distribution shift or noisy graph descriptions [2507.10435].

Taken together, these results define ISF as a theory of graph reasoning in sequence models in which adjacency recovery, partial substructure assembly, and final pattern extraction form a unified depth-indexed computation. This suggests that, in decoder-only Transformers, graph reasoning can emerge as substructure filtering rather than as purely local token association [2507.10435].

Source: https://www.emergentmind.com/topics/induced-substructure-filtration-isf