---
title: "GraphRAG Hybrid Search"
description: "Combine vector similarity with knowledge graph traversal for contextually richer retrieval"
canonical: "https://docs.ainative.studio/docs/guides/graphrag"
last-updated: "2026-10-03T21:47:10.764Z"
---

# GraphRAG Hybrid Search

Source: https://docs.ainative.studio/docs/guides/graphrag

> Combine vector similarity with knowledge graph traversal for contextually richer retrieval

# GraphRAG Hybrid Search

GraphRAG blends two retrieval strategies: **vector similarity** (what's semantically similar?) and **graph proximity** (what's contextually connected?). The result is retrieval that understands not just meaning, but relationships.

## Why GraphRAG?

| Approach | Finds | Misses |
|----------|-------|--------|
| **Vector only** | Semantically similar content | Connected but differently-worded content |
| **Graph only** | Structurally related entities | Content not yet linked to entities |
| **GraphRAG** | Both — blended by configurable weight | Nothing (best of both worlds) |

**Example:** You ask "What is Company X's pricing strategy?"

- **Vector search** finds memories mentioning "pricing" or "strategy"
- **Graph traversal** finds: Company X → negotiation with Person Y → budget constraint Z → competitor comparison W
- **GraphRAG** returns all of these, ranked by blended score

## How It Works

```
1. Vector search → top 20 candidate memories
2. Extract entity names from candidates
3. For each entity, traverse 2 hops in the knowledge graph
4. Score: final = (vector_score × 0.7) + (graph_proximity × 0.3)
5. Re-rank and return top N
```

Graph proximity scoring:
- Directly linked to a traversed entity: **1.0**
- 1 hop away: **0.5**
- 2 hops away: **0.25**

## Usage

```bash
curl -X POST https://api.ainative.studio/api/v1/public/memory/v2/graph/graphrag \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What pricing strategies does Company X use?",
    "limit": 10,
    "graph_weight": 0.3,
    "max_hops": 2
  }'
```

## Tuning `graph_weight`

| Value | Behavior | Best For |
|-------|----------|----------|
| `0.0` | Pure vector search | General similarity queries |
| `0.1-0.3` | Mostly vector, light graph boost | Default — good for most use cases |
| `0.4-0.6` | Balanced | Multi-entity questions |
| `0.7-0.9` | Mostly graph | Relationship-focused queries |
| `1.0` | Pure graph proximity | "How is X connected to Y?" |

## Response Shape

```json
{
  "results": [
    {
      "id": "memory-uuid",
      "content": "Company X proposed a 15% discount...",
      "score": 0.82,
      "vector_score": 0.75,
      "graph_boost": 0.98,
      "memory_type": "episodic",
      "entity_id": "company_x",
      "tags": ["negotiation", "pricing"]
    }
  ],
  "query": "pricing strategies",
  "graph_weight": 0.3,
  "max_hops": 2,
  "entities_traversed": ["company_x", "person_y", "competitor_z"],
  "total": 10
}
```

## Prerequisites

GraphRAG works best when:
1. Memories are stored via `/remember` (builds the vector index)
2. Entities are created via `/entity` (builds the graph)
3. Edges connect entities via `/edge` (enables traversal)

Without a graph, GraphRAG falls back to pure vector search (graph_boost = 0 for all results).
