GLM-4-Long context supports 1M, why is dify set to 4096? #6360

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

Originally created by @jaxonister on GitHub (Oct 26, 2024).

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

0.10.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

image

✔️ Expected Behavior

context supports 1M

Actual Behavior

context 4096

Originally created by @jaxonister on GitHub (Oct 26, 2024). ### 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 0.10.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce <img width="1181" alt="image" src="https://github.com/user-attachments/assets/b7eec16a-391a-4c79-9f57-0339d2e314f7"> ### ✔️ Expected Behavior context supports 1M ### ❌ Actual Behavior context 4096
yindo added the 🙋‍♂️ question label 2026-02-21 18:15:24 -05:00
yindo closed this issue 2026-02-21 18:15:24 -05:00
Author
Owner

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

The context size in Dify is set to 4096 for certain models due to specific limitations or configurations. However, the Dify documentation mentions that for the gpt-3.5-turbo model, there is a token limit of 4097 tokens, which might be a reason for setting the context size to 4096 to avoid errors [1].

If you are using a model like GLM-4-Long that supports a larger context size, you might need to adjust the configuration files or settings to utilize the full context size supported by the model. The context size for models in Dify can be configured in files such as rerank-1.yaml and rerank-2.yaml, where context sizes are set to 8000 and 16000 respectively [2][3]. You may need to check these configurations or similar ones for your specific model setup.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 26, 2024): <!-- Answer --> The context size in Dify is set to 4096 for certain models due to specific limitations or configurations. However, the Dify documentation mentions that for the gpt-3.5-turbo model, there is a token limit of 4097 tokens, which might be a reason for setting the context size to 4096 to avoid errors <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/learn-more/faq/use-llms-faq.md)</sup>. If you are using a model like GLM-4-Long that supports a larger context size, you might need to adjust the configuration files or settings to utilize the full context size supported by the model. The context size for models in Dify can be configured in files such as `rerank-1.yaml` and `rerank-2.yaml`, where context sizes are set to 8000 and 16000 respectively <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/voyage/rerank/rerank-1.yaml)</sup><sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/voyage/rerank/rerank-2.yaml)</sup>. You may need to check these configurations or similar ones for your specific model setup. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@ox01024 commented on GitHub (Oct 26, 2024):

image In fact, it is 1M. Have you encountered any problems in using it? Do you have any evidence?
@ox01024 commented on GitHub (Oct 26, 2024): <img width="983" alt="image" src="https://github.com/user-attachments/assets/409c5bd4-c8bb-4c22-a4c0-2fdc1575bd41"> In fact, it is 1M. Have you encountered any problems in using it? Do you have any evidence?
Author
Owner

@crazywoola commented on GitHub (Oct 26, 2024):

Because the context is different from the output tokens you thought.

@crazywoola commented on GitHub (Oct 26, 2024): Because the `context` is different from the `output tokens` you thought.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6360