Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

App: DeepSeek's context goes up to the pack's limit (512K, 1M), with a plain "not tested yet" note past 256K, in eight languages (Project Maya #442, @needmorevram)

Niko1221c4c320a75599
diff --git a/apps/host/server/dsv41-context.mjs b/apps/host/server/dsv41-context.mjs
new file mode 100644
index 000000000..a07a9e760
--- /dev/null
+++ b/apps/host/server/dsv41-context.mjs
@@ -0,0 +1,20 @@
+// DeepSeek-V4.1-Flash's own context limit, read from its pack (the app offers sizes up to it: src/lib/deepseek-context.ts).
+// Project Maya v1.1.28 (#442, @needmorevram, MIT) did the same in its dashboard. strata_control/dsv41_context.py reads the same file for setup and the Terminal.
+import { readFileSync } from 'node:fs';
+import { join } from 'node:path';
+
+/** The pack's own limit: `max_position_embeddings` in <pack>/ds4.txt. Null when there is no pack, no file or no such line (the choices then stay as before). */
+export function packContextLimit(pack) {
+ if (!pack) return null;
+ try {
+ const match = /^max_position_embeddings\s+(\d+)\s*$/m.exec(readFileSync(join(pack, 'ds4.txt'), 'utf8'));
+ const value = match ? Number(match[1]) : 0;
+ return Number.isSafeInteger(value) && value >= 1024 ? value : null;
+ } catch { return null; }
+}
+
+/** The limit of the pack a DeepSeek run config names (`--pack DIR` in its arguments). */
+export function configContextLimit(config) {
+ const args = (config?.args ?? []).map(String), at = args.indexOf('--pack');
+ return at >= 0 && at + 1 < args.length ? packContextLimit(args[at + 1]) : null;
+}
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjs
index 8309f22f4..0b9ce9019 100644
--- a/apps/host/server/native-control.mjs
+++ b/apps/host/server/native-control.mjs
@@ -23,6 +23,7 @@ import { openTextFile } from './open-text-file.mjs';
import { markEngine, engineRefusal } from './engine-version.mjs';
import { friendlyModelName } from './model-names.mjs';
import { parseSaved as parseRoles, mirror as mirrorRoles } from './gpu-roles.mjs';
+import { configContextLimit } from './dsv41-context.mjs';
const ROOT=resolve(dirname(fileURLToPath(import.meta.url)),'..');
const safeId=value=>typeof value==='string'&&/^[a-z0-9](?:[a-z0-9_-]|\.(?!\.)){0,79}$/i.test(value); /* a dot inside the name: deepseek-v4.1-flash-ist-das-2.00bpw */
@@ -86,7 +87,7 @@ export function createNativeControl({directory,requests=()=>[],changed=()=>{},sp
for(const name of names){const path=join(dir,name),config=readJson(path,null);if(!config||typeof config!=='object')continue;
const next={...config,...(config.cwd!==undefined?{cwd:fix(config.cwd)}:{}),...(Array.isArray(config.args)?{args:config.args.map(fix)}:{})};
if(JSON.stringify(next)!==JSON.stringify(config)){try{writeModelConfig(path,next);}catch{/* read-only folder: the load reports it */}}}}
- function installedInfo(info){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_.-]+\.json$/i.test(entry.config??'')?readJson(entry.configPath??join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;/* A model the person pointed at their own GGUF folder (not <data>/models/<tag>): remembered, so a later load runs setup with that folder again instead of downloading the files (#3199). */const ownGgufDir=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))!=='models'&&existsSync(nativeFile)?dirname(nativeFile):undefined;return {...entry,ownGgufDir,diskGb:entry.diskGb??entry.disk_gb,diskBytes:entry.diskBytes??entry.disk_bytes,sharedBytes:entry.sharedBytes??entry.shared_bytes,removableGb:entry.removableGb??entry.removable_gb,dataFolder,visionPrepared:!!cfg.vision,/* The picture files are prepared when the run config has a vision section: the Models screen then loads straight away instead of running setup again (it used to read 'off' for every model, which sent every load of a picture-capable model through "Apply settings and load", and setup writes the arguments, the draft layer and the reader back each time). */images:cfg.vision?'yes':'off',draftLayer:cfg.mtp!==false,drafting:cfg.drafting??'auto',/* Picture reading is ON unless the person turned it off: no saved choice and not loaded is undefined, not false (owner rule: pictures on by default). */visionEnabled:cfg.ui_vision_enabled??(()=>{const running=[...instances.values()].find(i=>i.model===entry.model&&i.status==='ready');return running?!!running.vision:undefined;})(),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}
+ function installedInfo(info){if(!info)return info;return {...info,models:(info.models??[]).map(entry=>{const cfg=/^strata-[a-z0-9_.-]+\.json$/i.test(entry.config??'')?readJson(entry.configPath??join(repo(),entry.config)):{};const at=cfg.args?.indexOf('--native')??-1,nativeFile=at>=0?cfg.args[at+1]:null;const dataFolder=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))==='models'?dirname(dirname(dirname(nativeFile))):info.data_folder;/* A model the person pointed at their own GGUF folder (not <data>/models/<tag>): remembered, so a later load runs setup with that folder again instead of downloading the files (#3199). */const ownGgufDir=typeof nativeFile==='string'&&basename(dirname(dirname(nativeFile)))!=='models'&&existsSync(nativeFile)?dirname(nativeFile):undefined;return {...entry,ownGgufDir,contextMax:configContextLimit(cfg)??undefined,diskGb:entry.diskGb??entry.disk_gb,diskBytes:entry.diskBytes??entry.disk_bytes,sharedBytes:entry.sharedBytes??entry.shared_bytes,removableGb:entry.removableGb??entry.removable_gb,dataFolder,visionPrepared:!!cfg.vision,/* The picture files are prepared when the run config has a vision section: the Models screen then loads straight away instead of running setup again (it used to read 'off' for every model, which sent every load of a picture-capable model through "Apply settings and load", and setup writes the arguments, the draft layer and the reader back each time). */images:cfg.vision?'yes':'off',draftLayer:cfg.mtp!==false,drafting:cfg.drafting??'auto',/* Picture reading is ON unless the person turned it off: no saved choice and not loaded is undefined, not false (owner rule: pictures on by default). */visionEnabled:cfg.ui_vision_enabled??(()=>{const running=[...instances.values()].find(i=>i.model===entry.model&&i.status==='ready');return running?!!running.vision:undefined;})(),visionDevice:cfg.ui_vision_device,resourceProfile:cfg.ui_resource_profile,lowRamMode:cfg.args?.includes('--resident-experts')?'resident':cfg.args?.includes('--mmap-experts')?'mmap':'auto'};})};}
function installRoot(){const found=[preferences.installDir].find(d=>d&&existsSync(d));if(found)return realpathSync(found);mkdirSync(defaultInstall(),{recursive:true});return realpathSync(defaultInstall());}
/* The settings file Strata Control and the installer read (control-runtime.mjs sets STRATA_SETTINGS_FILE to it): the app's data folder is written there. */
function controlSettingsFile(){return process.env.STRATA_SETTINGS_FILE||join(dirname(componentsDirectory()),'app-settings.json');}
diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsx
index 4da541dde..1ea224728 100644
--- a/apps/host/src/components/NativeModels.tsx
+++ b/apps/host/src/components/NativeModels.tsx
@@ -21,6 +21,7 @@ import { nativeAction, useNative, type NativeJob } from '../lib/native';
import { tuneEffective } from '../lib/native-tune';
import { tunedFields } from '../lib/tune-values';
import { draftingChoices as draftingOptions } from '../lib/drafting';
+import { deepseekContexts, deepseekContextNote } from '../lib/deepseek-context';
import { NativeSettings } from './NativeSettings';
import { NativeSettingsFile } from './NativeSettingsFile';
import { RunImageModel } from './RunImageModel';
@@ -104,7 +105,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
// Drafting (which drafter guesses ahead): DFlash2 is for Qwen3.8-Flash-Next only (the qwen and gyro families), so no other model is offered it.
const draftingChoices = selectedSize ? draftingOptions(selectedSize.sourceFamily ?? selectedFamily?.family, native?.capabilities?.dflash2) : null;
const draftingWords: Record<string, string> = { auto: 'Auto (recommended)', mtp: 'MTP', dflash2: 'DFlash2', off: 'Off' };
- const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context: selectedSize?.multi_file ? 8192 : context, vision: selectedSize?.images ? vision : 'no', kv, low_ram: lowRam, resourceProfile, ...(cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, cardsGpus.join(','), expert, multiple]);
+ const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context, vision: selectedSize?.images ? vision : 'no', kv, low_ram: lowRam, resourceProfile, ...(cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, cardsGpus.join(','), expert, multiple]);
const downloadValues = { ...values, ...(draftingChoices ? { drafting } : {}), vision: selectedSize?.images && vision !== 'no' ? 'yes' : 'no', loadVision: selectedSize?.images ? vision : 'no' };
useEffect(() => { if (!native?.catalog || family)
return; const current = native.instances.find(i => i.id === native.defaultId); const rec = native.catalog.recommendation ?? { family: null, model: null }; const loadedFamily = families.find(f => f.sizes.some(s => s.id === current?.model)); const have = new Set((native.installed?.models ?? []).filter(m => m.ready).map(m => m.model)); const installedFamily = families.find(f => f.sizes.some(s => have.has(s.id))); const f = loadedFamily ?? installedFamily ?? families.find(f => f.family === rec.family || f.sizes.some(s => s.sourceFamily === rec.family)) ?? families[0]; if (f) {
@@ -186,8 +187,9 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
return; presetPending.current = true; setFamily(f.family); setSize(f.sizes.find(s => s.model === v.model && (s.sourceFamily === v.family || f.family === v.family))?.id ?? ''); setContext(v.context ?? 32768); setVision(v.vision ?? 'no'); setKv(v.kv ?? 'int8'); setLowRam(v.low_ram ?? 'auto'); }}/><Btn icon="models" onClick={() => setManage(true)}>{tr("Manage models")}</Btn></span></div>
<div className="native-version"><VersionPicker pick={native?.catalog?.recommendation} versions={allSizes} selectedId={selectedSize.id} hardware={fitHardware} downloaded={readyIds} onSelect={id => { const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/></div>
{tr(noFit ? <p className="small muted native-spill-note"><Icon name="disk" size={16}/>{tr("May run slower \u00B7 Model data can be read from SSD.")}</p> : null)}
+ {tr(selectedSize?.multi_file && deepseekContextNote(context) ? <p className="small muted native-spill-note"><Icon name="info" size={16}/>{tr(deepseekContextNote(context))}</p> : null)}
<div className="native-choice__row">
- <div className="native-choice__col"><span className="native-choice__label">{tr("Conversation context")}</span><Select ariaLabel={tr("Conversation context")} value={String(context)} options={contextChoices(native?.catalog?.contexts ?? [8192, 32768, 65536, 131072, 262144], context).map(n => ({ value: String(n), label: n % 1024 === 0 ? `${n / 1024}K` : `${n.toLocaleString()} tokens` }))} onChange={n => setContext(Number(n))}/></div>
+ <div className="native-choice__col"><span className="native-choice__label">{tr("Conversation context")}</span><Select ariaLabel={tr("Conversation context")} value={String(context)} options={contextChoices(selectedSize?.multi_file ? deepseekContexts(installed?.contextMax) : native?.catalog?.contexts ?? [8192, 32768, 65536, 131072, 262144], context).map(n => ({ value: String(n), label: n % 1024 === 0 ? `${n / 1024}K` : `${n.toLocaleString()} tokens` }))} onChange={n => setContext(Number(n))}/></div>
{tr(draftingChoices ? <div className="native-choice__col"><span className="native-choice__label">{tr("Drafting")}</span><Select ariaLabel={tr("Drafting")} value={drafting} disabled={!!active} options={draftingChoices.map(v => ({ value: v, label: tr(draftingWords[v]) }))} onChange={v => setDrafting(String(v))}/></div> : null)}
<div className="native-choice__col"><span className="native-choice__label">{tr("Computer use")}</span><div className="native-resource-choice"><button aria-pressed={resourceProfile === 'work'} data-selected={resourceProfile === 'work'} onClick={() => setResourceProfile('work')}><Icon name="computer" size={20}/><span><strong>{tr("Leave 20% for my work")}</strong><small>{tr("Headroom for your other apps")}</small></span>{tr(resourceProfile === 'work' ? <Icon name="check" size={15}/> : null)}</button><button aria-pressed={resourceProfile === 'performance'} data-selected={resourceProfile === 'performance'} onClick={() => setResourceProfile('performance')}><Icon name="bolt" size={20}/><span><strong>{tr("Full performance")}</strong><small>{tr("Give Strata priority")}</small></span>{tr(resourceProfile === 'performance' ? <Icon name="check" size={15}/> : null)}</button></div></div>
</div>
diff --git a/apps/host/src/lib/deepseek-context.ts b/apps/host/src/lib/deepseek-context.ts
new file mode 100644
index 000000000..e25a599f9
--- /dev/null
+++ b/apps/host/src/lib/deepseek-context.ts
@@ -0,0 +1,27 @@
+/**
+ * DeepSeek-V4.1-Flash's context sizes in the app: 8K up to the pack's own limit (the model reads 1,048,576 positions natively).
+ * Project Maya v1.1.28 (#442, @needmorevram, MIT) offered 512K and 1M the same way. strata_control/dsv41_context.py says the same for setup and the
+ * Terminal (tests/terminal/test_dsv41_context.py compares the two). The engine takes whatever --max-context it is given; the rope settings come from the pack.
+ */
+export const CONTEXT_CHOICES = [8192, 32768, 65536, 131072, 262144, 524288, 1048576];
+/** The largest size not flagged as untested; also how far the list goes while the pack does not say more (a pack without ds4.txt behaves as before). */
+export const TESTED_CONTEXT = 262144;
+/** The model's own length: the most any pack can say. */
+export const NATIVE_CONTEXT = 1048576;
+export const UNTESTED_NOTE = 'Not tested yet. A context this long takes graphics memory from the model and reads long prompts slowly.';
+
+/** The sizes to offer: up to the pack's limit (`contextMax`, from its ds4.txt) when the installed model has one, else up to 256K. */
+export function deepseekContexts(limit?: number | null): number[] {
+ const cap = typeof limit === 'number' && Number.isFinite(limit) && limit > 0 ? limit : TESTED_CONTEXT;
+ return CONTEXT_CHOICES.filter(size => size <= cap);
+}
+
+/** An empty string when the size can run; otherwise one sentence (only a size the model cannot address is refused). */
+export function deepseekContextProblem(context: number, limit?: number | null): string {
+ const cap = typeof limit === 'number' && Number.isFinite(limit) && limit > 0 ? limit : NATIVE_CONTEXT;
+ if (!Number.isInteger(context) || context < 1024) return 'Choose a context of at least 1,024 tokens.';
+ return context > cap ? `A context past ${cap.toLocaleString('en-US')} tokens is more than this model reads.` : '';
+}
+
+/** The plain words past 256K, an empty string otherwise. */
+export const deepseekContextNote = (context: number): string => (context > TESTED_CONTEXT ? UNTESTED_NOTE : '');
diff --git a/apps/host/src/lib/native.ts b/apps/host/src/lib/native.ts
index b53aec0b8..e6e64bbf4 100644
--- a/apps/host/src/lib/native.ts
+++ b/apps/host/src/lib/native.ts
@@ -12,7 +12,7 @@ export interface NativeState {
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
/** Strata Control's view of the engine for this computer (the app): usable false = none found or recognised; `notice` says why in plain words. */
engine?:{usable:boolean;notice?:string|null;wrongMake?:boolean;version?:string|null};
- visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
+ visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;/** Free bytes on the drive that holds the models folder. */downloadFreeBytes?:number|null;downloadTotalBytes?:number|null;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';/** The Drafting choice saved with the model: auto | mtp | dflash2 | off. */drafting?:string;/** DeepSeek: the most context its pack reads (max_position_embeddings in the pack's ds4.txt); absent when the pack does not say. */contextMax?:number;dataFolder?:string;diskGb?:number;diskBytes?:number;/** Files this model shares with another (the picture reader, the draft layer): counted once, in `usage`. */sharedBytes?:number;/** What Delete frees: files in Strata's own folders that no other model uses. */removableGb?:number;missing_files?:string[]}[];/** What all models take on disk, from their real files, shared files counted once. */usage?:{total_bytes:number;total_gb:number;shared_bytes:number;shared_gb:number;models:Record<string,{bytes:number;gb:number}>}|null;data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;engine_vendor?:string;gpus:{index:number;name:string;vram_gb:number;usable:boolean;/** SMs x clock: only the order between cards matters (strata_control/gpu_roles.py). */speed?:number;vendor?:string;uma?:boolean;integrated?:boolean;unified_gb?:number;problem?:string|null}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{/** The engine serves DFlash2 (Control says): the Drafting choice then offers it. */dflash2?:boolean;responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
let state:NativeState|null=null;
const listeners=new Set<()=>void>();
/** True once the first read of the native state has ended, whatever its answer: until then the Models page must not pick a model of its own (#3740). */
diff --git a/apps/host/src/locales/fix-de.json b/apps/host/src/locales/fix-de.json
index a650fd294..be8bc8e74 100644
--- a/apps/host/src/locales/fix-de.json
+++ b/apps/host/src/locales/fix-de.json
@@ -75,5 +75,6 @@
"fx74": "Verteilt die Arbeit so zwischen Grafikkarte und Prozessor, dass Antworten auf diesen Karten schneller werden. Ausschalten stellt die vorherige, langsamere Einstellung wieder her.",
"fx75": "Liest lange Prompts schneller und lädt die benötigten Teile des Modells schneller. Schalten Sie die Option aus, wenn DeepSeek nicht mehr funktioniert oder die Antworten falsch aussehen; dann läuft es wie in Version 0.2.6.",
"fx76": "Ein (empfohlen)",
- "fx77": "Das ist ein sehr großes Modell. Der Download umfasst {0} GB und braucht etwa so viel freien Speicherplatz. Es läuft auf NVIDIA-RTX-Karten der Serien 30, 40 und 50, auf einer Radeon AI PRO R9700 (Linux) oder auf einem Ryzen-AI-Max-/Strix-Halo-PC (Windows); wie schnell es ist, hängt von Speicher und Grafikkarte ab (die Zeile darunter sagt, was auf diesem Computer zu erwarten ist). Was nicht in den Speicher passt, wird von deiner SSD gelesen, deshalb zählt eine NVMe-SSD."
+ "fx77": "Das ist ein sehr großes Modell. Der Download umfasst {0} GB und braucht etwa so viel freien Speicherplatz. Es läuft auf NVIDIA-RTX-Karten der Serien 30, 40 und 50, auf einer Radeon AI PRO R9700 (Linux) oder auf einem Ryzen-AI-Max-/Strix-Halo-PC (Windows); wie schnell es ist, hängt von Speicher und Grafikkarte ab (die Zeile darunter sagt, was auf diesem Computer zu erwarten ist). Was nicht in den Speicher passt, wird von deiner SSD gelesen, deshalb zählt eine NVMe-SSD.",
+ "fx78": "Noch nicht getestet. Ein so langer Kontext nimmt dem Modell Grafikspeicher weg, und lange Prompts werden langsam gelesen."
}
diff --git a/apps/host/src/locales/fix-en.json b/apps/host/src/locales/fix-en.json
index 486d102ba..4f498f9c9 100644
--- a/apps/host/src/locales/fix-en.json
+++ b/apps/host/src/locales/fix-en.json
@@ -75,5 +75,6 @@
"fx74": "Shares the work between the graphics card and the processor in a way that makes answers faster on these cards. Turn off to go back to the previous setting, which is slower.",
"fx75": "Reads long prompts faster and loads the parts of the model it needs faster. Turn off if DeepSeek stops working or its answers look wrong; it then runs as in version 0.2.6.",
"fx76": "On (recommended)",
- "fx77": "This is a very large model. The download is {0} GB and it needs about as much free disk space. It runs on NVIDIA RTX 30, 40 and 50 cards, on a Radeon AI PRO R9700 (Linux) or on a Ryzen AI Max / Strix Halo PC (Windows); how fast it is depends on the memory and card (the line below says what to expect on this computer). What does not fit in memory is read from your SSD, so an NVMe drive matters."
+ "fx77": "This is a very large model. The download is {0} GB and it needs about as much free disk space. It runs on NVIDIA RTX 30, 40 and 50 cards, on a Radeon AI PRO R9700 (Linux) or on a Ryzen AI Max / Strix Halo PC (Windows); how fast it is depends on the memory and card (the line below says what to expect on this computer). What does not fit in memory is read from your SSD, so an NVMe drive matters.",
+ "fx78": "Not tested yet. A context this long takes graphics memory from the model and reads long prompts slowly."
}
diff --git a/apps/host/src/locales/fix-es.json b/apps/host/src/locales/fix-es.json
index 53da186c0..2d64de50a 100644
--- a/apps/host/src/locales/fix-es.json
+++ b/apps/host/src/locales/fix-es.json
@@ -75,5 +75,6 @@
"fx74": "Reparte el trabajo entre la tarjeta gráfica y el procesador de una forma que acelera las respuestas en estas tarjetas. Si lo desactivas, vuelve el ajuste anterior, que es más lento.",
"fx75": "Lee los prompts largos más rápido y carga más rápido las partes del modelo que necesita. Desactívalo si DeepSeek deja de funcionar o sus respuestas parecen incorrectas; entonces funciona como en la versión 0.2.6.",
"fx76": "Activado (recomendado)",
- "fx77": "Es un modelo muy grande. La descarga es de {0} GB y necesita casi el mismo espacio libre en disco. Funciona con tarjetas NVIDIA RTX de las series 30, 40 y 50, con una Radeon AI PRO R9700 (Linux) o en un PC con Ryzen AI Max / Strix Halo (Windows); su velocidad depende de la memoria y de la tarjeta (la línea de abajo indica qué esperar en este equipo). Lo que no cabe en memoria se lee de tu SSD, así que importa que sea NVMe."
+ "fx77": "Es un modelo muy grande. La descarga es de {0} GB y necesita casi el mismo espacio libre en disco. Funciona con tarjetas NVIDIA RTX de las series 30, 40 y 50, con una Radeon AI PRO R9700 (Linux) o en un PC con Ryzen AI Max / Strix Halo (Windows); su velocidad depende de la memoria y de la tarjeta (la línea de abajo indica qué esperar en este equipo). Lo que no cabe en memoria se lee de tu SSD, así que importa que sea NVMe.",
+ "fx78": "Aún sin probar. Un contexto tan largo le quita memoria gráfica al modelo y lee los prompts largos con lentitud."
}
diff --git a/apps/host/src/locales/fix-ja.json b/apps/host/src/locales/fix-ja.json
index 47bdbf7a1..f29d4dce5 100644
--- a/apps/host/src/locales/fix-ja.json
+++ b/apps/host/src/locales/fix-ja.json
@@ -75,5 +75,6 @@
"fx74": "これらのグラフィックスカードで応答が速くなるよう、グラフィックスカードとプロセッサーの間で作業を分担します。オフにすると、以前の(より遅い)設定に戻ります。",
"fx75": "長いプロンプトと、必要なモデルの部分をより速く読み込みます。DeepSeek が動かなくなったり、回答がおかしいと感じたりしたらオフにしてください。バージョン 0.2.6 と同じ動作になります。",
"fx76": "オン(推奨)",
- "fx77": "とても大きなモデルです。ダウンロードは {0} GB で、ほぼ同じ大きさの空き容量が必要です。NVIDIA RTX 30・40・50 シリーズ、Radeon AI PRO R9700(Linux)、または Ryzen AI Max / Strix Halo の PC(Windows)で動きます。速さはメモリとカードによって変わります(この PC での目安は下の行に表示されます)。メモリに入らない分は SSD から読むため、NVMe ドライブが重要です。"
+ "fx77": "とても大きなモデルです。ダウンロードは {0} GB で、ほぼ同じ大きさの空き容量が必要です。NVIDIA RTX 30・40・50 シリーズ、Radeon AI PRO R9700(Linux)、または Ryzen AI Max / Strix Halo の PC(Windows)で動きます。速さはメモリとカードによって変わります(この PC での目安は下の行に表示されます)。メモリに入らない分は SSD から読むため、NVMe ドライブが重要です。",
+ "fx78": "まだテストされていません。これほど長いコンテキストは、モデルが使うグラフィックスメモリを消費し、長いプロンプトの読み込みも遅くなります。"
}
diff --git a/apps/host/src/locales/fix-ko.json b/apps/host/src/locales/fix-ko.json
index 5b261dcf8..5924193c6 100644
--- a/apps/host/src/locales/fix-ko.json
+++ b/apps/host/src/locales/fix-ko.json
@@ -75,5 +75,6 @@
"fx74": "이 그래픽 카드에서 응답이 빨라지도록 그래픽 카드와 프로세서가 작업을 나눕니다. 끄면 이전의 더 느린 설정으로 돌아갑니다.",
"fx75": "긴 프롬프트와 필요한 모델 부분을 더 빠르게 읽고 불러옵니다. DeepSeek가 멈추거나 답변이 이상해 보이면 끄세요. 그러면 0.2.6 버전처럼 동작합니다.",
"fx76": "켬(권장)",
- "fx77": "매우 큰 모델입니다. 다운로드는 {0}GB이고, 거의 같은 크기의 여유 디스크 공간이 필요합니다. NVIDIA RTX 30·40·50 시리즈 카드, Radeon AI PRO R9700(Linux), 또는 Ryzen AI Max / Strix Halo PC(Windows)에서 실행됩니다. 속도는 메모리와 카드에 따라 달라집니다(아래 줄에 이 컴퓨터에서 기대할 수 있는 속도가 표시됩니다). 메모리에 들어가지 않는 부분은 SSD에서 읽으므로 NVMe 드라이브가 중요합니다."
+ "fx77": "매우 큰 모델입니다. 다운로드는 {0}GB이고, 거의 같은 크기의 여유 디스크 공간이 필요합니다. NVIDIA RTX 30·40·50 시리즈 카드, Radeon AI PRO R9700(Linux), 또는 Ryzen AI Max / Strix Halo PC(Windows)에서 실행됩니다. 속도는 메모리와 카드에 따라 달라집니다(아래 줄에 이 컴퓨터에서 기대할 수 있는 속도가 표시됩니다). 메모리에 들어가지 않는 부분은 SSD에서 읽으므로 NVMe 드라이브가 중요합니다.",
+ "fx78": "아직 테스트하지 않았습니다. 이렇게 긴 컨텍스트는 모델이 쓸 그래픽 메모리를 차지하고, 긴 프롬프트를 느리게 읽습니다."
}
diff --git a/apps/host/src/locales/fix-pt.json b/apps/host/src/locales/fix-pt.json
index f36329c4c..2d1b40680 100644
--- a/apps/host/src/locales/fix-pt.json
+++ b/apps/host/src/locales/fix-pt.json
@@ -75,5 +75,6 @@
"fx74": "Divide o trabalho entre a placa de vídeo e o processador de um jeito que deixa as respostas mais rápidas nessas placas. Ao desativar, volta a configuração anterior, que é mais lenta.",
"fx75": "Lê prompts longos mais rápido e carrega mais rápido as partes do modelo de que precisa. Desative se o DeepSeek parar de funcionar ou as respostas parecerem erradas; ele passa a funcionar como na versão 0.2.6.",
"fx76": "Ativado (recomendado)",
- "fx77": "Este é um modelo muito grande. O download tem {0} GB e precisa de quase o mesmo espaço livre em disco. Ele roda em placas NVIDIA RTX das séries 30, 40 e 50, em uma Radeon AI PRO R9700 (Linux) ou em um PC com Ryzen AI Max / Strix Halo (Windows); a velocidade depende da memória e da placa (a linha abaixo diz o que esperar neste computador). O que não cabe na memória é lido do seu SSD, então um NVMe faz diferença."
+ "fx77": "Este é um modelo muito grande. O download tem {0} GB e precisa de quase o mesmo espaço livre em disco. Ele roda em placas NVIDIA RTX das séries 30, 40 e 50, em uma Radeon AI PRO R9700 (Linux) ou em um PC com Ryzen AI Max / Strix Halo (Windows); a velocidade depende da memória e da placa (a linha abaixo diz o que esperar neste computador). O que não cabe na memória é lido do seu SSD, então um NVMe faz diferença.",
+ "fx78": "Ainda não testado. Um contexto tão longo tira memória gráfica do modelo e lê prompts longos devagar."
}
diff --git a/apps/host/src/locales/fix-ru.json b/apps/host/src/locales/fix-ru.json
index b366feeee..1cc6e7eb9 100644
--- a/apps/host/src/locales/fix-ru.json
+++ b/apps/host/src/locales/fix-ru.json
@@ -75,5 +75,6 @@
"fx74": "Распределяет работу между видеокартой и процессором так, что ответы на этих видеокартах получаются быстрее. Если отключить, вернётся прежняя, более медленная настройка.",
"fx75": "Быстрее читает длинные запросы и быстрее загружает нужные части модели. Отключите, если DeepSeek перестаёт работать или его ответы выглядят неверными; тогда он работает как в версии 0.2.6.",
"fx76": "Вкл. (рекомендуется)",
- "fx77": "Это очень большая модель. Загрузка — {0} ГБ, и нужно почти столько же свободного места на диске. Она работает на видеокартах NVIDIA RTX серий 30, 40 и 50, на Radeon AI PRO R9700 (Linux) или на ПК с Ryzen AI Max / Strix Halo (Windows); скорость зависит от памяти и видеокарты (строка ниже подскажет, чего ждать на этом компьютере). То, что не помещается в память, читается с вашего SSD, поэтому важен накопитель NVMe."
+ "fx77": "Это очень большая модель. Загрузка — {0} ГБ, и нужно почти столько же свободного места на диске. Она работает на видеокартах NVIDIA RTX серий 30, 40 и 50, на Radeon AI PRO R9700 (Linux) или на ПК с Ryzen AI Max / Strix Halo (Windows); скорость зависит от памяти и видеокарты (строка ниже подскажет, чего ждать на этом компьютере). То, что не помещается в память, читается с вашего SSD, поэтому важен накопитель NVMe.",
+ "fx78": "Ещё не проверено. Такой длинный контекст отнимает у модели видеопамять, а длинные запросы читаются медленно."
}
diff --git a/apps/host/src/locales/fix-zh.json b/apps/host/src/locales/fix-zh.json
index bfd854779..16f90879a 100644
--- a/apps/host/src/locales/fix-zh.json
+++ b/apps/host/src/locales/fix-zh.json
@@ -75,5 +75,6 @@
"fx74": "以更适合这些显卡的方式在显卡和处理器之间分配工作,使回答更快。关闭后恢复到之前较慢的设置。",
"fx75": "更快读取长提示词,并更快加载所需的模型部分。如果 DeepSeek 无法运行或回答看起来不对,请关闭;关闭后它将像 0.2.6 版本那样运行。",
"fx76": "开启(推荐)",
- "fx77": "这是一个非常大的模型。下载大小为 {0} GB,需要差不多同样大小的可用磁盘空间。它可在 NVIDIA RTX 30、40 和 50 系列显卡、Radeon AI PRO R9700(Linux)或 Ryzen AI Max / Strix Halo 电脑(Windows)上运行;速度取决于内存和显卡(下面一行会说明在这台电脑上的预期)。内存放不下的部分会从你的 SSD 读取,所以 NVMe 硬盘很重要。"
+ "fx77": "这是一个非常大的模型。下载大小为 {0} GB,需要差不多同样大小的可用磁盘空间。它可在 NVIDIA RTX 30、40 和 50 系列显卡、Radeon AI PRO R9700(Linux)或 Ryzen AI Max / Strix Halo 电脑(Windows)上运行;速度取决于内存和显卡(下面一行会说明在这台电脑上的预期)。内存放不下的部分会从你的 SSD 读取,所以 NVMe 硬盘很重要。",
+ "fx78": "尚未测试。这么长的上下文会占用本该给模型使用的显存,读取长提示词也会很慢。"
}
diff --git a/apps/host/tests/deepseek-context.test.mjs b/apps/host/tests/deepseek-context.test.mjs
new file mode 100644
index 000000000..598c872f7
--- /dev/null
+++ b/apps/host/tests/deepseek-context.test.mjs
@@ -0,0 +1,97 @@
+// DeepSeek-V4.1-Flash's context sizes in the app, 8K up to the pack's own limit (Project Maya #442 by @needmorevram did the same in its dashboard).
+// The pack's limit is `max_position_embeddings` in its ds4.txt; a pack without it behaves as before (up to 256K). Past 256K the row says it is untested.
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { build } from 'esbuild';
+import { mkdtempSync, writeFileSync, rmSync, readFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { join } from 'node:path';
+import { fileURLToPath } from 'node:url';
+import { packContextLimit, configContextLimit } from '../server/dsv41-context.mjs';
+import { nativeFixture } from './helpers/native-fixture.mjs';
+
+const read = rel => readFileSync(fileURLToPath(new URL(rel, import.meta.url)), 'utf8').replace(/\r\n/g, '\n');
+const out = await build({ entryPoints: [fileURLToPath(new URL('../src/lib/deepseek-context.ts', import.meta.url))], bundle: true, format: 'esm', platform: 'node', write: false, logLevel: 'silent' });
+const { CONTEXT_CHOICES, TESTED_CONTEXT, NATIVE_CONTEXT, UNTESTED_NOTE, deepseekContexts, deepseekContextProblem, deepseekContextNote } = await import(`data:text/javascript;base64,${Buffer.from(out.outputFiles[0].text).toString('base64')}`);
+
+function pack(line) {
+ const dir = mkdtempSync(join(tmpdir(), 'strata-ds4-pack-'));
+ writeFileSync(join(dir, 'ds4.txt'), `vocab_size 129280\n${line ? line + '\n' : ''}num_hidden_layers 43\n`);
+ return dir;
+}
+
+test('the choices go up to the pack\'s limit: 1M for the official pack, less for a pack that says less, 256K while nothing says', () => {
+ assert.deepEqual(CONTEXT_CHOICES, [8192, 32768, 65536, 131072, 262144, 524288, 1048576]);
+ assert.deepEqual(deepseekContexts(1048576), CONTEXT_CHOICES);
+ assert.deepEqual(deepseekContexts(524288), [8192, 32768, 65536, 131072, 262144, 524288]);
+ assert.deepEqual(deepseekContexts(262144), [8192, 32768, 65536, 131072, 262144]);
+ assert.deepEqual(deepseekContexts(null), [8192, 32768, 65536, 131072, 262144], 'a pack without ds4.txt behaves as before');
+ assert.deepEqual(deepseekContexts(undefined), deepseekContexts(null));
+});
+
+test('one million is accepted and two million refused; the pack\'s limit is the last word', () => {
+ assert.equal(deepseekContextProblem(1048576), '');
+ assert.equal(deepseekContextProblem(524288), '');
+ assert.match(deepseekContextProblem(2097152), /more than this model reads/);
+ assert.notEqual(deepseekContextProblem(1048577), '');
+ assert.notEqual(deepseekContextProblem(524288, 262144), '');
+ assert.equal(deepseekContextProblem(262144, 262144), '');
+ assert.notEqual(deepseekContextProblem(100), '');
+});
+
+test('past 256K the row says what it costs and that it is untested; 256K and below say nothing', () => {
+ assert.equal(TESTED_CONTEXT, 262144);
+ assert.equal(NATIVE_CONTEXT, 1048576);
+ assert.equal(deepseekContextNote(262144), '');
+ assert.equal(deepseekContextNote(8192), '');
+ assert.equal(deepseekContextNote(524288), UNTESTED_NOTE);
+ assert.equal(deepseekContextNote(1048576), 'Not tested yet. A context this long takes graphics memory from the model and reads long prompts slowly.');
+});
+
+test('the pack\'s limit is read from ds4.txt, and a config names its pack with --pack', () => {
+ const full = pack('max_position_embeddings 1048576'), small = pack('max_position_embeddings 262144'), none = pack(null);
+ try {
+ assert.equal(packContextLimit(full), 1048576);
+ assert.equal(packContextLimit(small), 262144);
+ assert.equal(packContextLimit(none), null);
+ assert.equal(packContextLimit(join(full, 'nowhere')), null);
+ assert.equal(packContextLimit(null), null);
+ assert.equal(configContextLimit({ args: ['--pack', small, '--max-context', '8192'] }), 262144);
+ assert.equal(configContextLimit({ args: ['--native', 'm.gguf'] }), null, 'a Qwen model has no pack');
+ assert.equal(configContextLimit({}), null);
+ } finally { for (const d of [full, small, none]) rmSync(d, { recursive: true, force: true }); }
+});
+
+test('through the host: an installed DeepSeek model reports its pack\'s limit, a Qwen model none', async () => {
+ const f = nativeFixture();
+ try {
+ const dir = pack('max_position_embeddings 1048576');
+ const p = join(f.repo, 'strata-iq3_s.json');
+ writeFileSync(p, JSON.stringify({ ...JSON.parse(readFileSync(p, 'utf8')), arch: 'deepseek41', args: ['--pack', dir, '--max-context', '8192'] }));
+ await f.control.refresh();
+ const models = f.control.state().installed?.models ?? [];
+ const byId = Object.fromEntries(models.map(m => [m.model, m]));
+ assert.equal(byId.iq3_s?.contextMax, 1048576);
+ assert.equal(byId.iq2_xs?.contextMax, undefined);
+ rmSync(dir, { recursive: true, force: true });
+ } finally { await f.cleanup(); }
+});
+
+test('the Models screen honours the choice (it no longer forces 8K), offers the DeepSeek list, and shows the note on the existing note markup', () => {
+ const screen = read('../src/components/NativeModels.tsx');
+ assert.doesNotMatch(screen, /multi_file \? 8192 : context/, 'the chosen context is what is installed and loaded');
+ assert.match(screen, /contextChoices\(selectedSize\?\.multi_file \? deepseekContexts\(installed\?\.contextMax\) : native\?\.catalog\?\.contexts \?\? \[8192, 32768, 65536, 131072, 262144\], context\)/);
+ assert.match(screen, /selectedSize\?\.multi_file && deepseekContextNote\(context\) \? <p className="small muted native-spill-note"><Icon name="info" size=\{16\}\/>\{tr\(deepseekContextNote\(context\)\)\}<\/p> : null/);
+ assert.match(screen, /if \(selectedSize\.multi_file\)\s+setContext\(8192\)/, 'the default for a DeepSeek version that is not installed stays 8K');
+});
+
+test('the note is in the catalog in all eight languages, translated', () => {
+ const find = lang => Object.values(JSON.parse(read(`../src/locales/fix-${lang}.json`)));
+ assert.ok(find('en').includes(UNTESTED_NOTE));
+ const en = JSON.parse(read('../src/locales/fix-en.json'));
+ const id = Object.keys(en).find(k => en[k] === UNTESTED_NOTE);
+ for (const lang of ['zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko']) {
+ const text = JSON.parse(read(`../src/locales/fix-${lang}.json`))[id];
+ assert.ok(text && text !== UNTESTED_NOTE, `${lang} is translated`);
+ }
+});