Why Hierarchical Interest Representation Matters
If you’ve ever wondered how Meta serves relevant ads even when users rarely click or convert, the answer lies in a new research area called Hierarchical Interest Representation. Traditional deep funnel ranking relies on sparse engagement signals—a few clicks, a purchase here and there. At Meta’s scale (billions of users, millions of advertisers), this sparsity is a fundamental bottleneck.
Hierarchical Interest Representation solves this by learning a universal, upstream representation layer over the entire ads ecosystem. It unifies users, advertisers, products, and services into a single embedding space. Instead of treating each ad impression in isolation, the system reasons about long-range, graph-structured relationships between entities.
This is not just an incremental improvement. It’s a paradigm shift: moving from shallow, signal-starved models to knowledge-enriched, multi-hierarchical representations that generalize to rare and unseen entities.
Reference: Meta Engineering Blog – Exploring Hierarchical Interest Representation for Meta Ads Deep Funnel Optimization

Core Architecture: Transformer on a Graph
Hierarchical Interest Representation is built on a typed, weighted, time-decayed heterogeneous graph. Nodes represent users, ads, advertisers, campaigns, products, and pixels. Edges capture interactions—clicks, views, purchases—each with a timestamp and action type.
The Hierarchical Encoder
The encoder is a transformer adapted for graph data. Key innovations:
- World Knowledge Enrichment: Multimodal features (text, images, video) from advertiser catalogs are processed via LLMs to produce rich initial embeddings. This allows the model to understand what a product is, not just how users interact with it.
- Structure Encoders: A node encoder fuses node-type, deep-hash-controlled node-ID, world knowledge, and per-type metadata. A position encoder injects local topology via random walk and importance-prioritized sampling. An edge encoder adds edge type, weight, and temporal signals.
- Bias Composition: Graph-structural signals (node-type transitions, shortest-path distances) are added as attention biases. This makes the model topology-aware, avoiding the over-smoothing problem common in message-passing GNNs.
- Memory-Efficient Attention: Using FlexAttention, graph-structural biases are computed on the fly—no full pairwise bias matrix is materialized. This enables scaling to billions of nodes.
# Simplified pseudocode illustrating the attention bias composition
import torch
import torch.nn.functional as F
def hierarchical_attention(query, key, value, edge_bias, node_type_bias):
"""
query, key, value: [batch, seq_len, d_model]
edge_bias: [batch, seq_len, seq_len] – structural bias from graph
node_type_bias: [batch, seq_len, seq_len] – type transition bias
"""
scores = torch.matmul(query, key.transpose(-2, -1)) / (key.size(-1) ** 0.5)
scores = scores + edge_bias + node_type_bias # inject graph structure
attn_weights = F.softmax(scores, dim=-1)
output = torch.matmul(attn_weights, value)
return output
Training: Self-Supervised Cross-View Distillation
Training uses a teacher-student setup. For each anchor node, a broad teacher view and a narrow student view are sampled. The student learns to predict the same interest cluster as the teacher. Sinkhorn-Knopp balanced assignment prevents cluster collapse.
An engagement prediction head adds supervised signal: given two node representations, an engagement type, and a time, predict whether a real edge exists. This grounds the latent clusters in observed user behavior.

Bag-of-Meaning Tokens: From Embeddings to Actionable Units
Continuous embeddings are powerful for ranking, but they’re not suited for inverted-index retrieval or human interpretation. Hierarchical Interest Representation discretizes them into Bag-of-Meaning (BoM) tokens via composite quantization.
- A user is represented by the BoM tokens describing their interests.
- An ad or advertiser is represented by the BoM tokens of the interests they serve.
This enables fast, compact recall for retrieval and augments personalization with latent interest signals.
Technical Challenges & Limitations
| Challenge | Mitigation | Remaining Limitation |
|---|---|---|
| Sparse user feedback | Self-supervised distillation from broad graph views | Cold-start for entirely new user segments |
| Long-range relationship capture | Graph-structural attention biases | Computational cost still high for real-time serving |
| Temporal causality | Strict cutoff timestamps, chronological train/val/test splits | Requires careful infrastructure to avoid data leakage |
| Embedding freshness | Online graph engine with pipelined GPU training | Frequent retraining still expensive; parameter-efficient fine-tuning is future work |
Key Caution
Hierarchical Interest Representation is designed for Meta’s specific ecosystem. The infrastructure requirements (billions of nodes, online graph engine, custom attention kernels) are prohibitive for most organizations. However, the core ideas—world knowledge enrichment, hierarchical clustering, self-supervised graph learning—can be adapted for smaller-scale recommendation systems.

Conclusion & Next Steps
Hierarchical Interest Representation is a significant step toward solving signal sparsity in deep funnel ads. By unifying users, advertisers, and products in a single, knowledge-enriched embedding space, it enables more relevant ad delivery even when explicit feedback is rare.
For engineering teams building similar systems, the key takeaways are:
- Enrich sparse signals with world knowledge—use LLMs to understand the semantics of products and ads.
- Think hierarchically—coarse interest clusters for stability, fine-grained tokens for specificity.
- Invest in graph infrastructure—online graph engines with temporal causality are essential for production.
What to Read Next
- Beyond the Model: How Pantone Built an AI-Ready Data Foundation for Agentic Creativity
- Privacy by Design: How Airbnb Built Context-Aware Social Features Without Sacrificing Trust
Further Learning
- Dive into graph neural networks with PyTorch Geometric or DGL.
- Explore self-supervised learning methods like SimCLR and BYOL for graph data.
- Study large-scale transformer architectures (e.g., Longformer, BigBird) for long-range dependencies.