Skip to content

[Feature] Model response timeout settings #5756

Closed

Description

@tehtelev

Hello. I have a suggestion regarding the time limits for prompt processing and model response generation – is it possible to make them configurable?
On my configuration with the LLM models I need, there's partial loading between the GPU and CPU, resulting in significantly lower performance (up to 20 tokens per generation). With large prompts, the model disconnects (after a few minutes with a timeout error), even though the models definitely work in other programs.
The same applies to large contexts – generation simply stops after 10 minutes and that's it (as in the screenshot).
I'm very happy with Unsloth Studio's generation time and memory usage. But because of these limitations, I have to use other programs.

Image

Activity

  1. added
    feature request
    on May 24, 2026
  2. Imagineer99 commented on May 25, 2026

    @Imagineer99
    Member

    seems valid, we should likely extend timeout on long generations, will investigate

  3. Mr-Havoc999 commented on May 28, 2026

    @Mr-Havoc999

    hey, i have a similar type of issue where a large model takes significant amount of time (5 or 10 mins) before outputting its first token so the studio directly outputs what is shown in image, but i can definitely see my gpu and cpu peaking out there and i can confirm it is still processing, can you add a timeout configuration for model responses in settings

    Image
  4. ughoo commented on Jun 6, 2026

    @ughoo

    I have this issue with multiple windows pc's running Unsloth Studio. All request that is longer than 600s, 99% stops in the middle of the response.

    Image

    Is there any option, to let it work for longer time?

    I already tried LLAMA_ARG_TIMEOUT with powershell enviroment setup, and custom batch file too. IT's crucial for me.

  5. anthrwpos1 commented on Jun 9, 2026

    @anthrwpos1

    I faced with same issue and here is a workaround/hack that helped me.

    • Go to the Unsloth Studio installed directory (in my Windows it is C:\Users<username>.unsloth)
    • Find the next python file .unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\routes\inference.py
    • in that file replace all timeout = 600 with longer timeout.
    • restart the Unsloth Studio.
    • If want, to ensure the new code in script is actually work, you can add some log: after logger = get_logger(__name__) line add something like logger.error('hacked version used'). You will see that message on studio startup.
  6. ughoo commented on Jun 9, 2026

    @ughoo

    I faced with same issue and here is a workaround/hack that helped me.

    • Go to the Unsloth Studio installed directory (in my Windows it is C:\Users.unsloth)
    • Find the next python file .unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\routes\inference.py
    • in that file replace all timeout = 600 with longer timeout.
    • restart the Unsloth Studio.
    • If want, to ensure the new code in script is actually work, you can add some log: after logger = get_logger(__name__) line add something like logger.error('hacked version used'). You will see that message on studio startup.

    thanks for it, i tried, i see the hacked string on unsloth start, but still stops after 600s... dont you change same values somewhere in llama.cpp config too?

  7. anthrwpos1 commented on Jun 10, 2026

    @anthrwpos1

    thanks for it, i tried, i see the hacked string on unsloth start, but still stops after 600s... dont you change same values somewhere in llama.cpp config too?

    I've just found in the studio/backend/core/inference/llama+cpp.py there is also _DEFAULT_T_MAX_PREDICT_MS constant that is 600_000 ms. Try to up that too.

  8. tehtelev commented on Jun 10, 2026

    @tehtelev
    Author

    I faced with same issue and here is a workaround/hack that helped me.

    • Go to the Unsloth Studio installed directory (in my Windows it is C:\Users.unsloth)
    • Find the next python file .unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\routes\inference.py
    • in that file replace all timeout = 600 with longer timeout.
    • restart the Unsloth Studio.
    • If want, to ensure the new code in script is actually work, you can add some log: after logger = get_logger(__name__) line add something like logger.error('hacked version used'). You will see that message on studio startup.

    This method helped me. How can I increase the prompt time from 120 seconds?

  9. ughoo commented on Jun 10, 2026

    @ughoo

    thanks for it, i tried, i see the hacked string on unsloth start, but still stops after 600s... dont you change same values somewhere in llama.cpp config too?

    I've just found in the studio/backend/core/inference/llama+cpp.py there is also _DEFAULT_T_MAX_PREDICT_MS constant that is 600_000 ms. Try to up that too.

    that worked! Thank you!!!!

  10. anthrwpos1 commented on Jun 10, 2026

    @anthrwpos1

    This method helped me. How can I increase the prompt time from 120 seconds?

    There is a suspecious 120s timeout here:

    • .unsloth\studio\unsloth_studio\Lib\site-packages\studio\backend\core\inference\llama_cpp.py
      • class LlamaCppBackend
        • def _stream_with_retry
          • prefill_timeout = httpx.Timeout( ... read = 120.0
  11. Imagineer99 commented on Jun 10, 2026

    @Imagineer99
    Member

    If possible can you test #5841 and verify it fixes for you?

  12. tehtelev commented on Jun 10, 2026

    @tehtelev
    Author

    If possible can you test #5841 and verify it fixes for you?

    Well, I inserted/replaced the specified files from the PR and now any request immediately stops in 2 seconds without a single error.
    Image

  13. Imagineer99 commented on Jun 10, 2026

    @Imagineer99
    Member

    If possible can you test #5841 and verify it fixes for you?

    Well, I inserted/replaced the specified files from the PR and now any request immediately stops in 2 seconds without a single error. Image

    Thanks for testing. Since #5841 currently has conflicts with main, manually replacing individual files can create a mixed Studio install where the changed files no longer match the surrounding code.

    Could you test the PR branch instead?

    git fetch origin pull/5841/head:pr-5841-timeouts
    git checkout pr-5841-timeouts
    ./install.sh --local
    unsloth studio
  14. tehtelev commented on Jun 10, 2026

    @tehtelev
    Author

    Could you test the actual PR branch instead?

    I've done all this. The models are behaving strangely. They might answer any question on the first try, or they might answer on the second or even third try. That is, the connection is being dropped without errors.
    If I make a huge request for tens of thousands of tokens, the prompt is always dropped. The maximum interruption time fluctuates between 0 and 12 seconds.
    It's also noticeable that the MoE models aren't fully loaded into memory. They might then load again the next time I try to send a question to the model.

  15. Imagineer99 commented on Jun 10, 2026

    @Imagineer99
    Member

    Could you test the actual PR branch instead?

    I've done all this. The models are behaving strangely. They might answer any question on the first try, or they might answer on the second or even third try. That is, the connection is being dropped without errors. If I make a huge request for tens of thousands of tokens, the prompt is always dropped. The maximum interruption time fluctuates between 0 and 12 seconds. It's also noticeable that the MoE models aren't fully loaded into memory. They might then load again the next time I try to send a question to the model.

    Thanks for testing. Sounds like it may be a separate issue rather than the timeout logic in #5841.

    Please share the terminal output around the failed request, plus the exact model/GGUF, context length set in run settings, and git rev-parse --short HEAD from the PR branch you tested.

  16. self-assigned this
    on Jun 11, 2026
  17. tehtelev commented on Jun 11, 2026

    @tehtelev
    Author

    Thanks for testing. Sounds like it may be a separate issue rather than the timeout logic in #5841.

    Please share the terminal output around the failed request, plus the exact model/GGUF, context length set in run settings, and git rev-parse --short HEAD from the PR branch you tested.

    I pulled down the latest repository again and applied the changes from PR 5841 to the pr-5841-timeouts branch.
    I believe the generation interruption has already been fixed. All models work.
    When testing with 100,000 input tokens, the prompt is processed without limitation, but generation still stops at 600 seconds.
    These results are consistent across all models.
    The git rev-parse --short HEAD command returned the string a131802

    Image Image
  18. Imagineer99 commented on Jun 12, 2026

    @Imagineer99
    Member

    Thanks for testing. Sounds like it may be a separate issue rather than the timeout logic in #5841.
    Please share the terminal output around the failed request, plus the exact model/GGUF, context length set in run settings, and git rev-parse --short HEAD from the PR branch you tested.

    I pulled down the latest repository again and applied the changes from PR 5841 to the pr-5841-timeouts branch. I believe the generation interruption has already been fixed. All models work. When testing with 100,000 input tokens, the prompt is processed without limitation, but generation still stops at 600 seconds. These results are consistent across all models. The git rev-parse --short HEAD command returned the string a131802

    Image Image

    Hey thanks again for testing, the PR branch extends the timeout from 120s to 600s so this is expected, I will update the PR to extend it further.

  19. TomerGamerTV commented on Aug 28, 2026

    @TomerGamerTV

    Was this implemented? I would be nice to have a setting to configure or disable the timeout

  20. Mr-Havoc999 commented on Aug 30, 2026

    @Mr-Havoc999

    Can you please see if that can be added to be configurable manually in settings rather than letting it be hardcoded in settings..?

  21. T-Poko commented on Oct 9, 2026

    @T-Poko

    Still hardcoded in current Studio builds. Measured 2026-10-09 on v0.1.905-beta (package 2026.10.3): a llama.cpp-served GGUF behind Studio :8888 gets a single generation cut off at exactly 300s, and Studio returns HTTP 200 with a ~150-byte error body instead of a timeout status.

    Strict JSON clients (OpenAI SDK) fail to parse that body and crash with a parse error, not a timeout — so callers can't distinguish "server timed out" from "server returned garbage", and client-side timeouts (we use 600s) never apply.

    #5841 (merged 2026-06-12) changed the constants; it did not make them configurable. The wall is still there in 10/2026 builds, just at a different number. The community workaround remains editing site-packages (studio/backend/routes/inference.py, core/inference/llama_cpp.py), which is wiped by every Studio update.

    Please add a setting — UI toggle and/or env var — to configure or disable the upstream request timeout. Until then, every downstream client has to engineer each call to finish under an undocumented wall.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions