Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

feat(neuron): say before and after that the tweaker works best on original models

purple62e889564b19
diff --git a/src-tauri/src/commands/neuron/mod.rs b/src-tauri/src/commands/neuron/mod.rs
index 2077a7b5..0642a6ef 100644
--- a/src-tauri/src/commands/neuron/mod.rs
+++ b/src-tauri/src/commands/neuron/mod.rs
@@ -392,11 +392,15 @@ pub fn parse_progress(line: &str) -> Option<(u64, u64)> {
/// One readable sentence for a generator that ended without a direction. Its
/// own output (a backtrace on an abort) goes to the log, not on the page;
/// only a missing library is named, since that is what the user can act on.
+/// David, 31.10.2026: a failure always says what helps most. Changed models
+/// (abliterated, merged, …) are where the vector tool fails.
+const ORIGINAL_ADVICE: &str = "The Neuron tweaker works best with original, untweaked models: try the original of this model.";
+
pub fn tool_failure(stderr: &str) -> String {
// LU's patch to the generator says so instead of aborting when a model's
// layers do not come out the way it reads them (P11 FEHLER 10).
if stderr.contains("LU: unsupported model") {
- return "The vector tool cannot read this model's layers, so ready-made and own sliders do not work on it. Other models and feature sliders still work.".into();
+ return format!("The vector tool cannot read this model's layers, so ready-made and own sliders do not work on it. {ORIGINAL_ADVICE}");
}
let missing = stderr.lines().map(str::trim).find(|l| {
let low = l.to_lowercase();
@@ -408,7 +412,7 @@ pub fn tool_failure(stderr: &str) -> String {
});
match missing {
Some(line) => format!("The vector tool could not start: a library is missing ({line})."),
- None => "The vector tool stopped on this model without a result. Its last output is in the app log (target neuron).".into(),
+ None => format!("The vector tool stopped on this model without a result. {ORIGINAL_ADVICE} Its last output is in the app log (target neuron)."),
}
}
@@ -949,6 +953,10 @@ mod tests {
let msg = super::tool_failure("llama_print_build_info: build = 1 (049326a)\nLU: unsupported model: 32 layer outputs for 31 blocks\n");
assert!(msg.contains("cannot read this model's layers"), "{msg}");
assert!(!msg.contains("without a result"), "{msg}");
+ // David, 31.10.2026: every failure says what helps most.
+ for m in [msg, super::tool_failure("GGML_ASSERT(x) failed")] {
+ assert!(m.contains("works best with original, untweaked models"), "{m}");
+ }
}
use super::*;
diff --git a/src-tauri/src/commands/neuron/model.rs b/src-tauri/src/commands/neuron/model.rs
index 7590d314..06c0836e 100644
--- a/src-tauri/src/commands/neuron/model.rs
+++ b/src-tauri/src/commands/neuron/model.rs
@@ -75,6 +75,62 @@ pub struct ModelFacts {
pub n_embd: usize,
pub template: Template,
pub name: String,
+ /// Why this model looks changed before (abliterated, merge, …); empty
+ /// for an original. The view says "works best with original, untweaked
+ /// models" before computing when it is not empty.
+ pub tweaked: Vec<&'static str>,
+ /// The original to offer instead, family and size ("Qwen3.5 9B").
+ pub original: Option<String>,
+}
+
+/// What a GGUF head says about where a model came from.
+pub struct Signs<'a> {
+ pub file: &'a str,
+ pub name: &'a str,
+ pub finetune: Option<&'a str>,
+ pub base_names: &'a [String],
+ pub base_count: i64,
+ pub nextn: i64,
+}
+
+/// Words in a name that mean the weights were changed after the maker's
+/// release. Lower case, matched inside the name.
+const TWEAK_WORDS: [(&str, &str); 7] = [
+ ("abliterat", "abliterated"),
+ ("obliterat", "abliterated"),
+ ("heretic", "heretic"),
+ ("uncensor", "uncensored"),
+ ("decensor", "uncensored"),
+ ("merge", "merge"),
+ ("-mtp", "MTP"),
+];
+
+/// A maker's own fine-tunes (Qwen's "instruct", Gemma's "it") are originals.
+const MAKER_FINETUNES: [&str; 6] = ["instruct", "it", "chat", "base", "thinking", "reasoning"];
+
+/// Why a model looks tweaked, in the order the note names it (P11 FEHLER 10:
+/// the vector tool works best on original models; David, 31.10.2026).
+pub fn tweak_signs(s: &Signs) -> Vec<&'static str> {
+ let mut out: Vec<&'static str> = Vec::new();
+ let mut add = |w: &'static str| if !out.contains(&w) { out.push(w) };
+ if let Some(ft) = s.finetune {
+ let low = ft.to_lowercase();
+ let maker = low.split(|c: char| !c.is_ascii_alphanumeric()).any(|w| MAKER_FINETUNES.contains(&w));
+ if !low.is_empty() && !maker { add("fine-tune") }
+ }
+ if s.base_count > 1 { add("merge") }
+ let text = std::iter::once(s.file).chain(std::iter::once(s.name)).chain(s.base_names.iter().map(String::as_str))
+ .collect::<Vec<_>>().join(" ").to_lowercase();
+ for (needle, word) in TWEAK_WORDS {
+ if text.contains(needle) { add(word) }
+ }
+ if s.nextn > 0 { add("MTP") }
+ out
+}
+
+/// The original to offer: the family and size the head names.
+pub fn original_of(basename: Option<&str>, size: Option<&str>) -> Option<String> {
+ Some(format!("{} {}", basename?.trim(), size?.trim())).filter(|s| s.len() > 2)
}
/// Embedding and diffusion models (the architectures llama.cpp gives no
@@ -99,7 +155,26 @@ pub fn facts(path: &str) -> Result<ModelFacts, String> {
Some(Meta::Str(s)) => s.clone(),
_ => Path::new(path).file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_default(),
};
- Ok(ModelFacts { template: Template::detect(template_text, &arch), arch, n_layer, n_embd, name })
+ let text = |k: &str| match head.keys.get(k) {
+ Some(Meta::Str(s)) => Some(s.as_str()),
+ _ => None,
+ };
+ let base_count = match head.keys.get("general.base_model.count") {
+ Some(Meta::Int(n)) => *n,
+ _ => 0,
+ };
+ let base_names: Vec<String> = (0..base_count.clamp(0, 16)).filter_map(|i| text(&format!("general.base_model.{i}.name")).map(str::to_string)).collect();
+ let file = Path::new(path).file_stem().map(|s| s.to_string_lossy().into_owned()).unwrap_or_default();
+ let tweaked = tweak_signs(&Signs {
+ file: &file,
+ name: &name,
+ finetune: text("general.finetune"),
+ base_names: &base_names,
+ base_count,
+ nextn: head.arch_int("nextn_predict_layers").unwrap_or(0),
+ });
+ let original = original_of(text("general.basename"), text("general.size_label"));
+ Ok(ModelFacts { template: Template::detect(template_text, &arch), arch, n_layer, n_embd, name, tweaked, original })
}
/// Reads one string array (`tokenizer.ggml.tokens`) out of a GGUF head,
@@ -275,4 +350,37 @@ mod tests {
assert_eq!((ok.n_layer, ok.n_embd), (12, 768));
assert!(!is_chat_arch("bert") && !is_chat_arch("gemma-embedding") && is_chat_arch("gemma3"));
}
+ /// P11 FEHLER 10 (David, 31.10.2026): a model that was changed before
+ /// (abliterated, heretic, uncensored fine-tunes, merges, MTP) gets a note
+ /// before computing, "works best with original, untweaked models".
+ #[test]
+ fn a_tweaked_model_is_recognised_and_an_original_is_not() {
+ // David's model: Qwen3.5-9B-The-Defiant, a fine-tune merged from six
+ // models, three of them "Uncensored Heretic".
+ let bases: Vec<String> = vec![
+ "Qwen3.5 9B TNG PKD Qwopus Coder".into(),
+ "Qwen3.5 9B Pro Writer 1984 Orwell Uncensored Heretic".into(),
+ ];
+ let defiant = tweak_signs(&Signs {
+ file: "Qwen3.5-9B-The-Defiant-Q4_K_M", name: "Qwen3.5 9B DS9 USS Defiant NM",
+ finetune: Some("DS9-USS-Defiant-NM"), base_names: &bases, base_count: 6, nextn: 0,
+ });
+ assert!(defiant.contains(&"fine-tune") && defiant.contains(&"merge") && defiant.contains(&"heretic") && defiant.contains(&"uncensored"), "{defiant:?}");
+ // Abliterated in the file name alone, and an MTP block alone.
+ assert_eq!(tweak_signs(&Signs { file: "Llama-3.1-8B-Instruct-abliterated.Q4_K_M", name: "", finetune: None, base_names: &[], base_count: 0, nextn: 0 }), vec!["abliterated"]);
+ assert_eq!(tweak_signs(&Signs { file: "Qwen3.5-9B", name: "Qwen3.5 9B", finetune: None, base_names: &[], base_count: 0, nextn: 1 }), vec!["MTP"]);
+ // The originals on this Mac: Qwen's instruct and Gemma's "it" with
+ // their one base model are no tweak.
+ assert!(tweak_signs(&Signs { file: "qwen2.5-0.5b-instruct-q8_0", name: "qwen2.5-0.5b-instruct", finetune: Some("qwen2.5-0.5b-instruct"), base_names: &[], base_count: 0, nextn: 0 }).is_empty());
+ let gemma_base: Vec<String> = vec!["Gemma 3 270m".into()];
+ assert!(tweak_signs(&Signs { file: "gemma-3-270m-it-Q8_0", name: "Gemma 3 270m It", finetune: Some("it"), base_names: &gemma_base, base_count: 1, nextn: 0 }).is_empty());
+ assert!(tweak_signs(&Signs { file: "Qwen3-4B-Thinking-2507-Q4_K_M", name: "Qwen3 4B Thinking 2507", finetune: Some("Thinking-2507"), base_names: &[], base_count: 0, nextn: 0 }).is_empty());
+ }
+
+ #[test]
+ fn the_original_to_offer_is_family_and_size() {
+ assert_eq!(original_of(Some("Qwen3.5"), Some("9B")), Some("Qwen3.5 9B".into()));
+ assert_eq!(original_of(Some("gemma-3"), Some("270M")), Some("gemma-3 270M".into()));
+ assert_eq!(original_of(None, Some("9B")), None);
+ }
}
diff --git a/src-tauri/src/commands/neuron/sae.rs b/src-tauri/src/commands/neuron/sae.rs
index fdeaf497..2cf287c0 100644
--- a/src-tauri/src/commands/neuron/sae.rs
+++ b/src-tauri/src/commands/neuron/sae.rs
@@ -239,7 +239,7 @@ mod tests {
use super::*;
fn facts(arch: &str, n_embd: usize, n_layer: usize) -> ModelFacts {
- ModelFacts { arch: arch.into(), n_layer, n_embd, template: super::super::model::Template::Gemma, name: "x".into() }
+ ModelFacts { arch: arch.into(), n_layer, n_embd, template: super::super::model::Template::Gemma, name: "x".into(), tweaked: Vec::new(), original: None }
}
#[test]
diff --git a/src/api/neuron.ts b/src/api/neuron.ts
index be8788d4..24921dbc 100644
--- a/src/api/neuron.ts
+++ b/src/api/neuron.ts
@@ -39,7 +39,7 @@ export interface NeuronSae {
}
export interface NeuronInfo {
- facts: { arch: string; nLayer: number; nEmbd: number; template: string; name: string }
+ facts: { arch: string; nLayer: number; nEmbd: number; template: string; name: string; tweaked: string[]; original: string | null }
modelKey: string
generator: boolean
band: [number, number]
diff --git a/src/lib/__tests__/neuron.test.ts b/src/lib/__tests__/neuron.test.ts
index f9550267..9f119dec 100644
--- a/src/lib/__tests__/neuron.test.ts
+++ b/src/lib/__tests__/neuron.test.ts
@@ -12,6 +12,7 @@ import {
sameEntries,
shortDuration,
strengthWarning,
+ tweakedModelNote,
} from '../neuron'
import type { NeuronJob } from '../../api/neuron'
import type { Profiles } from '../neuron'
@@ -106,3 +107,17 @@ describe('editingKey', () => {
expect(editingKey('m', 'pirate', 'model')).toBe('m')
})
})
+
+// P11 FEHLER 10 (David, 31.10.2026): a model changed before gets a friendly
+// note before computing, with the original to take instead.
+describe('the note for a tweaked model', () => {
+ it('names why and offers the original', () => {
+ const note = tweakedModelNote({ tweaked: ['fine-tune', 'merge', 'heretic'], original: 'Qwen3.5 9B' })!
+ expect(note.title).toBe('Works best with original, untweaked models')
+ expect(note.text).toMatch(/fine-tune, merge, heretic/)
+ expect(note.original).toBe('Qwen3.5 9B')
+ })
+ it('says nothing for an original model', () => {
+ expect(tweakedModelNote({ tweaked: [], original: 'Qwen2.5 0.5B' })).toBeNull()
+ })
+})
diff --git a/src/lib/neuron.ts b/src/lib/neuron.ts
index 713b57b3..050fdbf9 100644
--- a/src/lib/neuron.ts
+++ b/src/lib/neuron.ts
@@ -146,3 +146,26 @@ export function backendNote(kind: BackendKind): string | null {
return 'Pick or download a model for LU Engine to start.'
}
}
+
+/** What the engine reads in a model's head about earlier changes
+ * (`facts.tweaked`, `facts.original`; commands/neuron/model.rs). */
+export interface TweakFacts {
+ tweaked?: string[]
+ original?: string | null
+}
+
+/**
+ * The friendly note before computing on a model that was changed before
+ * (P11 FEHLER 10, David 31.10.2026: "works best with original models that
+ * were not tweaked before"). Null for an original model. `original` is what
+ * to search for in Discover ("Qwen3.5 9B"), when the head names it.
+ */
+export function tweakedModelNote(facts: TweakFacts): { title: string; text: string; original: string | null } | null {
+ const why = facts.tweaked ?? []
+ if (why.length === 0) return null
+ return {
+ title: 'Works best with original, untweaked models',
+ text: `This model looks changed before (${why.join(', ')}). Sliders may come out weaker or fail on it. The original model gives the cleanest result.`,
+ original: facts.original ?? null,
+ }
+}