Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix(studio): point denied --parallel args to Parallel Slots (#9512)

yzxcj797759e54a88c61
diff --git a/studio/backend/core/inference/llama_server_args.py b/studio/backend/core/inference/llama_server_args.py
index c56db0af214..1834df0ae34 100644
--- a/studio/backend/core/inference/llama_server_args.py
+++ b/studio/backend/core/inference/llama_server_args.py
@@ -280,10 +280,15 @@ def validate_extra_args(args: Optional[Iterable[str]]) -> list[str]:
raise ValueError("extra llama-server args cannot contain control characters")
flag = _flag_name(token)
if flag is not None and flag in _DENYLIST:
- raise ValueError(
+ message = (
f"llama-server flag '{flag}' is managed by Unsloth Studio "
f"and cannot be passed as an extra arg"
)
+ # Why (#9510): users reaching for `--parallel 1` to cap concurrent predictions on a
+ # local model hit this refusal with no pointer to the supported knob; name it.
+ if flag in {"-np", "--parallel", "--n-parallel"}:
+ message += "; set n_parallel on the load request (parallel decode slots) instead"
+ raise ValueError(message)
if flag is None:
# A token belonging to no flag. Today's llama-server answers "invalid
# argument" and refuses to start, which is a failed load rather than a
diff --git a/studio/backend/tests/test_llama_extra_args_compatibility.py b/studio/backend/tests/test_llama_extra_args_compatibility.py
index 15cb7711ebc..b7a0473800d 100644
--- a/studio/backend/tests/test_llama_extra_args_compatibility.py
+++ b/studio/backend/tests/test_llama_extra_args_compatibility.py
@@ -530,3 +530,16 @@ def test_a_padded_flag_is_carried_over_by_dropping_it_with_its_value():
assert dropped == ["--top-k"]
kept, _dropped = _lsa.drop_managed_flags(["--verbose ", "--numa", "distribute"])
assert kept == ["--numa", "distribute"]
+
+
[email protected]("flag", ["--parallel", "-np", "--n-parallel"])
+def test_parallel_denials_point_at_the_supported_knob(flag):
+ # Why (#9510): the parallel slot count IS user-settable, just not through extra args --
+ # refusing `--parallel 1` without naming n_parallel sent users to undocumented env hacks.
+ with pytest.raises(ValueError, match = "managed by Unsloth Studio.*n_parallel"):
+ _lsa.validate_extra_args([flag, "1"])
+
+
+def test_other_denials_stay_terse():
+ with pytest.raises(ValueError, match = "cannot be passed as an extra arg$"):
+ _lsa.validate_extra_args(["--model", "/etc/passwd"])
diff --git a/studio/frontend/src/features/model-picker/model-config/llama-extra-args.ts b/studio/frontend/src/features/model-picker/model-config/llama-extra-args.ts
index 0ee22e6af7f..29e6b494554 100644
--- a/studio/frontend/src/features/model-picker/model-config/llama-extra-args.ts
+++ b/studio/frontend/src/features/model-picker/model-config/llama-extra-args.ts
@@ -624,10 +624,20 @@ export type ExtraArgsDiagnostic = {
};
/**
- * Controls in this panel that emit the same flag. Not a denial: the backend appends
- * extras last and reconciles the ones that move its own sizing (`parse_ctx_override`
- * and friends exist for exactly that), and the CLI has always allowed it. The user
- * just deserves to be told which one wins.
+ * Managed flags whose supported replacement is a control in this panel. This stays
+ * available while the async flag catalogue is loading or unavailable: the backend
+ * denies these unconditionally, so they must never fall through to the "wins" note.
+ */
+const MANAGED_CONTROL_FLAGS: Record<string, string> = {
+ "--parallel": "Parallel Slots",
+ "--n-parallel": "Parallel Slots",
+ "-np": "Parallel Slots",
+};
+
+/**
+ * Pass-through flags that a control in this panel also emits. The backend appends
+ * these last and reconciles the ones that affect its sizing, so the mapping explains
+ * which value wins.
*/
const CONTROL_OWNED_FLAGS: Record<string, string> = {
"--ctx-size": "Context Length",
@@ -1044,6 +1054,9 @@ export function diagnoseExtraArgs(
continue;
}
seen.add(flag);
+ const managedControl = MANAGED_CONTROL_FLAGS[flag];
+ const isManaged =
+ managedControl !== undefined || Boolean(catalog?.managed.has(flag));
if (token !== token.trim()) {
// The padding is part of the token llama.cpp looks up, so a quoted "--top-k "
@@ -1054,7 +1067,7 @@ export function diagnoseExtraArgs(
level: "error",
message: `Remove the spaces around "${token}". llama-server reads them as part of the flag.`,
});
- } else if (token.includes("=") && !catalog?.managed.has(flag)) {
+ } else if (token.includes("=") && !isManaged) {
// Measured on b10342 and b10360: "--top-k=20", "--ctx-size=4096" and
// "--flash-attn=on" each exit with "error: invalid argument". A managed flag
// is left to the message below, which names the control that owns it.
@@ -1064,8 +1077,8 @@ export function diagnoseExtraArgs(
});
}
- if (catalog?.managed.has(flag)) {
- const control = CONTROL_OWNED_FLAGS[flag];
+ if (isManaged) {
+ const control = managedControl ?? CONTROL_OWNED_FLAGS[flag];
out.push({
level: "error",
message: control
diff --git a/studio/frontend/tests/llama-extra-args-diagnostics.test.ts b/studio/frontend/tests/llama-extra-args-diagnostics.test.ts
index e0e0a10415d..c360a4d73ed 100644
--- a/studio/frontend/tests/llama-extra-args-diagnostics.test.ts
+++ b/studio/frontend/tests/llama-extra-args-diagnostics.test.ts
@@ -61,14 +61,26 @@ test("a well-formed argument the binary knows says nothing", () => {
assert.deepEqual(diagnoseExtraArgs("", CATALOG), []);
});
-test("a managed flag is an error that names the control that owns it", () => {
- const text = messages("--parallel 8");
- assert.match(text, /--parallel/);
- assert.equal(levels("--parallel 8")[0], "error");
- assert.equal(
- extraArgsAreLoadable(diagnoseExtraArgs("--parallel 8", CATALOG)),
- false,
- );
+test("parallel aliases point at the supported control", () => {
+ for (const catalog of [CATALOG, null]) {
+ for (const input of [
+ "--parallel 8",
+ "--parallel=8",
+ "--n-parallel 8",
+ "--n_parallel 8",
+ "-np 8",
+ "-np8",
+ ]) {
+ const diagnostics = diagnoseExtraArgs(input, catalog);
+ assert.equal(diagnostics.length, 1);
+ assert.match(
+ diagnostics[0]?.message ?? "",
+ /is set by Parallel Slots above and cannot be passed here\.$/,
+ );
+ assert.equal(diagnostics[0]?.level, "error");
+ assert.equal(extraArgsAreLoadable(diagnostics), false);
+ }
+ }
});
test("a managed flag with no control says who owns it instead", () => {
@@ -88,13 +100,15 @@ test("an attached or equals form is caught the same way", () => {
test("a flag a control also sets is a note, not a refusal", () => {
// Deliberate: the backend appends extras last and reconciles the ones that move
// its own sizing, and the CLI has always allowed this. Say who wins, do not block.
- const diagnostics = diagnoseExtraArgs("--batch-size 512", CATALOG);
- assert.deepEqual(
- diagnostics.map((d) => d.level),
- ["note"],
- );
- assert.match(diagnostics[0].message, /Batch Size/);
- assert.equal(extraArgsAreLoadable(diagnostics), true);
+ for (const catalog of [CATALOG, null]) {
+ const diagnostics = diagnoseExtraArgs("--batch-size 512", catalog);
+ assert.deepEqual(
+ diagnostics.map((d) => d.level),
+ ["note"],
+ );
+ assert.match(diagnostics[0].message, /Batch Size/);
+ assert.equal(extraArgsAreLoadable(diagnostics), true);
+ }
});
test("a flag missing from this build warns but still loads", () => {