Repository navigation
Studio: bring the Llasa top_p default inside the range the API accepts - #9194
Conversation
The shipped default was 1.2, but top_p is a probability: every request model bounds it le=1.0 and _SAMPLING_FIELDS uses (0.0, 1.0). So the value the Chat UI was handed for this model was rejected with a 422 by the endpoint the UI sends it to, and every generation on Llasa-3B failed. 1.0 is nucleus sampling off, which is what a value above 1 was reaching for.
|
Confirmed the Llasa default still sits at 1.2 while both ChatCompletionRequest and _SAMPLING_FIELDS bound top_p to 1.0, so the recommended value never survives the trip back to the endpoint. Will get this reviewed. |
|
mahiatlinux
left a comment
There was a problem hiding this comment.
Review posted as a comment above.
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@mahiatlinux the four factual corrections hold. I reproduced each and rewrote the description around them. 400, not 422. The Reachability.
On the guard, I kept it in I did not widen it to |
|
I confirmed this against a running Studio with This also restores the recommendation itself. The out-of-range value was being discarded, so Studio substituted the static 0.95 on any request that omitted Thanks also to @mahiatlinux, whose review corrected the status code, the attribution and the reachability claim in the description. |
studio/backend/assets/configs/model_defaults/llasa/unsloth_Llasa-3B.yamlshipstop_p: 1.2.top_pis a probability, and the OpenAI-shaped request models bound it atle=1.0(studio/backend/models/inference.py:1062GenerateRequest,:1962ChatCompletionRequest,:3049ResponsesRequest). So the value this config recommends to the Chat UI cannot be sent back to the endpoint that served it.Nothing range-checks it on the way out.
load_inference_configreturns the YAML block as it is. The load and status handlers put that dict straight intoLoadResponse.inferenceandInferenceStatusResponse.inference, both untyped dicts (models/inference.py:1386,:1514).mergeBackendRecommendedInferencethen adopts it through a finiteness check only (studio/frontend/src/features/chat/presets/preset-policy.ts:268), sotop_p: 1.2reaches the chat's live params and is posted verbatim on/v1/chat/completions(chat-adapter.ts:5304,chat-api.ts:1573).Against the real request models and error handlers:
400 is the shape the Chat UI gets.
install_api_error_handlersrewritesRequestValidationErrorinto the OpenAI envelope for every/v1/*path (utils/api_errors.py:319-336). 422 is the non-/v1mount.Fix: set the default to 1.0. That is nucleus sampling off, which is what a value above 1 was reaching for, so it keeps the intent and makes it expressible.
Scope, since this value has shipped since February:
_clean_sampling_valuereturns None for an out-of-range value, so_recommended_samplingdrops the field andresolve_effective_samplingfalls through to the static 0.95. The rejection is the request model's bound alone.top_presolves to 1.0 rather than the static 0.95, on/v1/chat/completions,/v1/completionsand/v1/messagesalike. 1.0 is what the Llasa reference code asks for: it passestop_p = 1.2(tests/saving/text_to_speech_models/test_lasa.py:200), and_get_logits_processorbuilds aTopPLogitsWarperonly whentop_p < 1.0, so 1.2 and 1.0 are the same no-truncation setting there. Studio was applying 0.95 only because the recommendation was unparseable./api/inference/load. A Generate-picker pick ofunsloth/Llasa-3Bnever loads it. Llasa speaks XCodec2, whichAudioCodecManagercannot decode, socommunityAudioRowIsRunnablerefuses the row and the curated catalog leaves it out (audio-picker-policy.ts,model-catalog.ts). The pick ends at a toast. This YAML's live use is training.AnthropicMessagesRequest.top_p(models/inference.py:3404) is unbounded, unlike themin_pandrepetition_penaltytwo lines below it, so/v1/messagesforwards an out-of-range value unvalidated. Left alone here: adding a bound there would reject requests that are accepted today.The new
test_model_recommended_sampling_values_are_in_rangewalks everyassets/configs/model_defaults/**/*.yamland puts each UI-adopted sampling field through_clean_sampling_value, so the next out-of-range default fails a test instead of reaching the UI. It scans 78 files, and this was the only value outside the range.assets/configs/inference_defaults.json, the family defaults on the same resolution path, has none either.Verification, end to end against a running Studio on an RTX 6000 Ada with
unsloth/Llasa-3Bloaded throughPOST /api/inference/load:python3 -m pytest studio/backend/tests/test_sampling_resolution.py -qis 32 passed at head, 51 passed withtest_yaml_trust_remote_code_removed.pyandtest_muse_glimmer_sampling_defaults.pyadded, and the new test goes red on its own if the YAML is put back to 1.2. The frontend sampling and audio-picker suites are 52 passed. The 400/422 status shapes are also reproduced by aTestClientover the realinstall_api_error_handlersandChatCompletionRequest.Found while reviewing #9056, unrelated to it, so it goes separately.