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

Aperta
#2,606 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 5 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data, performance

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
36.6k
Fork
3.9k
Merge medio
4g 11h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/graphrag

Tutte le issue di microsoft/graphrag

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.