DifyChunkingRAGKnowledge Base

Keep instructions and exceptions together with Dify parent-child chunks

Dify matches small child chunks and returns their parent context. Learn how to preserve exceptions, choose parent boundaries and verify edits without assuming bigger is better.

Keep instructions and exceptions together with Dify parent-child chunks

A search result saying “hold reset for three seconds” can be dangerous if the omitted sentence says “only while the indicator is green.” Dify parent-child chunking separates the unit used to find evidence from the larger unit returned as context. It helps only when that parent contains the relevant instruction and its conditions.

What does parent-child retrieval return?

The Dify chunking guide says General mode returns matched chunks directly. Parent-child mode matches smaller child chunks and returns their entire parent. It requires High Quality indexing. This is a retrieval structure, not a guarantee that document boundaries are understood correctly.

Use this fictional manual in a temporary knowledge base, not as real maintenance guidance:

Demo manual demo-maintenance-v1, section 3: Reset
Only reset while the indicator is green and the device is idle.
Hold reset for three seconds, then wait for restart.
When the indicator is red, do not perform that reset. Contact maintenance.

Ask whether resetting is allowed with a red light. The evidence must preserve the exception. General chunking can also work if it already keeps this whole section together; changing the mode is unnecessary when the existing boundaries do the job.

Child chunks point to one parent that contains the procedure, precondition and exception

How large should a parent be?

Choose the smallest section that can explain a rule independently, then consider length. An instruction may need its heading, target device, prerequisites and exception. Returning the whole book can introduce unrelated or contradictory procedures.

Dify offers Paragraph parents, split by delimiter and maximum length, and Full Doc parents. Current documentation limits Full Doc processing to the first 10,000 tokens; later content is truncated. A Full Doc parent cannot be edited after creation: changes require a new upload. It should not be presented as an unlimited full-document mode.

The normal maximum chunk length is documented in characters, while this Full Doc limit uses tokens. They are different units. A maximum length can also force a split even when a section delimiter was chosen.

Too little context drops conditions; too much mixes procedures; a coherent section keeps the rule

Delimiters are removed during splitting. Avoid a delimiter that carries business meaning. Preview displays a limited sample, so inspect actual imported chunks as well. For PDFs, first verify extraction and the citation chain so missing text is not blamed on retrieval.

Does editing a child update its parent?

No. The content maintenance guide says a parent edit can regenerate child chunks or retain them. Editing a child does not update its parent.

A child may therefore serve as a retrieval hint such as “Can I reset with a red light?” The parent still needs the authoritative answer. Updating only the child can make a new phrase retrieve an old procedure. Do not store the only copy of a changed rule in a child hint.

Parent edits require a child regeneration decision; child edits do not rewrite the parent

Update the factual parent first and check whether its children still describe it. Review generated summaries too: Dify documents that summaries are embedded and indexed. A text edit alone is not evidence that every retrieval hint has been refreshed.

What should a local acceptance check inspect?

Prepare three questions before importing: how to reset with a green light, whether reset is allowed with a red light, and what to do with an undocumented blue light. Inspect the matching child, returned parent and actual LLM Context separately.

The Knowledge Retrieval node returns a result array. The documented integration selects it in the LLM node's Context and references Context in the instruction. Preserve the source information rather than reducing the result to the single imperative sentence. A complete parent still needs a final answer check for conditions and unsupported claims.

For conflicting editions, continue with metadata version filtering. For selecting among retrieved parents, see reranking and source mapping. Model connectivity is covered by the Embeddings API.

Sources were checked on November 21, 2026. The sample is a proposed acceptance fixture, not a deployed Dify test or measured improvement. Chunking mode cannot be changed after knowledge-base creation, so compare structures in a temporary base or copy before replacing an existing setup.

Related posts

Run your Agent workflow through Nbility

Get an API key and connect OpenAI-compatible models and developer tools from one place.

Get an API key