Knowledge Retrieval Token Limit Clarification #6006

Closed
opened 2026-02-21 18:13:38 -05:00 by yindo · 3 comments
Owner

Originally created by @NourKhdour on GitHub (Oct 10, 2024).

Originally assigned to: @Yawen-1010, @AllenWriter on GitHub.

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Provide a description of requested docs changes

I would like clarification and additional documentation regarding the maximum token length for Knowledge Retrieval queries, Is it the same as Retrieval Testing up to 200 characters or it follows the same constraints as the model’s token limit?

Questions:
Is it better to pass a long document as one chunk or split it into smaller pieces for more effective retrieval?
If splitting is required, what is the optimal chunk size (in tokens or characters) for accurate and complete retrieval?

Originally created by @NourKhdour on GitHub (Oct 10, 2024). Originally assigned to: @Yawen-1010, @AllenWriter on GitHub. ### Self Checks - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Provide a description of requested docs changes I would like clarification and additional documentation regarding the maximum token length for Knowledge Retrieval queries, Is it the same as Retrieval Testing up to 200 characters or it follows the same constraints as the model’s token limit? **Questions:** Is it better to pass a long document as one chunk or split it into smaller pieces for more effective retrieval? If splitting is required, what is the optimal chunk size (in tokens or characters) for accurate and complete retrieval?
yindo added the 📚 documentation label 2026-02-21 18:13:38 -05:00
yindo closed this issue 2026-02-21 18:13:38 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 10, 2024):

The maximum token length for Knowledge Retrieval queries in Dify isn't specified in the available information. However, for document splitting, it's recommended to split long documents into chunks with a maximum of 4000 tokens per segment. A chunk overlap of about 200 tokens is also suggested for better retrieval accuracy [1].

Splitting documents into smaller pieces is generally more effective for retrieval, as it ensures that each segment fits within the model's context window and improves semantic matching.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 10, 2024): <!-- Answer --> The maximum token length for Knowledge Retrieval queries in Dify isn't specified in the available information. However, for document splitting, it's recommended to split long documents into chunks with a maximum of 4000 tokens per segment. A chunk overlap of about 200 tokens is also suggested for better retrieval accuracy <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/create-knowledge-and-upload-documents.md)</sup>. Splitting documents into smaller pieces is generally more effective for retrieval, as it ensures that each segment fits within the model's context window and improves semantic matching. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@Yawen-1010 commented on GitHub (Oct 11, 2024):

The maximum length for Knowledge Retrieval queries is the same as Retrieval Testing up to 200 characters. We will specify it in our product document. Thanks for raising this question. @NourKhdour

@Yawen-1010 commented on GitHub (Oct 11, 2024): The maximum length for Knowledge Retrieval queries is the same as Retrieval Testing up to 200 characters. We will specify it in our product document. Thanks for raising this question. @NourKhdour
Author
Owner

@Yawen-1010 commented on GitHub (Oct 12, 2024):

Document has been updated.
https://docs.dify.ai/guides/workflow/node/knowledge-retrieval

@Yawen-1010 commented on GitHub (Oct 12, 2024): Document has been updated. https://docs.dify.ai/guides/workflow/node/knowledge-retrieval
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6006