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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
feat(neurons): features for Gemma 3 4B and 12B, agent hint at high strength
purple934da593bcdd
diff --git a/src-tauri/src/commands/neuron/mod.rs b/src-tauri/src/commands/neuron/mod.rsindex 75c0f55b..60307494 100644--- a/src-tauri/src/commands/neuron/mod.rs+++ b/src-tauri/src/commands/neuron/mod.rs@@ -883,7 +883,7 @@ pub fn neuron_feature_add(app: tauri::AppHandle, model_path: String, feature: usif feature >= spec.width {return Err("No such feature.".into());}- let id = feature_id(if spec.id.contains("270m") { "g270m" } else { "g1b" }, feature);+ let id = feature_id(spec.short, feature);let name = label.map(|l| l.chars().take(60).collect::<String>()).unwrap_or_else(|| format!("Feature #{feature}"));start_job("feature", &format!("Adding feature #{feature}"), &model_path.clone(), move || {let root = root();diff --git a/src-tauri/src/commands/neuron/sae.rs b/src-tauri/src/commands/neuron/sae.rsindex a9a5aff4..78b56a55 100644--- a/src-tauri/src/commands/neuron/sae.rs+++ b/src-tauri/src/commands/neuron/sae.rs@@ -35,6 +35,9 @@ impl Slice {pub struct SaeSpec {pub id: &'static str,+ /// Short tag in the ids of feature sliders ("f-g4b-123"), stable once+ /// shipped: a saved slider keeps its id across updates.+ pub short: &'static str,pub title: &'static str,pub repo: &'static str,pub revision: &'static str,@@ -60,12 +63,15 @@ impl SaeSpec {}}-/// Measured 28.10.2026 from the official repos (cc-by-4.0, not gated):-/// header lengths read with a range request, offsets from the safetensors-/// header, hashes over the downloaded slices.+/// Measured from the official repos (cc-by-4.0, not gated): header lengths+/// read with a range request, offsets from the safetensors header, hashes+/// over the downloaded slices. 270M and 1B on 28.10.2026, 4B and 12B on+/// 14.11.2026 (NEURONEN-SOTA-310.md). Each SAE sits in the middle block of+/// its model, the layer Gemma Scope 2 offers there at 16k features.pub const CATALOG: &[SaeSpec] = &[SaeSpec {id: "gemma-scope-2-270m-it-l9",+ short: "g270m",title: "Gemma Scope 2 · Gemma 3 270M IT · layer 9 · 16k features",repo: "google/gemma-scope-2-270m-it",revision: "49801301620db3e196553c903380aa21f42506fa",@@ -91,6 +97,7 @@ pub const CATALOG: &[SaeSpec] = &[},SaeSpec {id: "gemma-scope-2-1b-it-l13",+ short: "g1b",title: "Gemma Scope 2 · Gemma 3 1B IT · layer 13 · 16k features",repo: "google/gemma-scope-2-1b-it",revision: "b0fa29457c3601df0a70c48a15534c738d7c10e0",@@ -114,6 +121,58 @@ pub const CATALOG: &[SaeSpec] = &[},license: "CC-BY-4.0 (Google DeepMind, Gemma Scope 2)",},+ SaeSpec {+ id: "gemma-scope-2-4b-it-l17",+ short: "g4b",+ title: "Gemma Scope 2 · Gemma 3 4B IT · layer 17 · 16k features",+ repo: "google/gemma-scope-2-4b-it",+ revision: "3e94b68be95290aada5b7525cf431d3040f81bb1",+ folder: "resid_post/layer_17_width_16k_l0_medium",+ layer: 17,+ width: 16384,+ arch: "gemma3",+ n_embd: 2560,+ n_layer: 34,+ w_dec: Slice {+ file: "params.safetensors",+ start: 141_696,+ end: 167_913_855,+ sha256: "d67b6b31d1ac95b2e5f5ef433c90c480247710b0c1115542ac956aa23cf1a775",+ },+ top_tokens: Slice {+ file: "examples.safetensors",+ start: 814_682_984,+ end: 815_338_343,+ sha256: "b89436f4d6fed2ddfe9074e9b5ac1b82b2854a931169491a76cafbe683eb887e",+ },+ license: "CC-BY-4.0 (Google DeepMind, Gemma Scope 2)",+ },+ SaeSpec {+ id: "gemma-scope-2-12b-it-l24",+ short: "g12b",+ title: "Gemma Scope 2 · Gemma 3 12B IT · layer 24 · 16k features",+ repo: "google/gemma-scope-2-12b-it",+ revision: "4c419f1ba0be8b7754d4151d4f26c23b92a9029e",+ folder: "resid_post/layer_24_width_16k_l0_medium",+ layer: 24,+ width: 16384,+ arch: "gemma3",+ n_embd: 3840,+ n_layer: 48,+ w_dec: Slice {+ file: "params.safetensors",+ start: 146_816,+ end: 251_805_055,+ sha256: "646bcdeb7e8c124e5e26f4c652e015ca9a21a7fb6702b1ce63403eb5bcd93d4e",+ },+ top_tokens: Slice {+ file: "examples.safetensors",+ start: 814_660_456,+ end: 815_315_815,+ sha256: "1c6f35ad83a82e31a54afba82b28975a09702f472b73e25fc6ef4ffffacfb046",+ },+ license: "CC-BY-4.0 (Google DeepMind, Gemma Scope 2)",+ },];/// The SAE trained for this model, by shape. Base (pt) models have the same@@ -247,7 +306,11 @@ mod tests {assert_eq!(for_model(&facts("gemma3", 640, 18)).unwrap().id, "gemma-scope-2-270m-it-l9");assert_eq!(for_model(&facts("gemma3", 1152, 26)).unwrap().id, "gemma-scope-2-1b-it-l13");assert!(for_model(&facts("qwen2", 896, 24)).is_none());- assert!(for_model(&facts("gemma3", 2560, 34)).is_none());+ assert_eq!(for_model(&facts("gemma3", 2560, 34)).unwrap().id, "gemma-scope-2-4b-it-l17");+ assert_eq!(for_model(&facts("gemma3", 3840, 48)).unwrap().id, "gemma-scope-2-12b-it-l24");+ // Same width as 4B, other depth (Gemma 4 E4B, say): not this SAE.+ assert!(for_model(&facts("gemma3", 2560, 42)).is_none());+ assert!(for_model(&facts("gemma4", 2560, 34)).is_none());}#[test]@@ -259,6 +322,18 @@ mod tests {assert_eq!(s.w_dec.sha256.len(), 64);assert!(s.url(&s.w_dec).starts_with("https://huggingface.co/google/gemma-scope-2-"));assert!(s.url(&s.w_dec).contains(s.revision));+ // The SAE reads the middle block, as the shipped ones do.+ assert_eq!(s.layer, s.n_layer / 2, "{}", s.id);+ assert!(s.folder.starts_with(&format!("resid_post/layer_{}_", s.layer)), "{}", s.id);+ assert!(s.id.ends_with(&format!("-l{}", s.layer)), "{}", s.id);+ }+ // Ids and tags are unique; a tag names its model size.+ let mut shorts: Vec<&str> = CATALOG.iter().map(|s| s.short).collect();+ shorts.sort();+ shorts.dedup();+ assert_eq!(shorts.len(), CATALOG.len());+ for s in CATALOG {+ assert!(s.id.contains(&format!("-{}-it-", &s.short[1..])), "{}", s.id);}}diff --git a/src/components/neuron/NeuronPanel.tsx b/src/components/neuron/NeuronPanel.tsxindex b157451c..e4275afc 100644--- a/src/components/neuron/NeuronPanel.tsx+++ b/src/components/neuron/NeuronPanel.tsx@@ -25,7 +25,7 @@ import { isManagedBuiltinSlot } from '../../api/builtin-ensure'import { builtinModelMatches } from '../../lib/builtin-model-identity'import {backendNote, effectiveStrengths, entriesFor, hasPersonaProfile,- clampStrength, steeringPersona, strengthWarning, tweakedModelNote, buildTimeNote, warningText, type BackendKind, type Strengths,+ clampStrength, FEATURE_MODELS, steeringPersona, strengthWarning, tweakedModelNote, buildTimeNote, warningText, type BackendKind, type Strengths,} from '../../lib/neuron'import { NEURON_MAX_DOSE, featureVectorId, neuronVectorId, recipeOwnId, type Recipe, type RecipeEntry } from '../../lib/neuron-recipe'import { editingKey, useNeuronStore } from '../../stores/neuronStore'@@ -505,7 +505,7 @@ export function NeuronPanel({ chrome = {} }: { chrome?: WindowChrome }) {/>) : (<p className={`t-body ${HINWEIS_TEXT.ruhig}`} data-testid="neuron-features-none">- This model has no official feature map. Features exist for Gemma 3 270M IT and Gemma 3 1B IT (Gemma Scope 2 by Google DeepMind, CC-BY-4.0). Pick one of those as the model, or use the other ways.+ This model has no official feature map. Features exist for {FEATURE_MODELS} (Gemma Scope 2 by Google DeepMind, CC-BY-4.0). Pick one of those as the model, or use the other ways.</p>)}</>@@ -561,7 +561,7 @@ export function NeuronPanel({ chrome = {} }: { chrome?: WindowChrome }) {<li>Each slider is computed for this model the first time: LU reads short example pairs through the model and measures how far it can push before answers break. Seconds for small models, a few minutes for large ones. The chat pauses meanwhile.</li><li>±1 is just under where the measured answer started to break. Strong settings or many sliders at once can still make text repeat or wander.</li><li>A change restarts the engine with the new sliders (a few seconds). Turning Neurons off under Plugins restarts it without them.</li>- <li>Features exist only for models with an official sparse autoencoder: Gemma 3 270M IT and 1B IT (Gemma Scope 2, CC-BY-4.0).</li>+ <li>Features exist only for models with an official sparse autoencoder: {FEATURE_MODELS} (Gemma Scope 2, CC-BY-4.0).</li><li>Small models (under 1B) show traits weakly; special ones like a pirate voice need a bigger model.</li></ul><button type="button" className="lu-control lu-control--outline mt-3" onClick={() => { setPopup(null); showIntro() }} data-testid="neuron-intro-open">diff --git a/src/components/neuron/__tests__/neurons-for-beginners.test.tsx b/src/components/neuron/__tests__/neurons-for-beginners.test.tsxindex 5314e53e..c2550f31 100644--- a/src/components/neuron/__tests__/neurons-for-beginners.test.tsx+++ b/src/components/neuron/__tests__/neurons-for-beginners.test.tsx@@ -125,7 +125,7 @@ describe('Neurons in one window with pop-ups', () => {expect(tabs.map((t) => t.textContent)).toEqual(['From examples', 'Features', 'Coordinates'])expect(screen.getByText(/Your own slider, from examples/)).toBeTruthy()fireEvent.click(screen.getByTestId('neuron-way-features'))- expect(screen.getByTestId('neuron-features-none').textContent).toMatch(/Gemma 3 270M IT and Gemma 3 1B IT/)+ expect(screen.getByTestId('neuron-features-none').textContent).toMatch(/Gemma 3 270M, 1B, 4B and 12B IT/)})it('names the window status in its title bar', async () => {diff --git a/src/components/neuron/panels.tsx b/src/components/neuron/panels.tsxindex 8ae7ef47..15e37aef 100644--- a/src/components/neuron/panels.tsx+++ b/src/components/neuron/panels.tsx@@ -10,7 +10,7 @@ import { ICON_SM } from '../ui/icon-size'import { openExternal } from '../../api/backend'import { neuronCompare, neuronSaeSearch, type CompareResult, type FeatureHit, type NeuronInfo, type NeuronVector } from '../../api/neuron'import type { BundledModel } from '../../api/engine'-import { sameEntries, type entriesFor } from '../../lib/neuron'+import { FEATURE_MODELS, sameEntries, type entriesFor } from '../../lib/neuron'import {coordsLine, entryCode, modelFit, parseRecipe, recipeText, recipeLink,type ModelFit, type Recipe, type RecipeEntry,@@ -165,7 +165,7 @@ export function entryState(e: RecipeEntry, info: NeuronInfo, vectorIds: Readonlyif (vectorIds.has(ids.own(e))) return { state: 'ready' }return info.generator ? { state: 'prepare' } : { state: 'blocked', why: 'This install is missing its vector tool.' }case 'feature':- if (!info.sae) return { state: 'blocked', why: 'This model has no feature data (only Gemma 3 270M IT and 1B IT have).' }+ if (!info.sae) return { state: 'blocked', why: `This model has no feature data (only ${FEATURE_MODELS} have).` }if (e.feature >= info.sae.width) return { state: 'blocked', why: `This model's features go up to #${info.sae.width - 1}.` }if (vectorIds.has(ids.feature(e.feature))) return { state: 'ready' }return info.sae.downloaded ? { state: 'prepare' } : { state: 'blocked', why: 'Download the feature data first (Features tab).' }diff --git a/src/lib/__tests__/neuron-recipe.test.ts b/src/lib/__tests__/neuron-recipe.test.tsindex 77ee8ed8..3ea9bfa7 100644--- a/src/lib/__tests__/neuron-recipe.test.ts+++ b/src/lib/__tests__/neuron-recipe.test.ts@@ -162,6 +162,8 @@ describe('model names and ids', () => {expect(id.length).toBeLessThanOrEqual(48)expect(featureVectorId('gemma-scope-2-270m-it-l9', 11690)).toBe('f-g270m-11690')expect(featureVectorId('gemma-scope-2-1b-it-l13', 5)).toBe('f-g1b-5')+ expect(featureVectorId('gemma-scope-2-4b-it-l17', 7)).toBe('f-g4b-7')+ expect(featureVectorId('gemma-scope-2-12b-it-l24', 16383)).toBe('f-g12b-16383')expect(neuronVectorId(13, 7956)).toBe('n-L13-N7956')})})diff --git a/src/lib/__tests__/neuron.test.ts b/src/lib/__tests__/neuron.test.tsindex f4f1367f..a265cbb6 100644--- a/src/lib/__tests__/neuron.test.ts+++ b/src/lib/__tests__/neuron.test.ts@@ -12,6 +12,7 @@ import {sameEntries,shortDuration,strengthWarning,+ warningText,tweakedModelNote,buildTimeNote,} from '../neuron'@@ -67,6 +68,12 @@ describe('neuron warnings', () => {expect(strengthWarning([{ id: 'a', strength: 1 }, { id: 'b', strength: 0.8 }])).toBe('overload')})+ it('says that a strong push costs Agent and Code their task (measured: +0.4 works, +1.0 ignored it)', () => {+ expect(warningText('strong')).toMatch(/Agent and Code tasks work better at about ±0\.5/)+ expect(warningText('overload')).toMatch(/Agent and Code may stop following the task/)+ expect(warningText(null)).toBeNull()+ })+it('names the backend that cannot be steered', () => {expect(backendNote('lu-engine')).toBeNull()expect(backendNote('ollama')).toMatch(/Ollama takes no control vectors/)diff --git a/src/lib/neuron-recipe.ts b/src/lib/neuron-recipe.tsindex d53f8ae1..d12d8f78 100644--- a/src/lib/neuron-recipe.ts+++ b/src/lib/neuron-recipe.ts@@ -383,7 +383,9 @@ export function recipeOwnId(e: Extract<RecipeEntry, { kind: 'own' }>): string {/** The id Rust gives a feature slider (commands/neuron/mod.rs feature_id). */export function featureVectorId(saeId: string, feature: number): string {- return `f-${saeId.includes('270m') ? 'g270m' : 'g1b'}-${feature}`+ // The size in the SAE id is Rust's short tag: gemma-scope-2-4b-it-l17 → g4b.+ const size = /^gemma-scope-2-(\d+[mb])-/.exec(saeId)?.[1] ?? '1b'+ return `f-g${size}-${feature}`}/** The id the engine piece gives a single-neuron slider (AN-P11-N2.md). */diff --git a/src/lib/neuron.ts b/src/lib/neuron.tsindex aeae74b7..4e1dfcf0 100644--- a/src/lib/neuron.ts+++ b/src/lib/neuron.ts@@ -90,9 +90,12 @@ export function strengthWarning(entries: NeuronEntry[]): StrengthWarning {return null}+/** The models with an official feature map (Rust: neuron/sae.rs CATALOG). */+export const FEATURE_MODELS = 'Gemma 3 270M, 1B, 4B and 12B IT'+export function warningText(w: StrengthWarning): string | null {- if (w === 'overload') return 'Several strong sliders at once: answers may repeat themselves or fall apart. Turn some down.'- if (w === 'strong') return 'High strength: the effect is strongest here, and so is the risk of odd or repeating text.'+ if (w === 'overload') return 'Several strong sliders at once: answers may repeat themselves or fall apart, and Agent and Code may stop following the task. Turn some down.'+ if (w === 'strong') return 'High strength: the effect is strongest here, and so is the risk of odd or repeating text. Agent and Code tasks work better at about ±0.5.'return null}