Papers
Topics
Authors
Recent
Search
2000 character limit reached

TopoHG: Topology Hard Sample Generation

Updated 7 July 2026
  • TopoHG is a design pattern that concentrates on generating topologically hard instances for problems like graph algorithms and tubular segmentation.
  • It employs probabilistic models and techniques such as prioritized replay and teacher-student consistency to learn a distribution of challenging samples.
  • The framework adapts across domains by leveraging topology-aware perturbations to reveal structural failure modes and improve benchmarking and performance.

Searching arXiv for the cited TopoHG-related papers to ground the article in current literature. Querying arXiv for "Learning to Sample Hard Instances for Graph Algorithms" and related "Topology Hard sample Generation" works. Topology Hard Sample Generation (TopoHG) denotes a family of methods that concentrate sampling or synthesis on topologically informative or algorithmically difficult instances. In the graph-algorithm setting, the term is instantiated by HiSampler, a general, problem-agnostic framework that learns a probabilistic generator over small graphs whose mass is concentrated on instances that are maximally hard for a target algorithm AA (Sato et al., 2019). In later usage within tubular structure segmentation, TopoHG refers to a test-time hard-sample generation strategy that creates local pseudo-breaks in confidently predicted tubular regions and trains a model to restore continuity under teacher-student consistency supervision (Zhou et al., 1 Aug 2025). Taken together, the literature suggests that TopoHG is best understood not as a single architecture, but as a recurring design pattern in which topology-aware perturbation, sampling, or guidance is used to expose failure modes and improve analysis, benchmarking, or adaptation.

1. Origins in hard-instance generation for graph algorithms

The earliest formulation in the present corpus is HiSampler, introduced for graph problems in "Learning to Sample Hard Instances for Graph Algorithms" (Sato et al., 2019). Its stated objective is to obtain a probabilistic generator of hard instances rather than only a finite set of instances. The motivation is twofold: hard instances help analyze an algorithm for accelerating it, and they help build a good benchmark for evaluating performance. The paper further argues that evolutionary algorithms can generate only a finite number of hard instances, making it difficult to extract meaningful patterns from a small number of instances.

In this formulation, TopoHG is explicitly described as a general, problem-agnostic framework for learning a probabilistic generator over small graphs that concentrates mass on instances that are maximally hard for a given graph algorithm AA (Sato et al., 2019). The framework is notable for avoiding hand-engineered features and for modeling the distribution of hard instances without parameters or rules supplied by domain experts. The paper states, "To the best of our knowledge, this is the first method to learn the distribution of hard instances using machine learning" (Sato et al., 2019).

A central conceptual point is that the target object is a distribution rather than a single adversarial example. This changes the role of hard-sample generation: instead of searching for isolated worst cases, the method seeks a learned source of varied hard instances from which one can both sample benchmarks and infer recurring structural motifs.

2. Probabilistic model, objective, and optimization

For a fixed number of vertices nn, a simple undirected graph GG is represented by the upper-triangular part of its adjacency matrix, with

G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.

HiSampler defines a parameterized distribution PθP_\theta in two stages. First, it samples latent noise

z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),

with latent dimension d0d_0. Second, an ll-layer MLP Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m maps AA0 to edge probabilities

AA1

after which the graph is sampled coordinate-wise as independent Bernoullis conditioned on AA2 (Sato et al., 2019). The conditional distribution is

AA3

and the marginal graph distribution is

AA4

Hardness is measured by a scalar AA5, obtained by actually running the target algorithm AA6 on AA7. Depending on the experiment, this is either a discrete count such as the number of recursive calls or branching decisions, or wall-clock time in microseconds or milliseconds (Sato et al., 2019). The learning objective is

AA8

equivalently AA9.

Because nn0 is a non-differentiable black-box quantity, the optimization uses the score-function estimator REINFORCE. A single Monte Carlo estimator is written as

nn1

In practice, each iteration samples nn2, computes nn3, samples nn4, evaluates nn5, and applies

nn6

The variant HiSampler-PER augments vanilla REINFORCE with an experience pool containing the top-nn7 hardest graphs seen so far, and replays a uniformly chosen element from that pool at each iteration (Sato et al., 2019). Because truly hard graphs occupy a tiny corner of the graph space, this prioritized replay mechanism is presented as a way to accelerate convergence toward high-hardness regions.

3. Architecture, protocol, and empirical behavior

The generator is a fully connected feedforward network of depth nn8, with a representative configuration

nn9

ReLU hidden activations, and a final sigmoid output layer (Sato et al., 2019). Although the decoder factorizes edges conditionally as independent Bernoullis, the paper emphasizes that shared parameters GG0 and nonlinear activations induce rich nonlinear dependencies among edges.

The reported evaluation covers seven algorithms spanning four graph problems: DSATUR and a MiniSat reduction for 3-coloring; a branch-and-bound algorithm GG1 for minimum vertex cover; BK, MCS, and FMC for maximum clique; and Nauty for graph isomorphism (Sato et al., 2019). The key hyperparameters are fixed across problems: hidden dimensions GG2, Adam with learning rate GG3, latent dimension GG4, PER pool size GG5, and total evaluation budget GG6 graphs. Initialization uses a final-layer bias

GG7

so that GG8 starts near a "hard" edge density GG9 found by a small sweep.

The baselines are random sampling from Erdős-Rényi G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.0, a generic evolutionary algorithm with population size G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.1, uniform crossover, and adaptive mutation, and rule-based constructions from the literature such as phase-transition heuristics and gadget graphs (Sato et al., 2019). Across all seven targets, HiSampler-PER is reported to find instances whose hardness G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.2 is several to many orders of magnitude larger than random or rule-based sampling, while also consistently outperforming the generic evolutionary search.

A representative example is DSATUR with G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.3. The hardest random G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.4 sample yields about G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.5 recursive calls, whereas HiSampler-PER produces graphs requiring approximately G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.6 calls, described as a factor of about G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.7 harder (Sato et al., 2019). For MiniSat-based 3-coloring at G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.8, the hardest random sample requires about G∈{0,1}m,m=n(n−1)2.G \in \{0,1\}^{m}, \qquad m = \frac{n(n-1)}{2}.9 solver decisions and HiSampler-PER reaches about PθP_\theta0. The paper states that prioritized replay consistently outperforms vanilla REINFORCE.

The qualitative analysis is equally important. Inspection of the hardest DSATUR instances reveals a tight 4-clique attached to the rest of the graph only via a long path of low-degree vertices (Sato et al., 2019). The interpretation given is that DSATUR colors the bulk of the graph first and fails only later on the clique, which forces combinatorial backtracking. Frequent-subgraph mining with gSpan on PθP_\theta1 samples from the learned PθP_\theta2 identifies 4-cliques with support approximately PθP_\theta3, as well as longer chains with degree-2 connectors leading into small unsatisfiable cores. The paper further reports that these motifs suggest a preprocessing rule deleting degree-PθP_\theta4 vertices, described as provably equivalent and sufficient to eliminate the bottleneck that the learned generator exposed.

4. TopoHG in test-time adaptation for tubular structure segmentation

A distinct later use of the term appears in "TopoTTA: Topology-Enhanced Test-Time Adaptation for Tubular Structure Segmentation," where TopoHG denotes the second-stage hard-sample generation strategy inside a two-stage test-time adaptation pipeline (Zhou et al., 1 Aug 2025). Here the objective is not graph-instance generation but topological continuity refinement under domain shift.

The motivation is stated in explicitly topological terms. Tubular structure segmentation is described as especially sensitive to domain shifts because changes in topological structures can compromise segmentation integrity, while local variations in texture and contrast can disrupt topological continuity (Zhou et al., 1 Aug 2025). Stage 1, based on TopoMDCs, addresses large-scale structural discrepancies such as thickness, curvature, and branching. Stage 2, TopoHG, addresses fine-grained continuity failures by generating hard test-time samples through local perturbation of high-confidence tubular regions.

The procedure has three steps. First, key-point selection uses the teacher pseudo-label PθP_\theta5 to identify highly confident pixels,

PθP_\theta6

and samples

PθP_\theta7

distinct key points with a small coefficient PθP_\theta8, for example PθP_\theta9 (Zhou et al., 1 Aug 2025). Second, for each key point, the method extracts an z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),0 foreground patch with z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),1 and searches its non-overlapping 8-neighborhood for a background patch minimizing aggregate foreground confidence. If the selected background patch exceeds the threshold z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),2, that key point is discarded. Third, the foreground and background patches are transformed by FFT, and only the low-frequency region selected by a binary mask z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),3 is swapped: z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),4 The resulting patch is then blended with the pseudo-label,

z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),5

and pasted back into the image to create the hard sample z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),6 (Zhou et al., 1 Aug 2025).

Learning proceeds in a teacher-student framework. The teacher predicts z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),7 on the original image, the student predicts z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),8 on the hard sample, and a weighted symmetric cross-entropy is minimized: z∼N(0,Id0),z \sim \mathcal N(0, I_{d_0}),9 with d0d_00 inside pseudo-break patches that belong to foreground in d0d_01, and d0d_02 otherwise (Zhou et al., 1 Aug 2025). The teacher is refreshed by exponential moving average,

d0d_03

The ablation results specifically attributed to Stage 2 report that adding TopoHG to a teacher-student baseline changes Dice from d0d_04 to d0d_05, clDice from d0d_06 to d0d_07, and d0d_08 from d0d_09 to ll0, corresponding to a ll1 percentage-point gain in clDice and a ll2 change in Betti error (Zhou et al., 1 Aug 2025). In comparisons against naïve augmentations, the full two-stage TopoTTA with TopoHG attains Dice ll3, clDice ll4, and ll5; Gaussian blur gives clDice ll6, Gaussian noise ll7, and spatial image swap ll8 with a smaller Betti error but substantially lower Dice ll9 (Zhou et al., 1 Aug 2025). The paper interprets pure spatial swap as over-connecting background, whereas TopoHG preserves high Dice while strengthening continuity.

5. Relation to topology-controlled and topology-guided generative methods

TopoHG sits in a broader landscape of topology-aware sampling and generation. One antecedent is "Efficient Topology-Controlled Sampling of Implicit Shapes," which develops a topology-controlled MCMC sampler, TC-GIMH-SS, for implicit level-set segmentations and shows how to impose hard topology constraints such as topology-preserving, genus-preserving, component-preserving, or unconstrained sampling (Chang et al., 2012). The method chooses proposals so that the Metropolis-Hastings acceptance ratio is identically Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m0, and the summary further describes a recipe for generating "hard" or adversarial shapes by modifying the target density with an auxiliary difficulty function Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m1. This is not called TopoHG in the paper title, but it provides a direct precedent for combining topology control with hardness-biased sampling.

Another related line is "Topology Guidance: Controlling the Outputs of Generative Models via Vector Field Topology," which studies controllable generation of 2D vector fields using a diffusion model in latent space coupled with a coordinate-based neural network (Wang et al., 11 May 2025). There the user specifies a topological descriptor Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m2 consisting of critical-point locations, types, and stability labels. Guidance is imposed during reverse diffusion by modifying the predicted noise with the gradient of a topology energy,

Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m3

The energy combines critical-point existence, type, and stability terms derived from the decoded field and the Jacobian eigenvalues at prescribed points. The reported evaluation includes alignment and Fréchet Distance metrics, with single-critical-point experiments showing alignment Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m4 for sink and source, Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m5 for saddle, and Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m6 compared with baseline Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m7 (Wang et al., 11 May 2025). This suggests a neighboring interpretation of topology-aware hard generation: instead of maximizing algorithmic hardness or inducing pseudo-breaks, the generator is guided toward specified topological events while remaining within the learned data distribution.

A plausible implication is that TopoHG, topology-controlled sampling, and topology guidance all share the same methodological skeleton: a base generative or sampling process is perturbed by a topology-sensitive signal, and the perturbation is evaluated not only by realism or likelihood but also by the induced structural configuration.

6. Extensions to topologically labeled synthetic data and conceptual scope

A further extension appears in a related specification built on "Generating Topologically and Geometrically Diverse Manifold Data in Dimensions Four and Below" (Hannouch et al., 2024). In that specification, a "Topology Hard Sample Generation" pipeline produces binary 2D, 3D, or 4D images with Betti-number labels known by construction. The pipeline begins with a filled Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m8-cube, carves out manifold-with-boundary connected sums with sampled parameters Nθ:Rd0→RmN_\theta : \mathbb R^{d_0}\to\mathbb R^m9, optionally applies hypervolume-preserving pixel-moving deformations and topology-preserving morphological deformations, computes exact cubical homology, and stores the sample together with AA00 (Hannouch et al., 2024).

The stated hardness metrics are explicitly topological: topological complexity

AA01

persistence-entropy vectors AA02, and minimum nonzero persistence in persistence diagrams (Hannouch et al., 2024). The same specification provides examples such as a 2D genus-AA03 curve with AA04, a 3D two-torus example with AA05, and a 4D AA06 tube with AA07.

This broader usage sharpens an important conceptual distinction. In the graph setting, "topology" refers primarily to graph topology and algorithmic worst cases; in tubular segmentation, it refers to continuity and breakage of curvilinear structures; in topology-guided field generation, it refers to critical-point configurations; and in manifold-data generation, it refers to homology and Betti-number control. The literature therefore uses the label TopoHG heterogeneously. A common misconception would be to treat it as a single standardized model family. The evidence instead supports a narrower claim: TopoHG is a reusable methodological motif for generating structurally difficult or structurally specified samples, with the operative notion of topology determined by domain-specific invariants and failure modes.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Topology Hard Sample Generation (TopoHG).