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
| Strategy | How it works | Best for |
|---|
| Smart Chunking (default) | Detects chapter and paragraph boundaries from the document layout. | Most documents. |
| Fixed-length Chunking | Splits at equal token lengths. | Plain text with simple formatting. |
| Heading-based Chunking | Splits along Markdown / HTML heading levels. | Well-structured documents. |
Chunking parameters
| Parameter | Default | Range | Notes |
|---|
chunk_size | 1024 | 256–4096 | Maximum length of a single Chunk. |
chunk_overlap | 10% | 0%–50% | Overlap between adjacent Chunks to preserve context. |
split_by | Smart | Smart / paragraph / sentence | Splitting granularity. |
Recommended settings
| Scenario | Recommended | Why |
|---|
| FAQ documents | Fixed-length 256, 0% overlap | Q&A pairs are short and self-contained. |
| Product manuals | Smart Chunking, 1024 tokens, 10% overlap | Chapters are clearly structured. |
| Long reports | Smart Chunking, 2048 tokens, 15% overlap | Preserves more context. |
| Legal contracts | Heading-based Chunking, 512 tokens | Clauses are hierarchically organized. |
Debugging Chunks
From the Knowledge Base detail page you can preview the Chunk list:
- View each Chunk's content and length.
- Edit a Chunk's content manually — edited Chunks are re-embedded automatically.
- 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
| Model | Dimensions | Max input | Language | Notes |
|---|
| General Embedding (default) | 1024 | 8192 tokens | Chinese and English | Works for most cases. |
| text-embedding-v3 | 1024 | 8192 tokens | Multilingual | Recommended 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: