Manuscript Offprint

arXiv:2609.03689

Semantic-Aware Subgraph State Space Model for WSI Classification in Histopathology

Feixing Chen, Hao Lu, Lin Luo, Yan Xu

A PREPRINT

Feixing Chen

National College for Excellent Engineers

Beihang University

Beijing, P.R.C. 100191

feixing_chen@buaa.edu.cn

Hao Lu

School of Biological Science and Medical Engineering

Beihang University

Beijing, P.R.C. 100191

lu2002@buaa.edu.cn

Lin Luo*

College of Engineering

Peking University

Beijing, P.R.C. 100871

luo1@pku.edu.cn

Yan Xu*

School of Biological Science and Medical Engineering

Beihang University

Beijing, P.R.C. 100191

xuyan04@gmail.com

31 Lúnasa, 2026

ABSTRACT

Histopathological subtyping relies on the recognition of characteristic histological patterns. These patterns may be expressed by individual tissue structures or by the spatial distribution and co-occurrence of multiple structures, and they often span irregularly shaped tissue regions, termed semantic units in this work. However, conventional patch-based representations may fragment such units and fail to explicitly preserve their internal spatial organization, while efficiently modeling relationships among numerous spatially separated units remains challenging. To address these limitations, we propose the Semantic-Aware Subgraph State Space Model (SASG-SSM), a flexible and efficient framework for whole slide image (WSI) classification. Semantic-Aware Subgraphs (SASGs) first approximate irregularly shaped semantic units by adaptively grouping spatially connected patches guided by class-agnostic visual-semantic priors. By representing patches as graph nodes with adjacency edges, SASGs preserve their internal spatial organization rather than treating them as an unordered set. A Subgraph State Space Module (SG-SSM) subsequently combines a graph neural network encoder for intra-subgraph topology encoding with a Mamba-based state space encoder for efficient contextualization across large numbers of subgraphs. This module integrates local structural information within semantic units with global contextual information arising from their distribution and co-occurrence across the WSI, while efficiently modeling a large number of spatially distributed regions. Extensive experiments across four WSI subtyping datasets demonstrate consistent advantages over representative state-of-the-art methods. Further evaluations under small-cohort and few-shot settings demonstrate robustness and data efficiency under limited training data. Code will be released at https://github.com/HLSvois/SASG-SSM.

Keywords Graph Neural Network · Histopathological Subtyping · State Space Model · Whole Slide Image

1 Introduction

Histopathological subtyping is essential for treatment selection and prognostic assessment [1]. It relies on characteristic histological patterns, including tumor nests, malignant glands, papillary or tubular formations, keratinization, and spatial arrangements of tumor and surrounding tissues. For example, papillary architecture is characteristic of papillary

*Corresponding Author

A PREPRINT

renal cell carcinoma, whereas invasive squamous nests with varying degrees of keratinization are commonly exhibited in esophageal squamous cell carcinoma [2], [3]. These patterns often span irregularly shaped tissue regions and can be characterized by both the morphology of individual structures and their spatial distribution and co-occurrence [4]. In this work, we use the term semantic unit to denote a spatially connected and histologically coherent region that conveys a recognizable histological pattern.

Whole slide images (WSIs) are gigapixel-scale digital images widely used in histopathology [5]. Owing to computational constraints, conventional WSI pipelines divide foreground tissue into thousands of fixed square patches [6]. However, an individual patch provides only a limited field of view and may capture merely a fragment of an irregular semantic unit. Sub-bag methods group multiple patches to enlarge the receptive field [7], but generally treat their constituents as unordered instances and do not explicitly preserve internal spatial organization. Graph-based methods could encode relationships among patches using spatial or feature-space edges [8], [9], [10]. Although these graphs preserve patch-level relationships, patches typically remain the fundamental modeling entities rather than integrated multi-patch histological structures.

Two challenges therefore remain. First, semantic units often exhibit irregular shapes and variable spatial extents and should be represented while preserving both their extent and internal organization. Second, their distribution, co-occurrence, and relationships provide important slide-level context, yet efficiently modeling dependencies among numerous spatially separated units is difficult. To address the first challenge, we represent spatially related patches of a semantic unit as a connected subgraph. Unlike fixed patches and unordered sub-bags, subgraphs provide irregular spatial support while preserving internal topology, enabling more complete representation of semantic units. Fig. 1 compares sub-bag-, graph-, and subgraph-based strategies.

Figure

(a)

(b)

Figure

(c)

Figure

(d)

Figure 1: Conceptual comparison of subgraph-, graph-, and sub-bag-based representation strategies. (a) Two representative histological regions selected from a WSI of squamous cell carcinoma. (b) Subgraph-based strategy represents irregularly shaped semantic units as connected subgraphs and enables contextual dependencies among different units to be modeled explicitly. (c) Graph-based strategy constructs a slide-level graph using patches as nodes. Although patch-level relationships are preserved, multi-patch histological structures are not explicitly represented as integrated modeling units. (d) Sub-bag strategy constructs sub-bags by grouping multiple patches, but their internal spatial organization is not explicitly preserved.

A PREPRINT

Beyond individual semantic units, modeling contextual relationships among distant histological regions is important for incorporating slide-level information [11]. Transformer-based architectures [12], [13] have therefore been introduced into WSI analysis, frequently together with down-sampling [9], linear approximation [11], or staged aggregation [14] to alleviate the quadratic computational complexity of self-attention. However, they may discard fine-grained regional information or weaken direct information propagation among distant regions. Mamba has recently been proposed as a selective state space model (SSM) with input-dependent information propagation and linear computational complexity with respect to sequence length [15]. Its ability to efficiently process long sequences makes it suitable for large numbers of histological regions. Existing Mamba-based WSI methods mainly focus on patch-level sequence modeling [16], [17], [18], leaving efficient subgraph-level contextualization insufficiently explored.

In this work, we propose a flexible and efficient WSI classification framework termed the Semantic-Aware Subgraph State Space Model (SASG-SSM), consisting of Semantic-Aware Subgraphs (SASGs) and a Subgraph State Space Module (SG-SSM). Inspired by the perspective of histology, SASGs are capable of capturing explicit histologic patterns demonstrated in a certain region, and SG-SSM is specially designed to capture implicit patterns revealed by spatial distribution and co-occurrence of different regions. SASGs approximate irregularly shaped candidate semantic units by grouping spatially and visually related patches while preserving their internal topology. SG-SSM subsequently employs a GNN to encode intra-subgraph structure and a Mamba-based SSM to model long-range contextual dependencies among subgraphs, incorporating both local and global information. Extensive experiments on four WSI subtyping datasets demonstrate the effectiveness of SASG-SSM, with additional small-cohort and few-shot settings evaluating robustness under limited training data. The main contributions are summarized as follows:

  • A flexible and efficient framework for WSI classification, termed the Semantic-Aware Subgraph State Space Model (SASG-SSM), is proposed to jointly represent histologically meaningful semantic units and model contextual dependencies among them.

  • Semantic-Aware Subgraphs (SASGs) are introduced to approximate candidate semantic units as connected, irregularly shaped multi-patch regions. SASGs provide flexible spatial support while preserving intra-unit topology, thereby reducing the fragmentation imposed by fixed square patches.

  • The Subgraph State Space Module (SG-SSM) incorporates a GNN encoder to aggregate intra-subgraph information and a Mamba-based SSM encoder to model long-range dependencies among a large number of subgraphs.

References (46)