3D Scene Graph Filtering using Graph Neural Networks
M.Sc. thesis — a heterogeneous Graph Attention Network that prunes task-irrelevant nodes from 3D scene graphs before a VLM planner ever sees them, achieving 66% navigation success vs 8% without filtering.

Built with
- PyTorch Geometric
- PyTorch
- BLIP-2
- CLIP
- Gemini
- Habitat-Sim
The core problem: too much context kills grounding
“Make me a meal” is a simple instruction for a human. For a robot it is an open-ended affordance query — no explicit object, no explicit room, no action sequence. Modern Vision–Language Models (VLMs) have dramatically improved the ability to interpret these queries, but they hit a hard wall when fed an entire 3D scene graph.
A typical indoor scene (from the Habitat-Matterport 3D Semantics dataset used here) contains ~661 distinct objects across ~106 categories. Serialising the full graph into a VLM prompt causes two distinct failure modes:
- Context pressure. Relevant objects compete with noise for limited attention.
- Hallucination. Confronted with hundreds of marginally-related facts, the VLM starts confidently inventing relationships that were never in the graph.
The second failure is the more dangerous one. More context is not free — it actively degrades grounding.
The solution: filter first, then reason
The thesis proposes inserting a learned Graph Neural Network filter between perception and the planner. The GNN reads the full scene graph together with the task query and assigns each node a relevance score. Only the high-scoring subgraph is forwarded to the VLM.
3D Mesh ──► Feature Extraction ──► Graph Neural Network ──► Filtered Graph
Task ──► Encoding Nodes ──► (Heterogeneous GAT) ──► VLM Planner ──► Plan
└── 3D Scene Graph ──┘
This decomposition lets the VLM receive a small, grounded subgraph and spend its entire capacity on actual planning.
Background: the theoretical building blocks
Scene Graphs
A 3D scene graph is a hierarchical structure with three semantic layers:
- Leaf nodes — individual objects (chair, mug, table…) with image and location attributes
- Intermediate nodes — rooms and floors (living room, bedroom…) with category labels
- Root node — the building itself
- Edges — spatial/semantic relationships (object in room, room on floor)
Generation pipelines (Hydra, Kimera) process LIDAR/RGB-D data through 3D point-cloud segmentation, then build the graph by connecting nodes according to spatial coordinates and visual similarity.
Graph Attention Networks (GAT)
GATs are the core message-passing primitive used throughout this work. Given a graph with node features :
Linear feature transformation:
Attention coefficient between node and neighbour :
where is a learnable attention vector and denotes concatenation.
Softmax normalisation over the neighbourhood :
Feature aggregation via message passing:
For attention heads, features are either concatenated or averaged:
Heterogeneous GNNs
Because the scene graph contains different node types (object, room, root, image, query) and different edge types, a standard homogeneous GNN cannot be applied directly. The heterogeneous extension defines:
where is the set of node types and is the set of edge types.
Node representation update at layer :
Edge-specific aggregation for edge type :
Final node embedding combining all edge-type messages:
Foundation models used for node encoding
CLIP
CLIP aligns image and text in a shared latent space via contrastive learning. Given image and text :
Cosine similarity:
Symmetric contrastive loss (logits ):
Used in this work: CLIP ViT-L/14@336px (768-dimensional embeddings).
BLIP-2
BLIP-2 introduces a lightweight Querying Transformer (Q-Former) that bridges a frozen image encoder and a frozen LLM. Three training objectives:
ITC Loss — aligns query embeddings with text in shared latent space:
ITM Loss — fine-grained image–text alignment:
Used in this work: BLIP-2 with ViT-L/14 — the first query feature from 32 learned Q-Former queries produces image embeddings . Text embeddings are the [CLS] token from the text encoder: .
Approach
Problem definition
Formally: given a hierarchical 3D scene graph with nodes (carrying object images as attributes) and a task query , find a subgraph with nodes such that the set of planning-critical nodes .
The filter must retain all objects needed to construct a plan while discarding as many irrelevant ones as possible.
Data generation pipeline
Step 1 — Visual data collection (Algorithm 1): For each object in Habitat-Sim, a robot navigates to randomised viewpoints:
where , , .
Images are scored via segmentation mask coverage (kept only if ). The top-5 images per object are selected: .
Step 2 — Graph generation: Each object becomes a leaf node; nodes are linked to rooms identified by Gemini-1.5-flash; rooms connect to a central root node.
Step 3 — Query generation: Three query categories are generated per scene:
- [Object] — e.g., “bed”, “table” (12,000 training / 2,800 validation samples)
- [Object] in [Room] — e.g., “bed in bedroom” (50,000 training / 12,000 validation)
- [Synonym(Object)] in [Room] — e.g., “mat in living room” instead of “carpet in living room” (14,000 test-only)
Node encoding
Node features are extracted via BLIP-2 and CLIP. Image features: (Q-Former first query, ). Text features: [CLS] token, ().
The data graph has five node types and two directed edge categories:
| Node type | Role | Initial feature |
|---|---|---|
| query | Task text embedding | BLIP-2/CLIP text encoder |
| image | Object image embedding | BLIP-2/CLIP image encoder |
| object | Object entity | zero vector |
| room | Region entity | zero vector |
| root | Global root | zero vector |
Edges: to (image → graph) and rev_to (reverse). Ground truth is binary per node.
The heterogeneous GAT model
The model runs 3 message-passing layers, each containing up to 9 separate GAT sub-networks handling the distinct edge-type pairs. Two architectural principles govern the design:
- Information nodes (query, image) are immutable — information flows only outward, preventing self-loops that would corrupt the stored embeddings.
- Separate weight matrices per modality — image-to-object and query-to-object/room interactions use distinct GATs because the two modalities live in different feature spaces.
Room node update
Room nodes receive messages from root, object, and query neighbours via two independent GATs.
Entity–entity aggregation ():
Attention coefficient:
Query–entity aggregation (): aggregates over for (the text token embeddings) to produce .
Combined room feature:
Object node update
Object nodes connect to rooms, images, and query. Three separate GATs produce (entity messages), (query messages), and (image messages via ):
Final output
After 3 message-passing rounds, a linear layer + sigmoid maps each entity node’s feature to a binary relevance score:
Baseline model
The heuristic baseline uses zero-shot CLIP cosine similarity. For the -th object image:
The object score is where is the maximum score across all 5 images.
Training
The task is framed as binary node classification. Binary cross-entropy with logits:
Only entity nodes (object and room) contribute to the loss — information nodes are excluded.
| Hyperparameter | Value |
|---|---|
| Epochs | 50 |
| Model | GAT |
| Layers | 3 |
| Hidden layer size | 512 |
| Attention heads | 1 |
| Batch size | 16 |
| Dropout | 0.20 |
| Learning rate | 0.001 |
| Optimizer | Adam |
| Loss function | BCEWithLogitsLoss |
Evaluation metrics
The dataset is severely imbalanced: ~600 objects per scene but only ~3 relevant on average per query. Two metrics are used to handle this:
AUPRC — Area Under the Precision-Recall Curve. Ideal classifier = 1.0; random classifier ≈ fraction of positive instances.
Retrieval Hit Rate @ k (R@k) — proportion of queries where at least one relevant object appears in the top-k results:
R@k directly measures whether the planner has enough information to build a plan, since even a single correct object instance is sufficient.
Experimental results
Dataset
Habitat-Matterport 3D Semantics Dataset: 216 photorealistic 3D indoor spaces, ~142,000 object annotations. Training split: 145 scenes (1,203 object categories, 97 room categories). Validation split: 36 scenes (673 object categories, 42 room categories).
Query Type: [Object]
| Model | Image Enc. | Text Enc. | AUPRC | R@1 | R@2 | R@3 |
|---|---|---|---|---|---|---|
| CLIO (heuristic) | CLIP | CLIP | 0.21 | 0.42 | 0.55 | 0.62 |
| GNN (ours) | BLIP-2 | BLIP-2 | 0.64 | 0.62 | 0.74 | 0.79 |
The GNN outperforms the zero-shot baseline because it learns spatial information — it can automatically disregard entire rooms and their objects when they are irrelevant to the query.
Query Type: [Object] in [Room]
| Model | Image Enc. | Text Enc. | AUPRC | R@1 | R@2 | R@3 |
|---|---|---|---|---|---|---|
| Heuristic | CLIP | CLIP | 0.14 | 0.30 | 0.42 | 0.49 |
| GNN (ours) | BLIP-2 | BLIP-2 | 0.57 | 0.59 | 0.70 | 0.76 |
The heuristic collapses here because image embeddings contain no room-specific information. The GNN infers room membership by analysing which object nodes are connected in the graph.
Query Type: [Synonym(Object)] in [Room] (generalisation test)
| Model | Image Enc. | Text Enc. | AUPRC | R@1 | R@2 | R@3 |
|---|---|---|---|---|---|---|
| Heuristic | CLIP | CLIP | 0.10 | 0.24 | 0.36 | 0.43 |
| GNN (ours) | BLIP-2 | BLIP-2 | 0.30 | 0.45 | 0.58 | 0.64 |
Synonym queries expose a weakness in text encoders that do not align semantically equivalent words (“mat” vs “carpet”). CLIP, Blip2, and Gemini encoders generalise better than BERT here due to their contrastive training objectives.
Query Type: Affordance Instructions (qualitative)
The model correctly resolves open-ended affordance queries by leveraging both visual and spatial cues:
| Query | Top retrieved objects |
|---|---|
| “A place to relax” | sofa (room), armchair (room), pillow (living room) |
| “A place to relax in bedroom” | bed (bedroom), pillow (bedroom) |
| “A place to relax in living room” | armchair, pillow, dining bench (living room) |
| “Cook me a meal” | kettle, coffee machine, oven (dining room) |
| “Do the dishes and wipe the counter” | kitchen sink, kitchen cabinet, cutting board (dining room) |
When the query specifies a region, the model accurately retrieves only objects from that region — demonstrating that the graph structure encodes and propagates regional identity through message passing.
VLM Planner: Navigation Task
The end-to-end test uses Gemini-1.5-flash as the planner on 100 navigation tasks of type “Find a [Object] in [Room]” on map 00821-eF36g7L6Z9M. The VLM receives the top-5 images from the filtered graph and must select the correct navigation target (success = within 1 m of the desired position).
| Filter method | Filter success rate | VLM success rate |
|---|---|---|
| GNN (ours) | 0.89 | 0.66 |
| Heuristic (CLIP) | 0.55 | 0.27 |
| Unfiltered (full graph) | — | 0.08 |
The GNN filter is 2.4× more effective than the heuristic and 8.25× more effective than no filter at all. The drop from filter success (0.89) to VLM success (0.66) is attributed to the VLM selecting visually clear images from the wrong room — a remaining challenge since the VLM lacks explicit room-awareness.
Ablation studies
Node embedding encoders
All tested encoder combinations perform similarly on in-distribution query types (AUPRC ~0.57–0.58 for [Object] in [Room]), confirming the architecture is encoder-agnostic:
| Image Enc. | Text Enc. | AUPRC | R@1 | R@3 | R@10 |
|---|---|---|---|---|---|
| CLIP | CLIP | 0.57 | 0.60 | 0.78 | 0.90 |
| CLIP | BERT | 0.57 | 0.58 | 0.76 | 0.88 |
| CLIP | Gemini | 0.58 | 0.59 | 0.77 | 0.89 |
| BLIP-2 | BLIP-2 | 0.57 | 0.59 | 0.76 | 0.89 |
| Llava layer0 | Llava layer0 | 0.56 | 0.57 | 0.74 | 0.87 |
For synonym generalisation, CLIP, BLIP-2, and Gemini text encoders outperform BERT (R@1: 0.42–0.45 vs 0.36) because they align semantically similar texts — a direct consequence of contrastive pre-training.
Graph structure
Two connectivity variants were tested:
- Type I — query nodes connected to every entity node (room, object, root)
- Type II — query nodes connected only to the root node
| Graph type | AUPRC | R@1 | R@2 | R@3 |
|---|---|---|---|---|
| Type I | 0.55 | 0.56 | 0.68 | 0.74 |
| Type II | 0.50 | 0.52 | 0.63 | 0.69 |
Type II is computationally cheaper but loses performance because the query signal requires more hops to reach leaf object nodes, attenuating through each message-passing step.
Key novelties
Flexible multi-image representation. Prior GNN scene-graph methods fix the number of images per object. This architecture accepts a variable number of image nodes per object, allowing noisy/cluttered scenes to use more views while clean large objects use fewer.
Heterogeneous GATs with immutable information nodes. Information nodes (image embeddings, query embeddings) are frozen throughout message passing. This prevents the stored embeddings from being corrupted by the structural context — they remain pure feature sources rather than becoming blended representations.
Modality-specific weight matrices. Instead of a single shared weight matrix, separate GATs handle image→object and query→object/room message flows, respecting the semantic distance between visual and textual feature spaces.
Encoder-agnostic architecture. Any combination of image and text encoders producing 768-dimensional embeddings (CLIP, BLIP-2, BERT, Gemini) can be plugged in without structural changes, enabling rapid adaptation to new foundation models.
Structural region reasoning. Unlike heuristic CLIP-similarity methods, the GNN infers which room an object belongs to by inspecting its graph neighbourhood. This is the primary reason for the 1.5–2× improvement on region-qualified queries.
Conclusion
Without scene graph filtering, a VLM planner succeeds on navigation tasks at only 8% — essentially failing. A simple CLIP cosine-similarity heuristic raises this to 27%. The heterogeneous GAT filter presented here reaches 66% success, delivering a 2.4× gain over the heuristic and making VLM-based robotic planning practical for real indoor environments.
The architecture’s flexibility — variable image count per node, interchangeable encoders, principled handling of heterogeneous edge types — positions it as a general-purpose preprocessing module for any perception-to-planning pipeline that uses scene graphs as its environmental representation.