Weisfeiler-Leman Features (WLFs) Explained
- Weisfeiler-Leman Features (WLFs) are graph representations derived from iterative color refinement that capture both local and global graph structures.
- Their construction adapts classical methods by incorporating pre-coloring, edge features, and topological lifts to boost expressiveness in graph analysis.
- WLFs find practical applications in molecular property prediction, planning heuristics, and graph neural networks, offering robust alternatives to traditional approaches.
Weisfeiler-Leman Features (WLFs) are graph representations derived from the iterative color refinement procedures of the Weisfeiler-Leman family of algorithms. In the classical setting, WLFs are obtained from the node colors, tuple colors, or their histograms after refinement stabilizes; in contemporary work, the same constructional logic is extended to pre-colored graphs, edge-featured graphs, continuous node attributes, planning states encoded as graphs, graph kernels, optimal-transport distances, and topological lifts such as path complexes. As a result, WLFs occupy a central position between graph isomorphism, descriptive complexity, graph kernels, and graph neural networks (GNNs) (Huang et al., 2022).
1. Core definition and construction
In the classical 1-WL or color-refinement procedure, each node is assigned an initial color and then iteratively updated by hashing its current color together with the multiset of neighbor colors: After stabilization, the multiset , or a histogram built from the colors across iterations, serves as a graph invariant and as a graph-level feature representation. The -dimensional WL algorithm generalizes this from vertices to -tuples, initializing colors from the induced subgraph on each tuple and refining by aggregating colors of tuples obtained by coordinate replacement; the resulting multiset of tuple colors yields higher-order WLFs (Huang et al., 2022).
This basic construction is not restricted to uniform initialization. In the pre-coloring framework, one may start 1-WL from an arbitrary permutation-equivariant coloring , yielding 1-WL. The literature uses both combinatorial and spectral pre-colorings, including diagonal colors from -WL, $\Delta(k\mbox{-}WL)(v)=C_{k\mbox{-}WL}(v,\ldots,v)$, and heat-kernel-based spectral features. In this formulation, WLFs are the node colorings, their histograms, or feature vectors obtained after refinement from a nontrivial initialization (Feldman et al., 2022).
Many applications expose WLFs explicitly as count vectors. In planning, for example, if the WL procedure on a graph returns a multiset 0 and 1 is the union of observed colors, then the state representation is written as
2
This count-based representation makes WLFs directly compatible with linear models, ranking models, and kernel methods (Chen, 25 Aug 2025).
2. Expressive power, invariance, and limitations
WLFs are closely tied to the expressivity of graph-learning architectures. Standard message passing neural networks are at most as powerful as WL in distinguishing non-isomorphic graphs, and several higher-order GNN constructions are designed precisely to emulate or extend the corresponding WL refinements. A central consequence is that the representational ceiling of a GNN class can often be stated in WL terms (Nikolentzos et al., 2022).
A common misconception is that low-dimensional WLFs recover arbitrary motif statistics. The subgraph-count results are substantially more selective. For 3, up to isolated vertices, the class 4 of graphs whose subgraph counts are 1-WL-invariant consists exactly of the star graphs 5 and the 2-matching 6. For 7, explicit positive cases include matching graphs 8 iff 9, cycle graphs 0 iff 1, and path graphs 2 iff 3. At the same time, 4, only finitely many cycles belong to 5 for every 6, and sufficiently long path graphs are omitted from 7 (Arvind et al., 2018).
On planar graphs, the situation is much stronger. There is a constant 8 such that every planar graph on 9 vertices is identified by 0-WL within 1 iterations. For 3-connected planar graphs, the analysis of 2-WL colorings yields a trichotomy: after coloring all pairs with their 2-WL color, either the graph has fixing number 1 with respect to 1-WL, or there is a 2-WL-definable matching that transforms the graph into a smaller one, or 2-WL detects a connected subgraph essentially equal to a Platonic or Archimedean solid, a prism, a cycle, or 2 (Grohe et al., 2021, Kiefer et al., 2022).
Worst-case behavior nonetheless remains highly nontrivial. The maximum iteration number of 3-WL on 4-vertex graphs is at least 5 for all 6, via compressed CFI constructions, while the WL-dimension of a graph on 7 vertices is at most 8 (Grohe et al., 2023, Schneider et al., 2024).
3. Principal variants and generalizations
The modern literature alters three main components of the classical WLF pipeline: initialization, neighborhood definition, and post-processing. Spectral and combinatorial pre-colorings enrich initialization; edge-aware refinements modify aggregation inputs; persistent and topological constructions append random-walk or homological structure; and sparse higher-order variants restrict tuple neighborhoods for scalability (Feldman et al., 2022, Yue et al., 4 Dec 2025, Park et al., 2022, Morris et al., 2019, Truong et al., 2023).
| Variant | Core construction | Stated consequence |
|---|---|---|
| Spectral / combinatorial pre-coloring | Run 1-9WL from 0 or heat-kernel features | Expressive power can increase ad infinitum; degree pre-coloring does not increase expressiveness |
| E-WL | Replace neighbor-color multiset with 1 | At least as discriminative as 1-WL with edge features; reduces to 1-WL if edge features are absent |
| PWLR | 2 | Integrates local topology, node degrees, and global topology; stable to perturbations |
| 3-k-LWL / 4-k-LWL+ | Aggregate only over local tuple neighbors | More scalable and less prone to overfitting; 5-k-LWL+ is strictly more powerful than 6-WL |
| PWL / path-complex lifting | Color elementary paths using boundary, co-boundary, and upper/lower adjacency | At least as powerful as SWL and CWL(7-IC) with maximum dimension 2 |
Several of these variants change the input object rather than only the hash. E-WL replaces the multiset of neighbor colors by multisets of node-edge tuples, so graphs with identical topology and node features but different edge features are no longer confused. PWLR normalizes WL propagation, then composes it with random walks and persistent homology to incorporate local topological features, node degrees, and global topological invariants while preserving stability from graph perturbations. The sparse higher-order variants 8-k-LWL and 9-k-LWL+ restrict aggregation to local tuple neighborhoods, giving reduced computation times and preventing overfitting, while path-complex lifts color elementary paths and generalize clique- or cycle-based topological message passing.
4. WLFs in molecular and graph representation learning
A prominent instantiation of WLFs appears in molecular GNNs. In this setting, each node 0 has a label 1, and the multiset of neighboring labels is 2. Standard atomic embedding uses 3, whereas naive WL embedding uses
4
with 5 an injective hash on the pair of the atom label and the neighbor-label multiset. C-WL and G-WL further factorize atomic and neighborhood information and combine them by concatenation or gating. In representability terms, WL embedding can replace the first two layers of a ReLU GNN with a smaller weight norm (Ishiguro et al., 2020).
The empirical picture in molecular property prediction is correspondingly strong. On a synthetic subgraph-detection task, atomic embedding plus a single-layer GNN could not fit the task, whereas direct WL embedding with no GNN layers solved it. On 8 MoleculeNet datasets and 5 GNN architectures, at least one WL embedding variant improved performance in 37/40 dataset–architecture pairs; C-WL was the most consistently strong variant, shuffling neighbor labels reduced performance, and 2-step expansions helped when data was abundant while deeper expansions caused overfitting and sparsity.
For graph classification more broadly, PWLR defines
6
where normalized WL propagation, random walks, and persistent homology are combined in a single representation. The method generalizes many WL variants, handles both discrete and continuous node features, and yields low-dimensional feature vectors independent of the size of the training set. Its reported performance is comparable to state-of-the-art methods on graphs with discrete node labels and enhanced on graphs with continuous node features (Park et al., 2022).
A separate line interprets WLFs as a hierarchy that induces a node distance. In this framework, WLFs are the sequences of color classes assigned across WL iterations, and the distance 7 is the tree distance in the resulting hierarchy. Because that hierarchy is tree-structured, the proposed embeddings are learned in the Poincaré ball. On a synthetic graph, the correlation between hyperbolic distances and WL hierarchy distances reached 8, compared to 9 for standard Euclidean GIN embeddings; the method is further described as robust to noise and as not suffering from over-smoothing as depth increases (Nikolentzos et al., 2022).
5. Planning and search
In planning, WLFs are state-centric, unsupervised features derived by encoding a planning problem as a graph and applying the WL algorithm. A lifted STRIPS problem 0 is transformed into a graph 1, where nodes represent objects, atoms from the initial state, and goal facts; edges encode relational structure and may carry argument-position labels. The experiments use the Instance Learning Graph, and WLFs are generated with a fixed number of iterations, 2, producing a multiset denoted 3 (Chen, 25 Aug 2025).
These features are then used in novelty heuristics. For a feature mapping 4, the generalized QB heuristic is
5
with
6
7
If 8, this recovers the standard atom-based novelty heuristic; if 9, it yields the Weisfeiler-Leman Novelty Heuristic. Because the WL feature multiset is graph-invariant, 0, so symmetric states are not distinguished. On IPC 1998–2023 and Hard To Ground benchmarks, WLF-based novelty outperformed atom-based novelty in some highly symmetric domains, atom and WL features were often complementary, and the union AT;WL often achieved higher coverage than either feature family alone. The same work also notes the main limitation: WL is incomplete for graph isomorphism, so some asymmetric states may be conflated, and excessive symmetry-invariance may harm progress in some domains.
A subsequent hyperparameter study scaled this planning use case to 1,000,000 samples. It evaluated WL, iWL, niWL, and 2-LWL, along with pruning, hash functions, state representations, and optimizers, across 10 IPC-Learning Track 2023 domains, up to 1,152 configurations per domain, and up to 1,036,800 planning runs. The best-performing configurations for coverage generally used WL (1-WL), 1 iteration, set hash, part state representation, and rkSVM. The study concludes that the best WLF hyperparameters for learning heuristic functions minimise execution time rather than maximise model expressivity, and it reports no significant correlation between training and planning metrics (Chen, 25 Aug 2025).
6. Distances, reinterpretations, and nonstandard domains
The WL distance turns WLFs into a metric-like object on labeled graphs. For a labeled measure Markov chain, the construction sets 1, defines 2, and aggregates globally as 3. The depth-4 WL distance is then
5
This distance has the same discriminative power as the classic WL test, is reinterpreted via Markovian and bi-causal couplings, and is used to analyze the Lipschitz property and universal approximation results for message passing neural networks (Chen et al., 2023).
WLFs also appear in scientific inference outside standard graph classification. In weak chemical tagging, stars in a 15-dimensional elemental abundance space are turned into graphs by connecting stars whose Euclidean distance in chemical space is below 6 dex; node labels are initialized by degree, and five WL iterations were found optimal. Combined with Gaussian Process Regression, the WL graph kernel was reported as superior in interpretability, efficacy and robustness compared to deep sets and graph convolutional neural networks, while enabling optimal training with 7 simulations, a reduction of at least two orders of magnitude relative to graph neural networks (Ting et al., 2023).
A distinct reinterpretation arises in mechanistic interpretability. Sparse autoencoder features from GPT-2 Small are represented as token co-occurrence graphs whose node labels are log-binned into 64 bins and whose edges encode co-occurrence counts; a custom WL-style kernel performs 8 iterations and uses the final node-label histogram as the explicit feature map. The resulting clustering recovered punctuation-heavy patterns, language and script clusters, and code-like templates not recovered by decoder cosine similarity. The token-histogram baseline still had higher overall purity (9 versus $\Delta(k\mbox{-}WL)(v)=C_{k\mbox{-}WL}(v,\ldots,v)$0), but the WL-style kernel recovered an alphabetic-dominant cluster with purity $\Delta(k\mbox{-}WL)(v)=C_{k\mbox{-}WL}(v,\ldots,v)$1, whereas decoder-cosine clustering had $\Delta(k\mbox{-}WL)(v)=C_{k\mbox{-}WL}(v,\ldots,v)$2; cross-corpus consistency reached $\Delta(k\mbox{-}WL)(v)=C_{k\mbox{-}WL}(v,\ldots,v)$3 and $\Delta(k\mbox{-}WL)(v)=C_{k\mbox{-}WL}(v,\ldots,v)$4 (Fernandez-Boullon et al., 7 May 2026).