3.1.5 图社区 → 社区摘要
7 / 8The next step creates report-like summaries of each community in the community hierarchy, using a method designed to scale to very large datasets. These summaries are independently useful as a way to understand the global structure and semantics of the dataset, and may themselves be used to make sense of a corpus in the absence of a specific query. For example, a user may scan through community summaries at one level looking for general themes of interest, then read linked reports at a lower level that provide additional details for each subtopic. Here, however, we focus on their utility as part of a graph-based index used for answering global queries.
下一步为社区层次结构中的每个社区生成类似报告的摘要,所用方法旨在扩展到很大的数据集。这些摘要本身就有助于理解数据集的整体结构与语义,即使没有特定查询,也可以用来理解语料。例如,用户可以浏览某一层的社区摘要,寻找感兴趣的总体主题,再阅读链接到较低层的报告,了解各子主题的更多细节。不过,本文关注的是它们作为图索引的一部分,在回答全局查询时的用途。
GraphRAG generates community summaries by adding various element summaries (for nodes, edges, and related claims) to a community summary template. Community summaries from lower-level communities are used to generate summaries for higher-level communities as follows:
GraphRAG 将节点、边及相关断言等元素的摘要加入社区摘要模板,从而生成社区摘要。利用较低层社区的摘要生成较高层社区摘要的方法如下:
Leaf-level communities . The element summaries of a leaf-level community are prioritized and then iteratively added to the LLM context window until the token limit is reached. The prioritization is as follows: for each community edge in decreasing order of combined source and target node degree (i.e., overall prominence), add descriptions of the source node, target node, the edge itself, and related claims.
叶级社区:先为叶级社区的元素摘要确定优先次序,再逐步加入大语言模型的上下文窗口,直到达到 token 限额。具体顺序是:按照每条社区边的源节点与目标节点度数之和从高到低排列,即按整体显著程度排列,依次加入源节点、目标节点、边本身以及相关断言的描述。
Higher-level communities . If all element summaries fit within the token limit of the context window, proceed as for leaf-level communities and summarize all element summaries within the community. Otherwise, rank sub-communities in decreasing order of element summary tokens and iteratively substitute sub-community summaries (shorter) for their associated element summaries (longer) until they fit within the context window.
较高层社区:如果所有元素摘要都能放入上下文窗口的 token 限额,就按叶级社区的方法,对社区内全部元素摘要进行汇总。否则,按元素摘要的 token 数量从高到低排列子社区,并逐步用较短的子社区摘要替换与其关联的较长元素摘要,直到内容能够放入上下文窗口。
本节正文与示例对照,图表及其他章节请查阅原文。译文尚未经人工专业审校。
一条出现很少却影响合规结论的事实,怎样避免在摘要里消失?
划选正文也可以保存重点。笔记默认仅自己可见,确认公开后才进入共学社区。
分层摘要能缩减上下文,但也有信息取舍。连接显著不等于业务重要;最终结论需要能够回查原始证据。