SplashGUI

Expose 8 more serve options from the 1.5.0 option audit

- Serve offline (skip Hub check), thinking token budget, verify-all-draft-rows
- Served name + report-in-responses: the Provider tab writes the name into
  client configs in place of the full Hub ID; it swaps with the model profile
- PLE/expert/sparse-KV memory knobs shown only for models whose arch has that
  memory (Flash-Next and A3B rows; hand-typed IDs match by name); the launch
  copy drops knobs the model lacks while saved values survive a switch back
- Harness 92 -> 115 checks (argv, tolerant decode, round-trip, profile swap,
  client-config naming, arch gate), mutation-proven

4bb8bae6bc334be2d1196146fe03112282303ebb
cjosie <administrator@josie-c.com> · 2026-11-03T12:52 · browse files at this commit

parents: 1f43bbf

diff --git a/Sources/SplashGUI/Core/AppConfig.swift b/Sources/SplashGUI/Core/AppConfig.swift
index a894527..c5e45bb 100644
--- a/Sources/SplashGUI/Core/AppConfig.swift
+++ b/Sources/SplashGUI/Core/AppConfig.swift
@@ -24,6 +24,28 @@ struct RunConfig: Codable, Equatable {
     // Keep the SSD KV/state tier across restarts, so a project you come back to restores its
     // prefix instead of prefilling it again.
     var persistentCache: Bool = true
+    // Start without contacting the Hugging Face Hub: the installed weights load straight from
+    // the local cache. For air-gapped or flaky-network starts; a never-downloaded model fails.
+    var offline: Bool = false
+    // Thinking tokens for requests that set no budget of their own; blank = no cap (the engine
+    // default). A serve-wide guard for clients that ask for thinking but say no length.
+    var thinkingTokenBudget: String = ""
+    // Decode-verify every row of each draft block. A MoE model's greedy and seeded outputs
+    // then repeat run to run like a dense model's, at some decode speed. Off leaves the
+    // engine's learned verify budget.
+    var verifyRowsAll: Bool = false
+    // An additional API model name (e.g. qwen27) so client configs stay short and stable across
+    // quants. It names this model, so it swaps with the profile like the serve fields.
+    var servedModelName: String = ""
+    // Report the served name in responses and /v1/models; off keeps the loaded model ID.
+    var announceServedName: Bool = false
+    // The arch-specific memory knobs: PLE and sparse-KV belong to Qwen3.8-Flash-Next GGUFs,
+    // expert slots to MoE rows. The Run tab shows only what the selected model has, and the
+    // launch path clears the rest (clearingUnsupportedMemoryKnobs), so a typed value never
+    // reaches a model without that memory while the saved value waits for the switch back.
+    var pleMemory: String = ""
+    var expertMemory: String = ""
+    var sparseKvMemory: String = ""
     var schemaVersion: Int? = 6
 
     // The memberwise initializer goes away with any custom initializer, and the defaults
@@ -36,7 +58,9 @@ struct RunConfig: Codable, Equatable {
     enum CodingKeys: String, CodingKey {
         case modelID, port, auto, maxContext, maxMemory, kvFormat, maxCacheDisk
         case languageOnly, decodeShare, showWebUI, lanAccess, defaultReasoningEffort
-        case idleRelease, persistentCache, schemaVersion
+        case idleRelease, persistentCache, offline, thinkingTokenBudget, verifyRowsAll
+        case servedModelName, announceServedName, pleMemory, expertMemory, sparseKvMemory
+        case schemaVersion
     }
 
     init(from decoder: Decoder) throws {
@@ -57,6 +81,15 @@ struct RunConfig: Codable, Equatable {
             ?? d.defaultReasoningEffort
         idleRelease = try c.decodeIfPresent(String.self, forKey: .idleRelease) ?? d.idleRelease
         persistentCache = try c.decodeIfPresent(Bool.self, forKey: .persistentCache) ?? d.persistentCache
+        offline = try c.decodeIfPresent(Bool.self, forKey: .offline) ?? d.offline
+        thinkingTokenBudget = try c.decodeIfPresent(String.self, forKey: .thinkingTokenBudget)
+            ?? d.thinkingTokenBudget
+        verifyRowsAll = try c.decodeIfPresent(Bool.self, forKey: .verifyRowsAll) ?? d.verifyRowsAll
+        servedModelName = try c.decodeIfPresent(String.self, forKey: .servedModelName) ?? d.servedModelName
+        announceServedName = try c.decodeIfPresent(Bool.self, forKey: .announceServedName) ?? d.announceServedName
+        pleMemory = try c.decodeIfPresent(String.self, forKey: .pleMemory) ?? d.pleMemory
+        expertMemory = try c.decodeIfPresent(String.self, forKey: .expertMemory) ?? d.expertMemory
+        sparseKvMemory = try c.decodeIfPresent(String.self, forKey: .sparseKvMemory) ?? d.sparseKvMemory
         schemaVersion = try c.decodeIfPresent(Int.self, forKey: .schemaVersion) ?? d.schemaVersion
     }
 
@@ -94,6 +127,16 @@ struct RunConfig: Codable, Equatable {
         }
         return out
     }
+
+    // Policy for the launch copy: memory knobs the selected model's arch does not have are
+    // dropped, so the engine never sees them for a model that cannot use them. The saved
+    // config keeps the typed values for the model that does.
+    mutating func clearingUnsupportedMemoryKnobs(forModelID id: String) {
+        let k = CatalogModel.memoryKnobs(forID: id)
+        if !k.ple { pleMemory = "" }
+        if !k.expert { expertMemory = "" }
+        if !k.sparseKv { sparseKvMemory = "" }
+    }
 }
 
 // The app's shipped starting point: the thinking-mode sampling every model in the catalog's card
@@ -145,6 +188,10 @@ struct ModelProfile: Codable, Equatable {
     var maxMemory: String = "auto"
     var kvFormat: String = "auto"
     var languageOnly = false
+    // The served API name names this model, so it belongs to the profile: switching models
+    // must not carry "qwen27" over to a different model's client configs.
+    var servedModelName: String = ""
+    var announceServedName: Bool = false
 
     // Tolerant decoder (the Codable trap): profiles saved before `auto` existed must decode
     // with it at its default, not throw — a nested failure drops the whole config to factory.
@@ -152,17 +199,21 @@ struct ModelProfile: Codable, Equatable {
 
     // The memberwise initializer the custom initializers take away.
     init(sampling: SamplingDefaults, auto: Bool, maxContext: String,
-         maxMemory: String, kvFormat: String, languageOnly: Bool) {
+         maxMemory: String, kvFormat: String, languageOnly: Bool,
+         servedModelName: String, announceServedName: Bool) {
         self.sampling = sampling
         self.auto = auto
         self.maxContext = maxContext
         self.maxMemory = maxMemory
         self.kvFormat = kvFormat
         self.languageOnly = languageOnly
+        self.servedModelName = servedModelName
+        self.announceServedName = announceServedName
     }
 
     enum CodingKeys: String, CodingKey {
         case sampling, auto, maxContext, maxMemory, kvFormat, languageOnly
+        case servedModelName, announceServedName
     }
 
     init(from decoder: Decoder) throws {
@@ -174,6 +225,8 @@ struct ModelProfile: Codable, Equatable {
         maxMemory = try c.decodeIfPresent(String.self, forKey: .maxMemory) ?? d.maxMemory
         kvFormat = try c.decodeIfPresent(String.self, forKey: .kvFormat) ?? d.kvFormat
         languageOnly = try c.decodeIfPresent(Bool.self, forKey: .languageOnly) ?? d.languageOnly
+        servedModelName = try c.decodeIfPresent(String.self, forKey: .servedModelName) ?? d.servedModelName
+        announceServedName = try c.decodeIfPresent(Bool.self, forKey: .announceServedName) ?? d.announceServedName
     }
 
     // Snapshot of the live settings, for archiving the model you are switching away from.
@@ -181,7 +234,9 @@ struct ModelProfile: Codable, Equatable {
         ModelProfile(sampling: config.sampling, auto: config.run.auto,
                      maxContext: config.run.maxContext,
                      maxMemory: config.run.maxMemory, kvFormat: config.run.kvFormat,
-                     languageOnly: config.run.languageOnly)
+                     languageOnly: config.run.languageOnly,
+                     servedModelName: config.run.servedModelName,
+                     announceServedName: config.run.announceServedName)
     }
 }
 
@@ -260,6 +315,8 @@ struct AppConfig: Codable, Equatable {
         run.maxMemory = profile.maxMemory
         run.kvFormat = profile.kvFormat
         run.languageOnly = profile.languageOnly
+        run.servedModelName = profile.servedModelName
+        run.announceServedName = profile.announceServedName
         run.defaultReasoningEffort = profile.sampling.reasoningEffort
     }
 }
@@ -308,6 +365,25 @@ struct CatalogModel: Identifiable, Equatable {
     // Auto's KV-per-token and window constants are measured on this arch only; other rows get
     // nil from autoProfile and the engine sizes itself.
     var qwen27BArch: Bool = false
+    // Which arch-specific serve memory knobs this row's model actually has: the PLE n-gram
+    // table and block-sparse KV are Qwen3.8-Flash-Next features; routed experts are the A3B
+    // MoE rows. The Run tab shows a knob only where its row (or the ID heuristics below)
+    // says true, and the launch path drops the rest.
+    var supportsPleMemory: Bool = false
+    var supportsExpertMemory: Bool = false
+    var supportsSparseKvMemory: Bool = false
+
+    // The knobs that apply to a model ID: the catalog row's flags when the ID is a row, else
+    // name heuristics for hand-typed IDs (A3B marks an MoE; Flash-Next marks the PLE table
+    // and the block-sparse KV). An ID matching neither gets no knobs and the engine sizes it.
+    static func memoryKnobs(forID id: String) -> (ple: Bool, expert: Bool, sparseKv: Bool) {
+        if let e = catalog.first(where: { $0.id == id }) {
+            return (e.supportsPleMemory, e.supportsExpertMemory, e.supportsSparseKvMemory)
+        }
+        let lower = id.lowercased()
+        let flashNext = lower.contains("flash-next")
+        return (flashNext, lower.contains("a3b"), flashNext)
+    }
 
     // Every level Splash's API accepts. A model's supportedEfforts filters this list.
     static let allEfforts = ["none", "minimal", "low", "medium", "high", "xhigh", "max"]
@@ -362,13 +438,13 @@ struct CatalogModel: Identifiable, Equatable {
     static let catalog: [CatalogModel] = [
         CatalogModel(id: "unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M", label: "Qwen3.6-35B-A3B Q4_K_M",
                      note: "for 36 GB Macs · 24 GB download · Fast all-rounder",
-                     approxBytes: 24_000_000_000, memoryGB: 36),
+                     approxBytes: 24_000_000_000, memoryGB: 36, supportsExpertMemory: true),
         CatalogModel(id: "mlx-community/Qwen3.6-35B-A3B-4bit", label: "Qwen3.6-35B-A3B MLX 4-bit",
                      note: "for 36 GB Macs · 21 GB download · Fast all-rounder",
-                     approxBytes: 21_000_000_000, memoryGB: 36),
+                     approxBytes: 21_000_000_000, memoryGB: 36, supportsExpertMemory: true),
         CatalogModel(id: "unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q2_K_XL", label: "Qwen3.6-35B-A3B Q2_K_XL",
                      note: "for 24 GB Macs · 14 GB download · Fast all-rounder",
-                     approxBytes: 14_000_000_000, memoryGB: 24),
+                     approxBytes: 14_000_000_000, memoryGB: 24, supportsExpertMemory: true),
         CatalogModel(id: "unsloth/Qwen3.8-27B-GGUF:UD-Q4_K_M", label: "Qwen3.8-27B Q4_K_M",
                      note: "for 36 GB Macs · 21 GB download · Strongest at this size, slower",
                      approxBytes: 21_000_000_000, memoryGB: 36, qwen27BArch: true),
@@ -383,7 +459,8 @@ struct CatalogModel: Identifiable, Equatable {
                      qwen27BArch: true),
         CatalogModel(id: "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF:Q2_0", label: "Qwen3.8-Flash-Next Q2_0",
                      note: "for 64 GB Macs · 69 GB download · Most capable",
-                     approxBytes: 69_000_000_000, memoryGB: 64),
+                     approxBytes: 69_000_000_000, memoryGB: 64,
+                     supportsPleMemory: true, supportsSparseKvMemory: true),
         CatalogModel(id: "unsloth/flint-GGUF:UD-Q4_K_XL", label: "Flint Q4_K_XL",
                      note: "for 48 GB Macs · 26 GB download · Text only",
                      approxBytes: 26_000_000_000, memoryGB: 48),
diff --git a/Sources/SplashGUI/Core/AppModel.swift b/Sources/SplashGUI/Core/AppModel.swift
index bd14527..f9550ca 100644
--- a/Sources/SplashGUI/Core/AppModel.swift
+++ b/Sources/SplashGUI/Core/AppModel.swift
@@ -403,7 +403,10 @@ final class AppModel: ObservableObject {
         let modalities = phase == .ready
             ? status?.inputModalities ?? (config.run.languageOnly ? ["text"] : ["text", "image", "pdf"])
             : (config.run.languageOnly ? ["text"] : ["text", "image", "pdf"])
-        let ctx = ClientConfigContext(client: client, modelID: config.run.modelID,
+        // The served name, when set, is the name clients should use: the API answers to it and,
+        // with announce, reports it. The full Hub ID stays the profile key and the /status name.
+        let apiName = config.run.servedModelName.isEmpty ? config.run.modelID : config.run.servedModelName
+        let ctx = ClientConfigContext(client: client, modelID: apiName,
                                       label: catalogEntry?.label ?? config.run.modelID,
                                       port: config.run.port, contextTokens: tokens,
                                       inputModalities: modalities,
@@ -435,6 +438,11 @@ final class AppModel: ObservableObject {
         )
     }
 
+    // Which arch memory knobs the Run tab shows for the selected model.
+    var memoryKnobs: (ple: Bool, expert: Bool, sparseKv: Bool) {
+        CatalogModel.memoryKnobs(forID: config.run.modelID)
+    }
+
     // Resolved run profile for the current model, using the catalog weight estimate when the
     // model hasn't downloaded yet. Cheap: weights size is cached, Metal ceiling read once.
     var currentAutoProfile: AutoProfile? {
@@ -560,7 +568,9 @@ final class AppModel: ObservableObject {
             self.phase = .starting
             let profile = self.currentAutoProfile
             do {
-                try self.server.launch(config: self.config.run.effective(using: profile),
+                var run = self.config.run.effective(using: profile)
+                run.clearingUnsupportedMemoryKnobs(forModelID: self.config.run.modelID)
+                try self.server.launch(config: run,
                                        revision: self.catalogEntry?.revision)
                 self.launchedRunConfig = self.config.run
                 if let pid = self.server.childPID {
diff --git a/Sources/SplashGUI/Core/SplashServer.swift b/Sources/SplashGUI/Core/SplashServer.swift
index 3ede59a..223f017 100644
--- a/Sources/SplashGUI/Core/SplashServer.swift
+++ b/Sources/SplashGUI/Core/SplashServer.swift
@@ -226,6 +226,19 @@ final class SplashServer {
         if let effort = config.defaultReasoningEffort, !effort.isEmpty {
             args += ["--default-reasoning-effort", effort]
         }
+        if config.offline { args += ["--offline"] }
+        if !config.thinkingTokenBudget.isEmpty {
+            args += ["--thinking-token-budget", config.thinkingTokenBudget]
+        }
+        if config.verifyRowsAll { args += ["--verify-rows", "all"] }
+        if !config.servedModelName.isEmpty {
+            args += ["--served-model-name", config.servedModelName]
+            // The engine needs a name to announce; the toggle alone passes nothing.
+            if config.announceServedName { args += ["--announce-served-name"] }
+        }
+        if !config.pleMemory.isEmpty { args += ["--ple-memory", config.pleMemory] }
+        if !config.expertMemory.isEmpty { args += ["--expert-memory", config.expertMemory] }
+        if !config.sparseKvMemory.isEmpty { args += ["--sparse-kv-memory", config.sparseKvMemory] }
         return args
     }
 }
diff --git a/Sources/SplashGUI/Views/RunTab.swift b/Sources/SplashGUI/Views/RunTab.swift
index e5de77c..f7d41e0 100644
--- a/Sources/SplashGUI/Views/RunTab.swift
+++ b/Sources/SplashGUI/Views/RunTab.swift
@@ -158,6 +158,23 @@ struct RunTab: View {
                 .disabled(model.config.run.auto)
                 .help("KV cache precision. BF16 is fastest at long contexts and exact; INT8 halves KV memory for RAM-constrained machines, but slows decode at depth and can cost accuracy (4-bit KV exists in Splash but is not offered here). With Auto on, the app picks BF16 and only drops to INT8 when BF16 would leave under a 32K window. Restart to apply.")
             }
+            LabeledField("Served name", $model.config.run.servedModelName, width: 120)
+                .help("An additional model name the API answers to, e.g. qwen27, so client configs stay short and stable across quants. The Provider tab writes it in place of the full Hub ID; /status keeps reporting the loaded model ID. Every model keeps its own name. Restart to apply.")
+            Toggle("Report served name in responses", isOn: $model.config.run.announceServedName)
+                .disabled(model.config.run.servedModelName.isEmpty)
+                .help("Responses report the served name and /v1/models lists it first; off (the engine default) they report the loaded model ID. Needs a served name. Restart to apply.")
+            if model.memoryKnobs.ple {
+                LabeledField("PLE memory", $model.config.run.pleMemory, width: 120)
+                    .help("RAM held for the PLE n-gram table of a Qwen3.8-Flash-Next GGUF, e.g. 2G; the rest streams from the SSD. Blank leaves it to the engine, which streams when RAM cannot hold the whole table. Restart to apply.")
+            }
+            if model.memoryKnobs.expert {
+                LabeledField("Expert memory", $model.config.run.expertMemory, width: 120)
+                    .help("RAM slots for the routed experts of a MoE model, e.g. 16G; the others read from the SSD when a token routes them. Blank leaves it to the engine, which loads every expert that fits. Restart to apply.")
+            }
+            if model.memoryKnobs.sparseKv {
+                LabeledField("Sparse-KV memory", $model.config.run.sparseKvMemory, width: 120)
+                    .help("RAM cache of the KV blocks this block-sparse model reads from the SSD, e.g. 1200M; never below the engine's floor. Blank keeps the floor. Restart to apply.")
+            }
         }
     }
 
@@ -212,6 +229,12 @@ struct RunTab: View {
                     Spacer()
                 }
             }
+            Toggle("Serve offline (skip Hub check)", isOn: $model.config.run.offline)
+                .help("Start without contacting Hugging Face: the model loads straight from the local cache. Use it on a plane or when the Hub is unreachable; a model that has never been downloaded cannot start this way. Restart to apply.")
+            LabeledField("Thinking budget", $model.config.run.thinkingTokenBudget, width: 120)
+                .help("Thinking tokens for requests that set no budget of their own, e.g. 16384; when it runs out the thinking closes and the answer follows. Blank means no cap (the engine default). Restart to apply.")
+            Toggle("Verify all draft rows", isOn: $model.config.run.verifyRowsAll)
+                .help("Decode-verify every row of each draft block instead of a learned subset. A MoE model's greedy and seeded outputs then repeat run to run, like a dense model's; the full check costs some decode speed. Off leaves it to the engine. Restart to apply.")
         }
     }
 
diff --git a/scripts/profile-test/main.swift b/scripts/profile-test/main.swift
index b282cf2..3fe9124 100644
--- a/scripts/profile-test/main.swift
+++ b/scripts/profile-test/main.swift
@@ -60,6 +60,20 @@ func runTests() {
     check("restored reasoning effort (both places)",
           m.config.sampling.reasoningEffort == "low" && m.config.run.defaultReasoningEffort == "low")
 
+    // The served name names the model, so it swaps with the profile, and a model entered
+    // without a saved name starts blank rather than keeping the name of the one left.
+    m.config.run.servedModelName = "qwen27"
+    m.config.run.announceServedName = true
+    m.selectModelID(B)
+    check("served name archived with the outgoing profile",
+          m.config.modelProfiles[A]?.servedModelName == "qwen27"
+            && m.config.modelProfiles[A]?.announceServedName == true)
+    check("switching restores a blank served name for a model without one",
+          m.config.run.servedModelName.isEmpty && m.config.run.announceServedName == false)
+    m.selectModelID(A)
+    check("served name restored with the profile",
+          m.config.run.servedModelName == "qwen27" && m.config.run.announceServedName == true)
+
     // D: a second Qwen row is also card-driven, and card data is per row.
     m.selectModelID(C)
     check("Qwen Q4_K_M card temp 1.0", m.config.sampling.temperature == 1.0, "\(m.config.sampling.temperature)")
@@ -159,6 +173,99 @@ func runTests() {
         check("lanAccess round-trips through a save", false, "encode/decode threw")
     }
 
+    // F3: the serve options from the 1.5.0 option audit (offline, thinking budget, verify-rows,
+    // served name, arch memory knobs). Defaults stay off the command line, a pre-audit config
+    // decodes them defaulted (the Codable trap), and the arch knobs reach only models that
+    // have the memory they tune.
+    func flagValue(_ args: [String], _ flag: String) -> String? {
+        guard let i = args.firstIndex(of: flag), i + 1 < args.count else { return nil }
+        return args[i + 1]
+    }
+    let plainArgs = SplashServer.buildArguments(for: RunConfig())
+    check("new serve options stay off the command line by default",
+          !plainArgs.contains("--offline") && !plainArgs.contains("--thinking-token-budget")
+            && !plainArgs.contains("--verify-rows") && !plainArgs.contains("--served-model-name")
+            && !plainArgs.contains("--announce-served-name") && !plainArgs.contains("--ple-memory")
+            && !plainArgs.contains("--expert-memory") && !plainArgs.contains("--sparse-kv-memory"),
+          plainArgs.joined(separator: " "))
+    var so = RunConfig()
+    so.offline = true
+    so.thinkingTokenBudget = "16384"
+    so.verifyRowsAll = true
+    so.servedModelName = "qwen27"
+    so.announceServedName = true
+    so.pleMemory = "2G"
+    so.expertMemory = "16G"
+    so.sparseKvMemory = "1200M"
+    let soArgs = SplashServer.buildArguments(for: so)
+    check("offline reaches the engine", soArgs.contains("--offline"))
+    check("thinking budget reaches the engine",
+          flagValue(soArgs, "--thinking-token-budget") == "16384", soArgs.joined(separator: " "))
+    check("verify-rows all reaches the engine", flagValue(soArgs, "--verify-rows") == "all")
+    check("served name reaches the engine", flagValue(soArgs, "--served-model-name") == "qwen27")
+    check("announce reaches the engine with a name", soArgs.contains("--announce-served-name"))
+    check("PLE memory reaches the engine", flagValue(soArgs, "--ple-memory") == "2G")
+    check("expert memory reaches the engine", flagValue(soArgs, "--expert-memory") == "16G")
+    check("sparse-KV memory reaches the engine", flagValue(soArgs, "--sparse-kv-memory") == "1200M")
+    var nameless = RunConfig()
+    nameless.announceServedName = true
+    check("announce without a served name passes nothing",
+          !SplashServer.buildArguments(for: nameless).contains("--announce-served-name"))
+    let noOptions = #"{"run":{"port":8123,"modelID":"someone/Model:x"}}"#
+    if let od = noOptions.data(using: .utf8),
+       let ocfg = try? JSONDecoder().decode(AppConfig.self, from: od) {
+        check("serve options absent decode defaulted without losing the config",
+              ocfg.run.offline == false && ocfg.run.thinkingTokenBudget.isEmpty
+                && ocfg.run.verifyRowsAll == false && ocfg.run.servedModelName.isEmpty
+                && ocfg.run.announceServedName == false && ocfg.run.pleMemory.isEmpty
+                && ocfg.run.expertMemory.isEmpty && ocfg.run.sparseKvMemory.isEmpty
+                && ocfg.run.port == 8123 && ocfg.run.modelID == "someone/Model:x")
+    } else {
+        check("serve options absent decode defaulted without losing the config", false, "decoder threw")
+    }
+    var ocfg2 = AppConfig()
+    ocfg2.run.offline = true
+    ocfg2.run.thinkingTokenBudget = "16384"
+    ocfg2.run.servedModelName = "qwen27"
+    ocfg2.run.announceServedName = true
+    ocfg2.run.pleMemory = "2G"
+    if let od2 = try? JSONEncoder().encode(ocfg2),
+       let oback = try? JSONDecoder().decode(AppConfig.self, from: od2) {
+        check("serve options round-trip through a save",
+              oback.run.offline == true && oback.run.thinkingTokenBudget == "16384"
+                && oback.run.servedModelName == "qwen27" && oback.run.announceServedName == true
+                && oback.run.pleMemory == "2G")
+    } else {
+        check("serve options round-trip through a save", false, "encode/decode threw")
+    }
+    // The arch gate on the launch copy: knobs typed for a model that lacks the memory never
+    // reach the engine; the models that have them keep them.
+    let flashNextID = "ISTA-DASLab/Qwen3.8-Flash-Next-GSQ-RCO-GGUF:Q2_0"
+    let moeID = "unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q4_K_M"
+    func knobsKept(_ id: String) -> (ple: Bool, expert: Bool, sparseKv: Bool) {
+        var r = RunConfig()
+        r.pleMemory = "2G"
+        r.expertMemory = "16G"
+        r.sparseKvMemory = "1200M"
+        r.clearingUnsupportedMemoryKnobs(forModelID: id)
+        return (!r.pleMemory.isEmpty, !r.expertMemory.isEmpty, !r.sparseKvMemory.isEmpty)
+    }
+    let denseKept = knobsKept(A)
+    check("knobs dropped for a dense 27B row",
+          !denseKept.ple && !denseKept.expert && !denseKept.sparseKv)
+    let fnKept = knobsKept(flashNextID)
+    check("Flash-Next keeps PLE and sparse-KV, drops experts",
+          fnKept.ple && fnKept.sparseKv && !fnKept.expert)
+    let moeKept = knobsKept(moeID)
+    check("MoE keeps experts, drops PLE and sparse-KV",
+          moeKept.expert && !moeKept.ple && !moeKept.sparseKv)
+    let customFN = knobsKept("someone/MyQwen3.8-Flash-Next-Quant:Q4")
+    check("hand-typed Flash-Next ID keeps its knobs by name",
+          customFN.ple && customFN.sparseKv && !customFN.expert)
+    let customNone = knobsKept("someone/Custom-Model:x")
+    check("unknown custom ID gets no knobs",
+          !customNone.ple && !customNone.expert && !customNone.sparseKv)
+
     // I: the Auto switch resolves the four covered fields at launch.
     let prof = AutoProfile(maxMemoryBytes: 40_000_000_000, contextTokens: 131_072, kvFormat: "int8")
     var arun = RunConfig()   // shipped default: Auto on
@@ -317,6 +424,19 @@ func runTests() {
             && xtext.contains("model_auto_compact_token_limit = 58982")
             && xtext.contains("model_provider = \"splash\""))
 
+    // The served name, when set, replaces the Hub ID in the configs the Provider tab writes.
+    let priorID = m.config.run.modelID
+    m.config.run.modelID = A
+    m.config.run.servedModelName = "qwen27"
+    let stext = m.clientConfigText(for: .claudeCode)
+    check("served name: client configs name the model by it",
+          stext.contains("\"qwen27\"") && !stext.contains(A))
+    m.config.run.servedModelName = ""
+    let ftext = m.clientConfigText(for: .claudeCode)
+    check("no served name: the full Hub ID is written as before",
+          ftext.contains(A) && !ftext.contains("qwen27"))
+    m.config.run.modelID = priorID
+
     // M: engine source — the mode field's tolerant decode and the latest-release resolver.
     // Synthetic JSON, not the live fixture: the app now WRITES engineMode, so the on-disk
     // config always has the key and cannot prove the absent-key default.
@@ -458,6 +578,19 @@ func runTests() {
     check("Auto sizing still covers the 27B arch",
           MachineInfo.autoProfile(modelID: A, languageOnly: false, weightsBytes: 10_000_000_000) != nil)
 
+    // The memory-knob support flags follow the archs: the Flash-Next row tunes PLE and
+    // sparse-KV, the three A3B rows tune experts, the rest tune nothing.
+    let fnK = CatalogModel.memoryKnobs(forID: flashNextID)
+    let moeK = CatalogModel.memoryKnobs(forID: moeID)
+    let mlxK = CatalogModel.memoryKnobs(forID: "mlx-community/Qwen3.6-35B-A3B-4bit")
+    let q2K = CatalogModel.memoryKnobs(forID: "unsloth/Qwen3.6-35B-A3B-GGUF:UD-Q2_K_XL")
+    let denseK = CatalogModel.memoryKnobs(forID: A)
+    check("catalog rows carry their memory-knob support",
+          fnK.ple && fnK.sparseKv && !fnK.expert
+            && moeK.expert && !moeK.ple && !moeK.sparseKv
+            && mlxK.expert && q2K.expert
+            && !denseK.ple && !denseK.expert && !denseK.sparseKv)
+
     exit(failures == 0 ? 0 : 1)
 }