Skip to main content

Chunking and Embedding

Pick a Chunking Strategy and an embedding model to balance recall and precision.

Chunking and embedding are the two stages of the RAG pipeline that most affect retrieval quality. Chunking sets the minimum retrieval unit; embedding sets the precision of semantic matching.

Chunking strategies

StrategyHow it worksBest for
Smart Chunking (default)Detects chapter and paragraph boundaries from the document layout.Most documents.
Fixed-length ChunkingSplits at equal token lengths.Plain text with simple formatting.
Heading-based ChunkingSplits along Markdown / HTML heading levels.Well-structured documents.

Chunking parameters

ParameterDefaultRangeNotes
chunk_size1024256–4096Maximum length of a single Chunk.
chunk_overlap10%0%–50%Overlap between adjacent Chunks to preserve context.
split_bySmartSmart / paragraph / sentenceSplitting granularity.
ScenarioRecommendedWhy
FAQ documentsFixed-length 256, 0% overlapQ&A pairs are short and self-contained.
Product manualsSmart Chunking, 1024 tokens, 10% overlapChapters are clearly structured.
Long reportsSmart Chunking, 2048 tokens, 15% overlapPreserves more context.
Legal contractsHeading-based Chunking, 512 tokensClauses are hierarchically organized.

Debugging Chunks

From the Knowledge Base detail page you can preview the Chunk list:
  1. View each Chunk's content and length.
  2. Edit a Chunk's content manually — edited Chunks are re-embedded automatically.
  3. If chunk quality is off, change the parameters in Knowledge Base settings and click Rebuild Index.
While rebuilding, retrieval continues against the existing index and switches over once the rebuild finishes. Rebuild time scales with total document volume.

Embedding

After chunking, the platform uses an embedding model to turn each Chunk into a vector and writes them to the Index.

Built-in embedding models

ModelDimensionsMax inputLanguageNotes
General Embedding (default)10248192 tokensChinese and EnglishWorks for most cases.
text-embedding-v310248192 tokensMultilingualRecommended for multilingual content.

Hybrid retrieval

With hybrid retrieval enabled, the platform runs semantic matching and keyword matching in parallel and merges the results. Semantic matching understands paraphrases; keyword matching nails entity names and proper nouns.
Switching the embedding model triggers a full index rebuild — different models may produce different vector dimensions.

API management

Chunk APIs:
With chunking and embedding configured, create a Knowledge Search service to start Multi-index Retrieval.