Maximum chunk length setting can' t control the size of the chunk #12057

Closed
opened 2026-02-21 19:05:32 -05:00 by yindo · 1 comment
Owner

Originally created by @LLY-GitHub on GitHub (Mar 24, 2025).

Self Checks

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

Dify version

latest

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Set the Maximum chunk length parameter to default value.
  2. Upload a document for segmentation.
  3. Preview the generated chunks.

Image

✔️ Expected Behavior

The resulting document chunks should respect the specified maximum chunk size and not exceed the set limit.

Actual Behavior

The generated chunks are larger than the specified maximum chunk size.

Originally created by @LLY-GitHub on GitHub (Mar 24, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [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 this 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. ### Dify version latest ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1. Set the _Maximum chunk length_ parameter to default value. 2. Upload a document for segmentation. 3. Preview the generated chunks. ![Image](https://github.com/user-attachments/assets/ab515077-d8e3-4c89-861e-15d2fb74234b) ### ✔️ Expected Behavior The resulting document chunks should respect the specified maximum chunk size and not exceed the set limit. ### ❌ Actual Behavior The generated chunks are larger than the specified maximum chunk size.
yindo added the 🐞 bug label 2026-02-21 19:05:32 -05:00
yindo closed this issue 2026-02-21 19:05:32 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 24, 2025):

@LLY-GitHub Hello there! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're facing.

The "Maximum chunk length" setting specifies the maximum number of text characters allowed per chunk, but it doesn't directly control the size of the generated chunks. This is because the system uses delimiters to split the text into paragraphs, which are treated as parent chunks. The chunking occurs based on these delimiters, and the maximum chunk length is enforced only if the text within a paragraph exceeds this limit. Therefore, the size of the generated chunks is primarily determined by the delimiters, and the maximum chunk length acts as a secondary constraint [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 24, 2025): <!-- Greeting --> @LLY-GitHub Hello there! I'm here to help you with any bugs, questions, or contributions. Let's work together to solve the issue you're facing. <!-- Answer --> The "Maximum chunk length" setting specifies the maximum number of text characters allowed per chunk, but it doesn't directly control the size of the generated chunks. This is because the system uses delimiters to split the text into paragraphs, which are treated as parent chunks. The chunking occurs based on these delimiters, and the maximum chunk length is enforced only if the text within a paragraph exceeds this limit. Therefore, the size of the generated chunks is primarily determined by the delimiters, and the maximum chunk length acts as a secondary constraint <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/guides/knowledge-base/create-knowledge-and-upload-documents/chunking-and-cleaning-text.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/1cf50fca-2d7e-4009-81d5-898f36e70cd3?feedback_type=other)</sup>
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12057