Skip to content

Skip knowledge graph extraction in RAG pipeline to fix large file ingestion stalls #591

Closed

Description

@larryro

Problem / Goal

When processing large files, the RAG service frequently stalls at the cognee.cognify() step, which performs LLM-based knowledge graph extraction (entity/relationship extraction per chunk). This is the most expensive step in the ingestion pipeline.

However, no consumer actually uses knowledge graph search:

  • query_rag_context.ts calls /api/v1/search without specifying search_type → defaults to SearchType.CHUNKS
  • rag_search_tool.ts calls /api/v1/generate → internally uses CHUNKS search

The graph database (FalkorDB) is being populated but never queried. Only vector similarity on text chunks is used.

Context

Current Pipeline (cognee.cognify() runs all 5 steps)

  1. classify_documents - Document type identification
  2. extract_chunks_from_documents - Text chunking
  3. extract_graph_from_data - Knowledge graph extraction via LLM (bottleneck)
  4. summarize_text - Hierarchical summaries
  5. add_data_points - Vector/node storage

Proposed Pipeline (skip steps 3 & 4)

Cognee 0.5.1 supports run_custom_pipeline() which allows composing only the needed tasks. Replace cognee.cognify() with a custom pipeline that only runs: classify → chunk → store.

Key Files

  • services/rag/app/services/cognee/service.py (lines 728-770) - cognee.cognify() call to replace
  • services/platform/convex/agent_tools/rag/query_rag_context.ts - Consumer (CHUNKS only)
  • services/platform/convex/agent_tools/rag/rag_search_tool.ts - Consumer (CHUNKS only)

Trade-offs

  • Graph-based search types (GRAPH_COMPLETION, GRAPH_SUMMARY_COMPLETION, etc.) will not work until re-enabled
  • FalkorDB infrastructure stays intact for potential future use

Acceptance Criteria

  • Replace cognee.cognify() with run_custom_pipeline() using only classify + chunk + store tasks
  • Large file ingestion no longer stalls at knowledge graph extraction
  • Documents are chunked and embedded correctly
  • CHUNKS search continues to work via cognee.search()
  • /api/v1/generate endpoint continues to work
  • Remove graph_extraction_prompt / custom_prompt config usage (no longer needed)
  • Keep FalkorDB infrastructure intact for potential future re-enablement
  • Add configuration flag (e.g. ENABLE_GRAPH_EXTRACTION=false) to optionally re-enable full pipeline later

🤖 Generated with Claude Code

Activity

  1. added
    perf
    priority: high
    service: rag
    on Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    perfpriority: highservice: rag

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions