Stable-Semantic Graph (SSG)
- Stable-Semantic Graph (SSG) is a principled framework that models invariant semantic and functional relationships in complex data like 3D maps and EVM bytecode.
- It employs dynamic graph structures with explicitly defined nodes and edges to capture robust relational topologies and mitigate noise and structural variations.
- Empirical results show that SSG outperforms traditional methods in both robotic loop closure and smart contract similarity detection through advanced matching and embedding techniques.
A Stable-Semantic Graph (SSG) is a principled graph-based representation framework designed to robustly encode high-level semantic or functional relationships within complex environments or program structures. The SSG formalism has been pivotal in two major areas: robust loop closure in robot localization by modeling 3D semantic environments (Yu et al., 2022), and accurate similarity detection for Ethereum Virtual Machine (EVM) bytecode by capturing semantically stable instruction relationships (Chen et al., 17 Nov 2025). In both contexts, the SSG structure explicitly models stable elements—objects in 3D space or stable EVM instructions—and their critical relational topologies, enabling resilience against noise, ambiguity, and superficial variation.
1. Formal Specification
3D Semantic SSG for Robotics
In the robotics context, the SSG encodes a global map as a graph , where each vertex represents a semantically annotated, volumetric object and each edge denotes co-visibility and topological distance between object pairs:
- Node : , where is the object’s TSDF model, is its pose, its semantic label, its predicted mask, and its embedding set.
- Edge : Euclidean distance between object centers, if co-visible in any local map: .
- Graph: , .
SSG for EVM Bytecode Similarity
For smart contract analysis, the SSG of a single EVM function is a directed, heterogeneous graph:
- Nodes :
- : Control-flow nodes, each a “stable instruction” ( = {SLOAD, SSTORE, LOG0…LOG4, CALL, STATICCALL, etc.}).
- : Data-flow nodes, including sources (constants, environment vars, etc.) and sinks (storage slots, call arguments, etc.).
- Edges:
- : Control-flow edges between stable instructions.
- : Data-flow edges from source to sink variables.
- : Declarative links from stable instructions to the data elements they manipulate.
- Type Maps and Features:
- Node type mapping , edge type mapping , and node feature mapping (opcode one-hot for instructions, structured encodings for data nodes).
2. Construction Algorithms
Robotics: Semantic Map Building and Association
- Every incoming frame yields a set of object detections with associated mask, semantic label, confidence, and embedding.
- Data association cast as a linear assignment problem for binary assignment , minimizing a fusion cost of mask IoU, embedding similarities, and semantic label uncertainty using: where tunes the balancing of cues.
- Edges in the SSG are dynamically updated with each new object observed as co-visible.
EVM SSG: Stable Instruction Extraction and Graph Synthesis
- Bytecode is parsed, CFG obtained; each basic block is scanned for stable instructions (), constructing .
- For control-flow edges (), link key statements within and across blocks in program order, handling cases where predecessor blocks lack stable instructions recursively.
- For data-flow edges (), a backward taint analysis over the EVM’s local/stack/memory model identifies sources for each sink; edges are added from sources to sinks.
- For control-to-data (), connect each stable instruction to its sink data nodes.
Matrix representations: combine into adjacency tensors for heterogeneous GNN input.
3. SSG-Based Matching and Reasoning
Robust Loop Closure (Robotics)
- Graph matching for loop closure is posed as a Quadratic Assignment Problem: subject to assignment constraints, with
and
- The relaxation enables spectral approximation for efficiency, followed by pose alignment (RANSAC+ICP) and loop constraint injection into the global pose graph.
EVM Bytecode Similarity
- SSG graphs are embedded via a two-tower Siamese heterogeneous GNN. Each SSG is decomposed into:
- Node feature matrix
- Edge-type adjacency tensors
- The heterogeneous GNN updates node states with relation-specific message passing: with graph-level pooling and cosine similarity for downstream contract matching.
- A pairwise contrastive loss trains the network, bringing together similar contract embeddings (positive pairs) and pushing apart dissimilar ones (negative pairs).
4. Empirical Evaluation
Robotics
- The object-level assignment significantly outperforms nearest-neighbor in accuracy for object association.
- Graph matching-based loop closure is more robust to appearance changes than prior methods, as the SSG relies on semantically stable object representation and topological relationships, not purely visual or geometric cues (Yu et al., 2022).
EVM Bytecode Analysis
Empirical metrics for SSG-based EVM analysis (Chen et al., 17 Nov 2025):
| Aspect | Performance | Baseline Comparison |
|---|---|---|
| SSG Control-Flow | F1 = 100% | - |
| SSG Data-Flow | F1 = 95.16% | - |
| Similarity Detection (AUC) | 0.963 (Siamese GNN) | FuzzHash: 0.818, Genius (ACFG): 0.837, Eclone: ≈0.94 |
| SSG Extraction Time | 26 s/contract | - |
| SSG Embedding Time | 0.06 s/graph | - |
| Large-Scale Search | <5 s (2.6M contracts/6 chains) | - |
SSG-based similarity detection outperforms all tested baselines, including Etherscan, especially in cross-version and optimization-variant scenarios.
5. Distinguishing Features and Stability
- SSGs grant robustness by exclusively representing stable, high-level semantic units:
- In 3D mapping: objects that act as viewpoint- and appearance-invariant landmarks.
- In EVM: instructions whose semantics are preserved across compiler versions and source diversity.
- The explicit encoding of both control-flow and data-flow, as well as heterogeneous relationships, imparts the invariance needed to resist both spurious code changes and environmental fluctuations.
- In robotics, the SSG’s topological structure ensures that even partial or occluded environments retain matchability for loop closure, correcting drift via semantic alignment rather than dependence on repeatable local features.
- In contract analysis, the methodology yields graph representations that remain stable despite optimizer or compiler idiosyncrasies, allowing reliable fuzzy (cross-version) matching.
6. Applications and Impact
- In robotics, SSGs enable consistent long-term localization and mapping via robust semantic loop closure, contributing to persistent autonomy in environments with appearance or partial geometric changes (Yu et al., 2022).
- In the context of blockchain, SSG empowers large-scale, accurate detection of functionally similar EVM bytecode, advancing security, code similarity measurement, and vulnerability search across millions of contracts with verified efficiency and high recall (Chen et al., 17 Nov 2025).
A plausible implication is that SSGs, by prioritizing stable semantic structure over superficial or low-level patterns, set a general paradigm for robust representation in both physical and digital domains characterized by structural variability.