What chunking strategies does GraphRAG support?
- User
What chunking strategies does GraphRAG support?
Assistant
GraphRAG supports two primary chunking strategies for text processing:
-
Tokens-based Chunking
- Strategy Name:
tokens - Implementation: Located in
./repos/graphrag/graphrag/index/operations/chunk_text/strategies.pyasrun_tokens. - Description: This strategy uses the
tiktokenlibrary to chunk text based on encoding tokens. It allows specifying:size: The number of tokens per chunk (default: 1200).overlap: The number of tokens to overlap between chunks (default: 100).encoding_model: The encoding model to use (e.g.,gpt-3.5-turbo).
- Example Configuration:
[Redacted
strategy: tokens size: 1200 overlap: 100 encoding_model: gpt-3.5-turbo
- Strategy Name:
-
Sentence-based Chunking
- Strategy Name:
sentence - Implementation: Located in
./repos/graphrag/graphrag/index/operations/chunk_text/strategies.pyasrun_sentences. - Description: This strategy uses the
nltklibrary to chunk text into sentences. It does not require additional configuration parameters. - Example Configuration:
[Redacted
strategy: sentence
- Strategy Name:
These strategies are defined in the
ChunkStrategyTypeenumeration in./repos/graphrag/graphrag/config/models/chunking_config.pyand can be selected when configuring the chunking process in GraphRAG.Summary:
- Tokens-based Chunking: Chunks text based on token count with configurable size and overlap.
- Sentence-based Chunking: Splits text into individual sentences.
You can choose the appropriate strategy based on your specific text processing needs.
-
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.