Skip to content

LLM-generated community summaries for LightRAG high-level retrieval #4

Description

@ronaldmannak

Motivation

LightRAG's high-level (community) store is only as good as its summaries. Today LightRAG.communitySummary produces a thin, deterministic string — member entity names plus the relationship types connecting them. The real GraphRAG/LightRAG "global" technique summarizes each community with an LLM, which makes theme/global questions much stronger.

Scope

  • Add an LLM-backed community summarizer that, given a Community + KnowledgeGraph, produces a natural-language summary of the members, their relationships, and evidence.
  • Add the prompt to Prompts (mirroring the existing prompt style).
  • Keep the current entity/relationship string as the deterministic offline fallback when no LLM is available (so offline behavior and tests stay deterministic).
  • Wire it into LightRAG.communitySearcher (the community documents are what gets embedded/searched).

Files (parallel-safe)

Sources/GraphRAG/LightRAG/Searchers.swift (+ maybe a new CommunitySummarizer.swift), Sources/GraphRAG/Entity/Prompts.swift. Minimal overlap with other issues; if it needs a config flag, coordinate with the "Builder ergonomics" issue.

Acceptance criteria

  • With an LLM available, community documents contain LLM-generated summaries; without one, the existing deterministic summary is used unchanged.
  • New unit test for the offline fallback path; the end-to-end offline test still passes.
  • CI green.

Context: follow-up to LightRAG (PR #2) / config inheritance (PR #3).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions