GreagraG:}为什么矢量搜索断开于 Corpus 级别 (中文 (Chinese Simplified))

GreagraG:}为什么矢量搜索断开于 Corpus 级别

Friday, 26 December 2025

//

14 minute read

您的 RAG 系统在 @ " @ idle@ MS K1 @ question *\ : 获取一些相关块, 并合成一个答案@ MPK3} 它与两种常见的查询类型 & MSC4} 挣扎着

  • 宣讲“: " 什么是本剧中的主题?”“?"”
  • 连接@: @ @ "# X在不同文档中与Y有何关系?

这些是'}没有被任何块回答 *.}它们需要 @+Q 群組@+Q 連結.

矢量搜索在此失败的原因 @:

  • 它排在大块的排名上 独立 与查询相似
  • 相近性选择性关联性 @, @ not 全球覆盖
  • 嵌入中捕捉 @ " @ 什么听起来类似@ MS K1 @ 不是 @ I"} 连接到什么 @ OMK3 @

您可以用提示和后传@ - programing @ MS K2 来强制您使用此选项, 但最终您将重建一个图形+-_ 形状解答@ MPK4}

关键洞察力 : GrapraG 更改检索单位@ . 对于您想要的“ MS K2 @ top_ -} 基本问题” , 您需要的是 “ " @ top@ MPK3QK 类似块@ I"; 连接连连的概念界 @(#和他们的总结@),}所以模型看到的是结构*,}不是碎片=.}

图图RAG 来源于微软研究@' @s 纸张 可供调用 Open -_来源执行“. ” 它保持向量搜索特定问题@,,但添加了一个知识图表和社区摘要,用于 proposal- 层次推理 @.

图示RAG系列导航 :

不使用 Gragrag 时

在“,”潜水前,让我们来‘'’ 清楚这什么时候是超杀? “:

  • 小文档集 (under @~50}文档 *): 只是使用矢量搜索
  • 只有"怎么回答问题?@:_Greagrag 贏了$'#t help
  • 统一内容 (No实体多样性 @):}没有图表结构可以利用
  • 成本:--受限制: 索引化需要许多LLM电话

如果您的用户只问特定问题 @,# 坚持 语义搜索当用户需要时, .Greag会闪耀 大全图@,,而且#'}比卖家认为的观众少

一. 导言导言 导言 导言 导言

系列导航: 这是RAG系列的 6Q部分

在整个系列中我们建立了越来越先进的RAG系统 我们从基本的矢量搜索开始 , 相似的块# , # 不是# 连接概念.为 平面Q- 您需要结构@ . @%

推荐路径@: 如果您已经拥有 Qdrant @-}基于本地本地搜索工作的@ (}就像我们使用 Python 侧车的原型“ ),” 以校验值 < , > 为本地搜索保留矢量@ I,, 为全域查询添加一个轻量级图@ MPK5DRIFT question@ MASK6}只要您已证实用户询问这些问题, 只去 “ MS K7_ full GraphraG"}

纯矢量RAG的问题

让我用一个具体的例子来给你们展示我指的是什么?

矢量 RAG 做得好

问题: 我如何使用HTMX与阿尔卑斯山 .js?"

矢量 RAG 进程:

  1. 嵌入了问题@: @ [0.234, -0.891, 0.567, ...]
  2. 在 Qdrant 中查找相似的块
  3. 返回上方的 HTMX 和 Alpine @. @%js 匹配@ info: tooltip
  4. LLM 合成这些块的答案

这是因为问题和有关内容是 字义相似嵌入式捕捉到相似性 .

// This is what our current SemanticSearchService does
var embedding = await _embeddingService.GetEmbeddingAsync(query);
var results = await _qdrantService.SearchAsync(
    collectionName: "blog_posts",
    queryVector: embedding,
    limit: 10
);
// Returns chunks about HTMX, Alpine.js, frontend patterns

矢量 RAG 角斗

问题: 我写的主要科技是什么? 彼此之间有何关系?

矢量 RAG 返回什么:

Result 1: "HTMX makes it easy to add AJAX to your pages..."
Result 2: "Docker Compose orchestrates multiple containers..."
Result 3: "PostgreSQL's full-text search is surprisingly capable..."
Result 4: "Alpine.js provides reactive state management..."

它提到Docker,PostgreSQL,HTMXMS K2ONNX}...,但是没有将它们组合起来 或解释它们如何连接.你得到的碎片=,不是洞察力@.

这个问题需要 和关系理解 您需要到 :\ \ {横跨整块体}.}

  • 查明提到的所有技术
  • 理解哪些是一起使用
  • 将它们合并为协调一致的主题

仅矢量相似性就 < '} t give you this. n如果您尝试用提示来修补它 MS K2 > 您最终会重塑一个图形@ .\ {

输入图形区域

图图RAG 是 Microsoft ResearchM'+%s 解决这个问题的解决方案 @._@ 图图RAG纸 标定的RAG处理不当的两种查询类型@( @%经济、社会、 和 连接@) 并建立了一个系统 专门解决他们的问题#.

而不是仅仅嵌入块@ , @ # GragRAG 构建 知识图 捕捉实体及其关系,}然后将它们分组成社区,并附有摘要MS K1}*

图图RAG如何工作

直观的管道 @:#

  • 正在索引@: @% “→”实体 /“关系” →图→社区=→摘要
  • 查询@: @ Global =社区摘要 @|DRIFT=路径@+摘要

GraphRAG在RAG管道中增加了几个组件 , 分为三类 :

  1. 采掘 -=YTET -伊甸园字幕组=- 翻译:
  2. 图图构建 ( 知识图存储@)
  3. 概述摘要 -=YTET -伊甸园字幕组=- 翻译:
flowchart TB
    subgraph "Traditional RAG (What We Have)"
        A[Documents] --> B[Chunks]
        B --> C[Embeddings]
        C --> D[Vector Store]
    end

    subgraph "GraphRAG Additions"
        B --> E[Entity Extraction]
        E --> F[Relationship Extraction]
        F --> G[Knowledge Graph]
        G --> H[Community Detection]
        H --> I[Community Summaries]
    end

    subgraph "Query Time"
        J[User Query] --> K{Query Type?}
        K -->|Specific| L[Local Search]
        K -->|Global| M[Global Search]
        K -->|Hybrid| N[DRIFT Search]

        D --> L
        G --> L
        I --> M
        G --> N
        I --> N
    end

    style E stroke:#f9f,stroke-width:2px
    style H stroke:#bbf,stroke-width:2px
    style I stroke:#9f9,stroke-width:2px

采掘实体

一个LLM读取每个块和摘录 实体 正在讨论的事情 ):

Chunk: "Docker Compose makes it easy to define multi-container applications.
        I use it with PostgreSQL for my blog's database layer."

Extracted Entities:
- Docker Compose (technology)
- PostgreSQL (database)
- blog (project)
- database layer (concept)

步骤#2: 关系分离

同一LLM确定各实体彼此的关系

Relationships:
- Docker Compose --[used_with]--> PostgreSQL
- blog --[has_component]--> database layer
- PostgreSQL --[implements]--> database layer

建设知识图

所有实体和关系都组成图表@: @%

graph LR
    subgraph "Frontend Cluster"
        HTMX[HTMX]
        Alpine[Alpine.js]
        Tailwind[Tailwind CSS]
    end

    subgraph "Infrastructure Cluster"
        Docker[Docker]
        Compose[Docker Compose]
        Postgres[PostgreSQL]
        Qdrant[Qdrant]
    end

    subgraph "AI/ML Cluster"
        ONNX[ONNX Runtime]
        Embeddings[Embeddings]
        RAG[RAG]
    end

    HTMX -->|used_with| Alpine
    HTMX -->|styled_by| Tailwind
    Alpine -->|styled_by| Tailwind

    Docker -->|orchestrated_by| Compose
    Compose -->|runs| Postgres
    Compose -->|runs| Qdrant

    ONNX -->|generates| Embeddings
    Embeddings -->|stored_in| Qdrant
    RAG -->|uses| Embeddings
    RAG -->|uses| Qdrant

    style HTMX stroke:#f9f
    style Docker stroke:#bbf
    style RAG stroke:#9f9

社区探测:#(Leiden Algorithm)_

缩略 Leiden算法 群集群聚将密集的节点连接到社区@. @% 重要原因是它给了你 稳定 集合组可以总结和检索;}这些社区成为您全球查询的检索单位 @.

  • 社区#1: @" @Frontend Stack@"(#HTMX},Alpine @.{js @MS K6尾风 @)#
  • 社区#2: @"#container structure@"#(#docker},poste,posgreSQLMS K6Qdrant)#
  • 社区#3: MS K1RAG 管线 MASK2 I(ONX, 嵌入式 MPK5 Qdrant,RAG})

Qdrant如何在两个社区出现@:它连接基础设施,

社区摘要

一项LLM为各个等级层次的每个社区编制摘要*:

Community 1 Summary (Frontend Stack):
"The frontend approach combines HTMX for server-driven interactivity
with Alpine.js for client-side state management, styled using Tailwind CSS.
This stack prioritizes HTML-first development with minimal JavaScript,
focusing on progressive enhancement over SPA complexity."

Community 2 Summary (Container Infrastructure):
"The blog runs on Docker Compose, orchestrating PostgreSQL for persistent
storage, Qdrant for vector search, and the ASP.NET Core application.
This containerized architecture enables consistent local development
and production deployment."

查询模式

图示RAG 提供三种查询模式@, 每种为不同问题类型优化的查询模式 @:

全局搜索

最好的为: “"”什么是主要主题?“?" ” @" @Summarization the key discussions@."

使用社区摘要@( @% not personal groups @)}回答感知问题=:

Query: "What technologies does this blog cover most?"

Process:
1. Retrieve all community summaries
2. Map: Ask LLM to extract technology themes from each summary
3. Reduce: Combine partial answers into final response

Response:
"The writing centres on three technology clusters:
1. **Frontend Development** - HTMX, Alpine.js, Tailwind CSS for minimal-JS web UIs
2. **AI/ML Infrastructure** - RAG pipelines, ONNX embeddings, vector search with Qdrant
3. **DevOps/Containerization** - Docker, PostgreSQL, ASP.NET Core deployment"

本地搜索

最好的为: @"}我如何配置 X?"} @ " 什么是YMS K3}

使用传统矢量搜索的组合实体-焦点图形横跨@:

Query: "How do I use Qdrant with ONNX embeddings?"

Process:
1. Identify entities in query: Qdrant, ONNX, embeddings
2. Retrieve graph neighborhood around those entities
3. Also retrieve vector-similar chunks
4. Combine into rich context for LLM

Response includes:
- Direct relationships (ONNX generates embeddings stored in Qdrant)
- Related entities (all-MiniLM-L6-v2 model, cosine similarity)
- Specific code examples from vector-retrieved chunks

DRIFT 搜索

最好的为: @"_X与Y?"}#"}A和B."有何关系?

DRIFT 搜索@( @Dynamic Absociation and Inference with fleal Trevaral_), 移动轨迹的动态原因和推断 如Greagrag docs中所述, 将本地搜索与社区环境. ItMS K2 仍然使用LLM推理法对检索的结构化上下文的推理@(not 魔法图形发酵), 但结构有助于 LLM看到它会错失和平板块的连接

Query: "How do the frontend and backend technologies connect?"

Process:
1. Start with entities: HTMX, ASP.NET Core
2. Traverse graph to find connection paths
3. Include community summaries for context
4. Generate answer showing the full picture

Response:
"HTMX makes requests to ASP.NET Core endpoints, which query PostgreSQL
and Qdrant. The connection flows through the API layer, where endpoints
return HTML fragments that HTMX swaps into the DOM. Alpine.js handles
client-side state for interactive components like search typeahead."

将图形RAG与我们目前的系统进行比较

Let's 映射 GragraG 概念到我们已有的概念 Mostlylucid.SemanticSearch:

Q 元件 @ Q 当前系统@ QG GrapraG 等效元素 @MS K3Q}
内嵌 OnNX MS K1All-MINILMAMPK3LI6-V}2)Same MSk67Or OpenAIMSKO8MS K9
矢量存储 Qdrant QDrent/LanceDBMS K3
开采实体 -=YTET -伊甸园字幕组=- 翻译:
知识图 None @ 图表数据库@/ in-memory {
社区探测 Leiden 算法 * *
查询@: @% 特定 SemanticSearchService.SearchAsync() 本地搜索 @
查询% : @% 全球 & @% 不支持@ @ global search @ MS K2 @

我们目前的执行程序 本地搜索 GreagraG会增加 全局搜索 和 DRIFT 搜索 能力 @.

// What we have today (Local Search equivalent)
public async Task<List<SearchResult>> SearchAsync(string query, int limit = 10)
{
    var embedding = await _embeddingService.GetEmbeddingAsync(query);
    return await _qdrantService.SearchAsync("blog_posts", embedding, limit);
}

// What GraphRAG would add
public async Task<string> GlobalSearchAsync(string query)
{
    // 1. Retrieve community summaries (not chunks)
    var summaries = await _graphService.GetCommunitySummariesAsync();

    // 2. Map: Extract relevant themes from each summary
    var partialAnswers = await Task.WhenAll(
        summaries.Select(s => _llm.ExtractThemesAsync(query, s))
    );

    // 3. Reduce: Combine into final answer
    return await _llm.SynthesizeAsync(query, partialAnswers);
}

执行方法

将Greagrag添加到现有系统中有三种方式:

选项“1:Python侧面车” “(建议探索”“MS K2”

作为单独服务运行 微软\ 's GraphRAG@:

# docker-compose.graphrag.yml
services:
  graphrag:
    build:
      context: ./graphrag
    volumes:
      - ./data/input:/app/input
      - ./data/output:/app/output
    environment:
      - OPENAI_API_KEY=${OPENAI_API_KEY}

  graphrag-api:
    build:
      context: ./graphrag-api
    ports:
      - "8001:8000"
    depends_on:
      - graphrag
// GraphRagClient.cs - Call from ASP.NET Core
public class GraphRagClient
{
    private readonly HttpClient _http;

    public GraphRagClient(HttpClient http)
    {
        _http = http;
        _http.BaseAddress = new Uri("http://graphrag-api:8000");
    }

    public async Task<string> GlobalSearchAsync(string query)
    {
        var response = await _http.PostAsJsonAsync("/query/global", new { query });
        var result = await response.Content.ReadFromJsonAsync<GraphRagResponse>();
        return result.Answer;
    }

    public async Task<string> LocalSearchAsync(string query)
    {
        var response = await _http.PostAsJsonAsync("/query/local", new { query });
        var result = await response.Content.ReadFromJsonAsync<GraphRagResponse>();
        return result.Answer;
    }
}

Pros: 使用 微软 @ ' @ battle@ MS K1 @ 测试了实施@ MPK2} 快速到原型 : Python 依附性,LLM 索引费用MS K1 cross -p process通信

@2: @ @ .#NET 本地程序@(_ production 路 #)}

BERT-基提取和 Ollama 模式 DocSummamer 缩写器 在此相似的工作@. @

开采实体

要求 LLM 识别 事项 @-_结构化实体, 而不是免费@-}#:

public async Task<List<Entity>> ExtractEntitiesAsync(string chunk)
{
    var prompt = $"""
        Extract entities from this text. Return JSON array.
        Types: technology, concept, project, person, organization
        Text: {chunk}
        Format: [{{"name": "Docker", "type": "technology"}}]
        """;

    var response = await _ollama.GenerateAsync(prompt);
    return JsonSerializer.Deserialize<List<Entity>>(response);
}

生产要求: LLM JSON 产出 会 这是非可选的硬化@ . @ 您需要一个 MS K2}

  • Schema MSMK0-受限制的生成 万岁! format: json,OpenAI'%s 函数调用@)
  • 与-修复环重试{-} @ (_ 检测错误的 JSON,} 请LLM来修复它@){
  • 后退提取 普通实体类型的(regex模式@)

您的抽取管道不能是 .

关系采掘

一旦有实体 , 问LLM 他们如何连接:

public async Task<List<Relationship>> ExtractRelationshipsAsync(
    string chunk, List<Entity> entities)
{
    var names = string.Join(", ", entities.Select(e => e.Name));
    var prompt = $"""
        Given entities: {names}
        Extract relationships. Return JSON array.
        Text: {chunk}
        Format: [{{"source": "Docker", "target": "PostgreSQL", "rel": "runs"}}]
        """;

    return JsonSerializer.Deserialize<List<Relationship>>(
        await _ollama.GenerateAsync(prompt));
}

以实体正常化存储图表

最大的实际痛苦是 实体别名: MS K1ASP.NET CoreMPK3MS K4ASS.NTE}",和{"aspnetcore"应该是一样的节点 MSKO9简单正常化帮助:

public class KnowledgeGraph
{
    private readonly Dictionary<string, Entity> _entities = new();
    private readonly List<Relationship> _relationships = new();

    public void AddEntity(Entity entity)
    {
        var key = Normalise(entity.Name);  // "ASP.NET Core" → "aspnetcore"
        _entities[key] = entity;
    }

    private string Normalise(string name) =>
        name.ToLowerInvariant().Replace(".", "").Replace("-", "").Trim();
}

若两个实体名称的嵌入内容相似, @, 它们 @ 're 很可能是同一件事 @MS K5}

生产疼痛点 (GraphRAG'%s 值取决于图形质量@):

  • 同义词@/ @alias 表格: 维护金字塔名称和已知化名
  • 关系方案控制: 限制允许的前提以防止幻影关系类型
  • 信任评分 @ +_ prunning@: 并非所有被提取的关系都同样可靠
  • 递增重新-索引: 当文档更新时\ MS K1 您需要修补 photo@, 不重建它

图 Traversal

查找相关实体是宽度@- @ 第一次搜索@ :#

public List<Entity> GetNeighbors(string entityName, int depth = 1)
{
    var result = new HashSet<Entity>();
    var queue = new Queue<(string Name, int Depth)>();
    queue.Enqueue((Normalise(entityName), 0));

    while (queue.Count > 0)
    {
        var (name, d) = queue.Dequeue();
        if (d >= depth) continue;

        // Find all entities connected to this one
        var neighbours = _relationships
            .Where(r => Normalise(r.Source) == name || Normalise(r.Target) == name)
            .SelectMany(r => new[] { r.Source, r.Target });

        foreach (var neighbour in neighbours)
            if (_entities.TryGetValue(Normalise(neighbour), out var entity))
                if (result.Add(entity))
                    queue.Enqueue((Normalise(neighbour), d + 1));
    }
    return result.ToList();
}

社区探测

这是连接的- 元件基线MS K1 否 完全 Leiden.Leiden 优化模块性 {(} \ dense 内部连接}MS K2 稀疏的外部关系}). 正确实施 < ,}使用图表库或移植算法@.

public List<Community> DetectCommunities(KnowledgeGraph graph)
{
    // Connected components: group everything reachable together
    var visited = new HashSet<string>();
    var communities = new List<Community>();

    foreach (var entity in graph.GetAllEntities())
    {
        if (visited.Contains(entity.Name)) continue;
        
        // BFS to find all connected entities
        var community = new Community();
        var queue = new Queue<string>();
        queue.Enqueue(entity.Name);

        while (queue.Count > 0)
        {
            var name = queue.Dequeue();
            if (!visited.Add(name)) continue;
            community.Entities.Add(graph.GetEntity(name));
            foreach (var neighbor in graph.GetNeighbors(name, depth: 1))
                queue.Enqueue(neighbor.Name);
        }
        communities.Add(community);
    }
    return communities;
}

社区总结

每个社群都得到一个描述其主题的概要.}这就是GlobalSearch\ :的动力

public async Task<string> SummarizeCommunityAsync(Community community)
{
    var entities = string.Join("\n", 
        community.Entities.Select(e => $"- {e.Name}: {e.Description}"));
    
    var prompt = $"""
        Summarize what unites these concepts (2-3 sentences):
        {entities}
        """;

    return await _ollama.GenerateAsync(prompt);
}

选择“3:”混合 ( “Pragmatic middround Grounds”)

如果您已经有工作矢量搜索@ . @ 保持本地搜索Qdrant MS K1}\ 添加一个 Lightright 图层用于 Global @ /DRIFT 查询@ MPK3\ 推荐使用此方法。

查询分类

首先 , 检测出什么是问题

// WARNING: Toy heuristic for illustration only.
// In production, use a classifier prompt or few-shot rules and log misroutes.
private QueryMode ClassifyQuery(string query)
{
    var q = query.ToLowerInvariant();
    
    if (q.Contains("main theme") || q.Contains("summarize") || q.Contains("what topics"))
        return QueryMode.Global;
    
    if (q.Contains("relate") || q.Contains("connect") || q.Contains("compare"))
        return QueryMode.Drift;
    
    return QueryMode.Local;
}

本地搜索@( @ 增强% ) @

使用已有的矢量搜索@, 以图表上下文进行可选更新@MS K1

private async Task<string> LocalSearchAsync(string query)
{
    // Existing semantic search (what we have today)
    var chunks = await _semanticSearch.SearchAsync(query, limit: 10);

    // NEW: Enrich with related entities from graph
    var entities = await _graphService.ExtractEntitiesFromQueryAsync(query);
    var related = await _graphService.GetEntityContextAsync(entities);

    return await _llm.GenerateAsync(query, FormatContext(chunks, related));
}

全局搜索 @ ( @ 新能力@ MS K1

Mapçó- 省略社区摘要@(}没有矢量搜索需求 *):

private async Task<string> GlobalSearchAsync(string query)
{
    var summaries = await _graphService.GetAllCommunitySummariesAsync();

    // Map: Extract relevant info from each community
    var partials = await Task.WhenAll(
        summaries.Select(s => _llm.ExtractRelevantInfoAsync(query, s)));

    // Reduce: Combine into final answer
    return await _llm.SynthesizeAsync(query, partials.Where(p => !string.IsNullOrEmpty(p)));
}

DRIFT 搜索 @ ( @ 同步查询@ MS K1

@"#X 将本地结果与社区环境相结合,

private async Task<string> DriftSearchAsync(string query)
{
    var localResults = await LocalSearchAsync(query);
    
    var entities = await _graphService.ExtractEntitiesFromQueryAsync(query);
    var communities = await _graphService.GetCommunitiesForEntitiesAsync(entities);
    var themes = string.Join("\n", communities.Select(c => c.Summary));

    return await _llm.GenerateAsync(
        $"Question: {query}\n\nDetails:\n{localResults}\n\nBroader themes:\n{themes}",
        systemPrompt: "Synthesize the details with the thematic context.");
}

成本和绩效的考虑

与纯矢量RAG+.相比, GragRAG有很大的权衡取舍。

费用指数化

实体/ 相关采掘成本因模型,的快速设计(即时设计)和块大小(按粗略排序)而有很大差异 每块一两通LLM电话 加上较少次社区摘要呼吁

“ ”操作“ ”矢量RAG “图解”
嵌入 @ @ @ 1_ 呼叫@ MS K2 @ chunk @ I } 相同 @ MPK4 @
采掘活动的关系 电话:/chunk @
社区总结 -=YTET -伊甸园字幕组=- 翻译:

对于“1,000”博客文章的堆积, 包括“5”块、 “(5,000”块或类似的“)”块, 确切成本主要取决于您的模式选择和快速效率。

询问费用

查询类型 @ 矢量RAG _ 图示拉戈本地@ 图拉格 Global #
矢量搜索 @ @ 1_拨打# }(1_打电话)
横曲图 @ @ 0 @ @ I @ @ ]1-2}查询 @ @ *0# # MS K6#
LLM电话 @1 @ }1-2 ( N MS K5马普) *+ 1 NSK9雨~# ♪

Global search 比较昂贵, 但只要查询“ MSKK0 @ ” , 它会回答本地搜索仅能解答的问题。 您也可以缓存全局的答案, 并且只有在程序更改时才能刷新这些答案@ MS K3}

图图RAG 失败模式

圖表是't magic. 注意MS K2

  • 抽取错误MSSK0LMS 错过实体或幻觉关系
  • 实体别名: "ASP}.NET Core"vs @"ASS.NetMS K6v#"aspnetcoreMAST8成为单独的节点。
  • 图图漂移: 当文件更新@,时, 该图会变老
  • 社区摘要逐渐过时@ :_ 简讯@ MS K1_ t 自动@-} 当实体改变时更新@ info

实体正常化是最大的实际痛苦 您需要:吗

  • Canonical 名称@ + @ 化名
  • Case- 叠加和标点正常化
  • 可选嵌入-}基于实体重复

结合我们的博客搜索

GreagoraG如何提升博客「'」,

目前流动

User types in search → SemanticSearchService → Qdrant → Results

强化流动

分类路径查询不同的搜索策略@. @ Here @'_ 全局查询 注意它从不触碰矢量存储库 : *

sequenceDiagram
    participant U as User
    participant API as Search API
    participant C as Query Classifier
    participant G as Global Search
    participant KG as Knowledge Graph

    U->>API: "What topics does this blog cover?"
    API->>C: Classify query
    C-->>API: QueryMode.Global

    API->>G: GlobalSearch(query)
    G->>KG: GetCommunitySummaries()
    KG-->>G: [Frontend, Infrastructure, AI/ML]
    G->>G: MapReduce over summaries
    G-->>API: Synthesized answer

    API-->>U: "The blog covers three main areas..."

比较此比 本地查询将矢量搜索与更丰富解答的图表上下文相结合的 ,@:

sequenceDiagram
    participant U as User
    participant API as Search API
    participant C as Query Classifier
    participant L as Local Search
    participant Q as Qdrant
    participant KG as Knowledge Graph

    U->>API: "How do I use HTMX?"
    API->>C: Classify query
    C-->>API: QueryMode.Local

    API->>L: LocalSearch(query)
    L->>Q: Vector search
    Q-->>L: Relevant chunks
    L->>KG: GetEntityContext("HTMX")
    KG-->>L: Related: Alpine.js, Tailwind, ASP.NET
    L-->>API: Answer with rich context

    API-->>U: "HTMX is used with Alpine.js for..."

关键差异@:全球查询汇总社区摘要 @(corpus-级别主题 @MS K3而本地查询取回实体关系丰富的具体块*.

更简单的选择@: @% GragRAG仍在很大程度上是一种研究工具,即“-”实体提取,图形构造MS K2 社区探测增加了相当的复杂性和LLM成本}.对于大多数使用的案例来说 =, BERT 嵌入关键字匹配 更好的工作,更好. 这就是 源码@' @%s Cody 用于代码情报@,}和什么用途 DocSummamer 缩写器 用于文档摘要的用途@. @% 此图案@ :}混合检索处理关联 *;}LLM hands 组装# , # 不是# 决定的作出“. ” 你得到“80% ”的收益,与“MS K2 ” 复杂的“MSC3 ”

执行差距

API 是直截了当的: 分类查询{, 路线到合适的处理器}MS K2

[HttpGet("api/search")]
public async Task<IActionResult> Search([FromQuery] string q, [FromQuery] string mode = "auto")
{
    if (mode == "auto")
        mode = ClassifyQuery(q);

    // global/local return synthesised answers; default returns raw search results
    return mode switch
    {
        "global" => Ok(await _graphRag.GlobalSearchAsync(q)),  // synthesised answer
        "local" => Ok(await SearchWithGraphContext(q)),        // answer with citations
        _ => Ok(await _semanticSearch.SearchAsync(q))          // raw ranked results
    };
}

矢量搜索和图形搜索补充@. @ 使用矢量查找 @ " @ 询问: I" @ 质询 @ I,}% K4_ 什么是主题 @ MPK5 @ question@ . @

结论结论

图形区域组将 RAG 从 @ " @ finded 类似块@ MS K1} 延伸至 @ I" 了解知识结构 * ."} It_ MSSK4}* 不是矢量搜索的替代品 *\ ;} it'}这是允许新查询类型

“Greagra”添加了什么?

  • 实体和关系提取
  • 知识图构建
  • 社区探测和等级摘要
  • 全球寻找感知问题
  • DRIFT 搜索连接推理

何时使用@ : @

  • 您有大量的文档收藏
  • 用户询问“ "” 什么是主题? “ MS K1” 类型问题
  • 你的内容有明确的实体和关系
  • 您想要自动表面连接

执行路径@: @%

  1. 第一次, 询问“ :” 您是否真的需要这个 “ MS K2” BERT @ +BMQ25混合检索处理最常用的个案
  2. 如果有, @ , @% 原型带有 Python 侧边车以验证值
  3. 如果成本高的话, 建立“ .” 本地 NET@ MS K1 @ latency matter
  4. 使用本地LLMs @(_Ollama)}控制索引编制成本

资源资源资源 资源和资源资源资源

图表官方@: @%

RAG系列 :

简单易行选项@(_BERT @+_BARBAR_25):}

Finding related posts...
logo

© 2026 Scott Galloway — Unlicense — All content and source code on this site is free to use, copy, modify, and sell.