Community report context building re-renders and re-tokenizes the whole context after every edge

未关闭
#2,606 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 5 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
data, performance

调研方向

Read summarize_communities/graph_context/sort_context.py and trace how build_mixed_context calls sort_context without a token limit. Use the tests/verbs/data fixture to compare build_local_context runtime and output; done means avoiding the repeated per-edge work while preserving byte-identical output. The issue author says a PR is ready, so check with them before starting.

由索引模型根据 Issue 内容生成。

描述

sort_context in the graph context builder for community reports (summarize_communities/graph_context/sort_context.py) adds edges one at a time and, after each edge, rebuilds the entity, claim and relationship DataFrames, renders them with to_csv and tokenizes the whole context again. That's quadratic in the number of edges per community, and it also runs when no token limit is passed (how build_mixed_context calls it), where the per-edge work is thrown away.

On the tests/verbs/data fixture build_local_context takes 0.91 s, and on a synthetic 10k-entity graph 12.5 s. Recording the prefix sizes once and searching for the first edge that exceeds the limit gives 0.14 s and 2.85 s with byte-identical output. I have a PR ready if that's welcome.

主要语言
Python
星标
36.6k
派生
3.9k
平均合并
4 天 11 小时
30 天内合并 PR
1

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/graphrag 的其他 Issue

查看 microsoft/graphrag 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。