| name | hypergraph-memory-rag |
| title | Improving Multi-step RAG with Hypergraph-based Memory for Long-Context Complex Relational Modeling |
| version | 0.0.2 |
| engine | skillxiv-v0.0.2-claude-opus-4.6 |
| license | MIT |
| url | https://arxiv.org/abs/2512.23959 |
| keywords | ["RAG","retrieval-augmented-generation","multi-step reasoning","hypergraph memory","knowledge representation","LLM"] |
| description | Build hypergraph-structured memory systems for multi-step RAG that capture high-order relationships between facts, enabling stronger reasoning across long contexts. Use when combining multiple retrieved documents in complex reasoning chains that require understanding connections between pieces of information. |
When to Use This Skill
- Multi-step QA systems requiring reasoning across multiple documents
- Long-context reasoning tasks that need to maintain relationships between facts
- Complex relational modeling where document connections matter
- Workflows combining retrieval with iterative refinement
When NOT to Use This Skill
- Single-step information retrieval tasks
- Simple keyword-based lookup without reasoning requirements
- Tasks where retrieved chunks are independent
- Real-time systems with strict latency constraints (hypergraph operations add overhead)
Core Concepts
Traditional RAG systems store retrieved information as isolated facts. HGMem instead represents this memory as a hypergraph where:
- Nodes represent facts, thoughts, or retrieved passages
- Hyperedges create higher-order interactions linking 3+ concepts together
- Graph structure evolves as new information is retrieved and integrated
This enables the system to form "stronger propositions for deeper reasoning" by understanding how multiple facts relate to each other.
Implementation Pattern
The hypergraph memory approach proceeds through three phases:
1. Fact Insertion
Each retrieved document or generated thought is inserted as a node with semantic embedding and metadata about its provenance.
2. Relationship Formation
As new information arrives, the system identifies which existing nodes should be connected via hyperedges. This captures semantic or logical relationships (e.g., "Fact A explains Fact B", "Entity X appears in both C and D").
3. Reasoning Over Hypergraph
When generating the next reasoning step, traverse the hypergraph to gather contextually relevant clusters of connected facts rather than individual isolated pieces.
Python Pseudocode Structure
class HypergraphMemory:
def __init__(self, embedding_model):
self.nodes = {}
self.hyperedges = []
.embedding_model = embedding_model
():
embedding = .embedding_model.encode(text)
node_id = (.nodes)
.nodes[node_id] = {
: text,
: embedding,
: source_id,
: metadata
}
node_id
():
(node_ids) < :
hyperedge = {
: node_ids,
: relationship_type,
: current_step
}
.hyperedges.append(hyperedge)
():
relevant_edges = ._find_relevant_hyperedges(query_embedding)
context = []
edge relevant_edges[:k_hyperedges]:
cluster = [.nodes[nid][] nid edge[]]
context.extend(cluster)
context