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.

studio: preserve standalone gguf settings in compare mode (#11311)

Maheswar Kumardfb130d895b6
diff --git a/studio/frontend/src/features/model-picker/model-config/per-model-config.ts b/studio/frontend/src/features/model-picker/model-config/per-model-config.ts
index aa723d23011..1068e302539 100644
--- a/studio/frontend/src/features/model-picker/model-config/per-model-config.ts
+++ b/studio/frontend/src/features/model-picker/model-config/per-model-config.ts
@@ -4,6 +4,7 @@
import type { GpuIndexKind } from "@/hooks/use-gpu-info";
import {
ggufVariantFromStorageKey,
+ isStandaloneGgufPath,
modelIdFromStorageKey,
modelStorageKey,
normalizeGgufVariantIdentity,
@@ -1473,10 +1474,20 @@ export function resolveResidentInitialConfig(
modelId: string,
ggufVariant?: string | null,
): ResolvedPerModelConfig {
- const direct = resolveInitialConfig(modelId, ggufVariant);
+ // a standalone file's reported quant is a label; its settings are saved without a variant.
+ const standalone = isStandaloneGgufPath(modelId);
+ const direct = resolveInitialConfig(modelId, standalone ? null : ggufVariant);
if (direct.remembered) {
return direct;
}
+ // A loose .gguf load names no variant, so override_lookup_candidates reads the bare path
+ // then the label; a picker before #7473 keyed the label, and those records still exist.
+ if (standalone && ggufVariant) {
+ const labelled = resolveInitialConfig(modelId, ggufVariant);
+ if (labelled.remembered) {
+ return labelled;
+ }
+ }
const alias = publicModelId(modelId);
if (alias === modelId || !alias.includes("/")) {
return direct;
diff --git a/studio/frontend/tests/resident-remembered-config.test.ts b/studio/frontend/tests/resident-remembered-config.test.ts
index cc45787b57d..d8b52ce454c 100644
--- a/studio/frontend/tests/resident-remembered-config.test.ts
+++ b/studio/frontend/tests/resident-remembered-config.test.ts
@@ -81,6 +81,63 @@ test("the quant still separates two variants of one cached repo", () => {
);
});
+for (const modelId of [
+ "/home/u/.lmstudio/models/unsloth/Qwen3-0.6B-GGUF/Qwen3-0.6B-Q4_K_M.gguf",
+ String.raw`C:\Users\u\.lmstudio\models\unsloth\Qwen3-0.6B-GGUF\Qwen3-0.6B-Q4_K_M.gguf`,
+ "Qwen3-0.6B-Q4_K_M.gguf",
+]) {
+ test(`a resident standalone GGUF restores the settings saved by the picker: ${modelId}`, () => {
+ store.clear();
+ savePerModelConfig(modelId, null, {
+ ...config(2),
+ customContextLength: 4096,
+ });
+
+ const resolved = resolveResidentInitialConfig(modelId, "Q4_K_M");
+ assert.equal(resolved.remembered, true);
+ assert.equal(resolved.config.customContextLength, 4096);
+ assert.equal(resolved.config.nParallel, 2);
+ });
+}
+
+for (const modelId of [
+ "/home/u/.lmstudio/models/unsloth/Qwen3-0.6B-GGUF/Qwen3-0.6B-Q4_K_M.gguf",
+ "Qwen3-0.6B-Q4_K_M.gguf",
+]) {
+ test(`a record the picker keyed by the quant label before #7473 is still read: ${modelId}`, () => {
+ store.clear();
+ savePerModelConfig(modelId, "Q4_K_M", config(5));
+
+ // Only the label is on disk, so the fallback is what answers.
+ const resolved = resolveResidentInitialConfig(modelId, "Q4_K_M");
+ assert.equal(resolved.remembered, true);
+ assert.equal(resolved.config.nParallel, 5);
+
+ // A record under the path still wins over the older labelled one.
+ savePerModelConfig(modelId, null, config(6));
+ assert.equal(
+ resolveResidentInitialConfig(modelId, "Q4_K_M").config.nParallel,
+ 6,
+ );
+ });
+}
+
+for (const modelId of [
+ "/home/u/.lmstudio/models/unsloth/Qwen3-0.6B-GGUF",
+ "org/model.gguf",
+]) {
+ test(`a model containing several GGUF variants keeps their settings separate: ${modelId}`, () => {
+ store.clear();
+ savePerModelConfig(modelId, null, config(8));
+ savePerModelConfig(modelId, "Q4_K_M", config(2));
+ savePerModelConfig(modelId, "Q8_0", config(4));
+
+ assert.equal(resolveResidentInitialConfig(modelId, "Q4_K_M").config.nParallel, 2);
+ assert.equal(resolveResidentInitialConfig(modelId, "Q8_0").config.nParallel, 4);
+ assert.equal(resolveResidentInitialConfig(modelId, "Q6_K").remembered, false);
+ });
+}
+
test("a stem two models can share is never read as an alias", () => {
store.clear();
// A standalone GGUF is keyed by its own path; "Repo-Q4_K_M" is the stem both of these
diff --git a/tests/studio/test_model_picker_contracts.py b/tests/studio/test_model_picker_contracts.py
index 14796dda433..0357654da42 100644
--- a/tests/studio/test_model_picker_contracts.py
+++ b/tests/studio/test_model_picker_contracts.py
@@ -2355,11 +2355,19 @@ def test_remembered_slots_are_read_through_the_cached_repo_alias():
blanks on the model change and the next Save writes the blank over the saved
``n_parallel``, locally and through the server mirror."""
config = " ".join(_read("features/model-picker/model-config/per-model-config.ts").split())
- # The raw identifier still wins, so a path-keyed record is never shadowed.
+ # The raw identifier still wins, so a path-keyed record is never shadowed. A standalone
+ # file drops the reported quant first, since nothing is ever written under that key.
assert (
- "const direct = resolveInitialConfig(modelId, ggufVariant); "
+ "const direct = resolveInitialConfig(modelId, standalone ? null : ggufVariant); "
"if (direct.remembered) {" in config
)
+ # Then the label, the order override_lookup_candidates reads a loose .gguf in: a picker
+ # before #7473 keyed the label, and those records are still on disk.
+ assert (
+ "if (standalone && ggufVariant) { const labelled = "
+ "resolveInitialConfig(modelId, ggufVariant); if (labelled.remembered) { "
+ "return labelled; } }" in config
+ )
assert "const alias = publicModelId(modelId);" in config
# Only a namespaced collapse, the rule residentModelIdMatches applies: every other
# path collapses onto a file stem two models can share.