unsloth/studio/backend
Daniel Han 4f9986ecb9
fix(studio): improve tool-calling re-prompt for small models (#4783)
Small GGUF models (<9B) frequently generate full code or lengthy
explanations instead of calling tools, bypassing the existing
plan-without-action re-prompt mechanism. Three issues:

1. _REPROMPT_MAX_CHARS=500 was too low -- models that output full
   HTML/code responses (often 1000+ chars) never triggered the
   re-prompt at all, since it only fires on short responses.

2. _MAX_REPROMPTS=1 gave the model only one chance to comply.
   Small models often need 2-3 nudges before switching from
   text generation to tool calling.

3. The re-prompt text ("Please use the available tools...") was
   too polite for small models to follow reliably.

4. Tool-calling detection missed chat templates using Jinja
   whitespace-trimming syntax ({%- if tools -%}) since only
   ({%- if tools %}) and ({% if tools %}) were checked.

Changes:
- Raise _REPROMPT_MAX_CHARS from 500 to 2000 so longer responses
  (code blocks, multi-paragraph plans) still trigger re-prompts
- Raise _MAX_REPROMPTS from 1 to 3 for more retry budget
- Use direct, imperative re-prompt language that small models
  follow more reliably ("STOP. You MUST call a tool NOW.")
- Strengthen the system prompt tool nudge to explicitly forbid
  outputting code blocks (redirect to the python tool instead)
- Add Jinja whitespace-trimmed variants to the tool_markers
  list so all template styles are detected correctly
2026-04-02 08:59:02 -07:00
..
assets fix(studio): correct default weight_decay and learning rate (#4695) 2026-03-31 13:50:25 +04:00
auth fix: remove old comments (#4292) 2026-03-14 16:50:13 +04:00
core fix(studio): improve tool-calling re-prompt for small models (#4783) 2026-04-02 08:59:02 -07:00
loggers Final cleanup 2026-03-12 18:28:04 +00:00
models fix(studio): allow context length slider to reach model's native limit (#4746) 2026-04-01 06:12:52 -07:00
plugins Bump Data Designer to 0.5.4 (removes litellm dependency) (#4569) 2026-03-25 02:01:43 -07:00
requirements UI Changes (#4782) 2026-04-02 08:05:55 -07:00
routes fix(studio): improve tool-calling re-prompt for small models (#4783) 2026-04-02 08:59:02 -07:00
state Final cleanup 2026-03-12 18:28:04 +00:00
storage feat: custom scan folders for GGUF model discovery (#4723) 2026-03-31 06:40:31 -07:00
tests Tests for architecture-aware KV cache estimation (#4760) 2026-04-01 06:13:37 -07:00
utils UI Changes (#4782) 2026-04-02 08:05:55 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
_platform_compat.py Fix Studio crash on Anaconda/conda-forge Python (#4484) 2026-03-22 05:36:55 -07:00
colab.py Allow install_python_stack to run on Colab (#4633) 2026-03-27 00:29:27 +04:00
main.py studio: Polish Windows installer/setup logs (#4736) 2026-03-31 23:12:42 -07:00
run.py fix(studio): avoid UnicodeEncodeError on Windows cp1252 consoles (#4699) 2026-03-30 06:40:47 -07:00
startup_banner.py studio: unify Windows installer/setup logging style, verbosity controls, and startup messaging (#4651) 2026-03-30 00:53:23 -07:00