Max token of qwen long error #5487

Closed
opened 2026-02-21 18:11:12 -05:00 by yindo · 1 comment
Owner

Originally created by @deific on GitHub (Sep 9, 2024).

Originally assigned to: @crazywoola on GitHub.

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.7.3

Cloud or Self Hosted

Cloud, Self Hosted (Docker), Self Hosted (Source)

Steps to reproduce

The maximum token of qwen-long model is incorrect. The official documentation shows that the maximum output token is 6000, while the dify configuration is 2000
The official documentation:https://help.aliyun.com/zh/model-studio/developer-reference/qwen-long-api?spm=a2c4g.11186623.0.0.34dd23c0zWFWAZ

✔️ Expected Behavior

The maximum token of qwen-long is 6000.
image

Actual Behavior

The maximum token of qwen-long is 2000.
image

Originally created by @deific on GitHub (Sep 9, 2024). Originally assigned to: @crazywoola on GitHub. ### 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.7.3 ### Cloud or Self Hosted Cloud, Self Hosted (Docker), Self Hosted (Source) ### Steps to reproduce The maximum token of qwen-long model is incorrect. The official documentation shows that the maximum output token is 6000, while the dify configuration is 2000 The official documentation:https://help.aliyun.com/zh/model-studio/developer-reference/qwen-long-api?spm=a2c4g.11186623.0.0.34dd23c0zWFWAZ ### ✔️ Expected Behavior The maximum token of qwen-long is 6000. ![image](https://github.com/user-attachments/assets/b6e0e904-e33f-4953-ab39-62c5996980a7) ### ❌ Actual Behavior The maximum token of qwen-long is 2000. ![image](https://github.com/user-attachments/assets/d40e699f-78b0-4b9a-b3d9-50e0c0a2cd30)
yindo added the 🐞 bug label 2026-02-21 18:11:12 -05:00
yindo closed this issue 2026-02-21 18:11:12 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 9, 2024):

I found a similar unsolved discussion regarding the maximum token limits for the Qwen-Long model in Dify. You can check it out here: Max Token Limits Incorrect? [1].

The discrepancy arises because the max_tokens parameter in the Dify configuration file api/core/model_runtime/model_providers/tongyi/llm/qwen-long.yaml is set to a maximum value of 2000:

- name: max_tokens
  use_template: max_tokens
  type: int
  default: 2000
  min: 1
  max: 2000
  help:
    en_US: It is used to specify the maximum number of tokens when the model generates content. It defines the upper limit of generation, but does not guarantee that this number will be generated every time.

This configuration sets the upper limit for the number of tokens to 2000, which is why it differs from the official documentation stating it should be 6000 [2].

There are known issues or limitations in Dify that could prevent the max_tokens parameter from being set to 6000. Specifically, the documentation mentions that longer text outputs usually require more computation time and resources. Limiting the length of the output text can reduce computational cost and time, ensuring that the output text length does not exceed the LLM's acceptable range and optimizing computational resources [3][4][5].

Changing the max_tokens parameter in the qwen-long.yaml file will impact existing deployments and workflows by altering the maximum number of tokens the model can generate in a single response. Increasing the max_tokens value will allow the model to generate longer responses, while decreasing it will limit the length of the responses [6][5].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 9, 2024): <!-- Answer --> I found a similar unsolved discussion regarding the maximum token limits for the Qwen-Long model in Dify. You can check it out here: [Max Token Limits Incorrect?](https://github.com/langgenius/dify/discussions/7243) <sup>[[1]](https://github.com/langgenius/dify/discussions/7243)</sup>. The discrepancy arises because the `max_tokens` parameter in the Dify configuration file `api/core/model_runtime/model_providers/tongyi/llm/qwen-long.yaml` is set to a maximum value of 2000: ```yaml - name: max_tokens use_template: max_tokens type: int default: 2000 min: 1 max: 2000 help: en_US: It is used to specify the maximum number of tokens when the model generates content. It defines the upper limit of generation, but does not guarantee that this number will be generated every time. ``` This configuration sets the upper limit for the number of tokens to 2000, which is why it differs from the official documentation stating it should be 6000 <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/tongyi/llm/qwen-long.yaml)</sup>. There are known issues or limitations in Dify that could prevent the `max_tokens` parameter from being set to 6000. Specifically, the documentation mentions that longer text outputs usually require more computation time and resources. Limiting the length of the output text can reduce computational cost and time, ensuring that the output text length does not exceed the LLM's acceptable range and optimizing computational resources <sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/jp/learn-more/faq/llms-use-faq.md)</sup><sup>[[4]](https://github.com/langgenius/dify-docs/blob/main/en/learn-more/faq/use-llms-faq.md)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-orchestrate/llms-use-faq.md)</sup>. Changing the `max_tokens` parameter in the `qwen-long.yaml` file will impact existing deployments and workflows by altering the maximum number of tokens the model can generate in a single response. Increasing the `max_tokens` value will allow the model to generate longer responses, while decreasing it will limit the length of the responses <sup>[[6]](https://github.com/langgenius/dify/blob/main/api/core/model_runtime/model_providers/tongyi/llm/qwen-max-longcontext.yaml)</sup><sup>[[5]](https://github.com/langgenius/dify-docs/blob/main/en/guides/application-orchestrate/llms-use-faq.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5487