Repository navigation
Speed up Inkling 2 and MoE decode on small-VRAM GPUs - #74
Conversation
Inkling 2 aborted a decode step when a routed expert could not be staged into VRAM (the default 0.90 GPU fraction left no room on a 4 GB card). It now falls back to host experts for that layer, and picks a 0.60 fraction on small cards while keeping 0.90 on large ones. Host experts of a layer are computed in one Rayon pass through the new shared matvec_many_cpu helper. Suffix speculative decoding is now the CLI default. Drafts are verified, so greedy output is unchanged; acceptance was 100% on both models available here. Benchmarks (RTX 3050 Laptop 4 GB, release): - Inkling 2 Mini, pp512/tg64: upstream panicked; 8.6 tok/s after the fix; 16.3 tok/s with suffix drafts (112/112 accepted). - Tiel 35B A3B, pp128/tg16: 16.1 -> 26.7 tok/s with suffix drafts (24/24 accepted). Zero-temp generation with and without suffix drafts was checked; outputs are equivalent (Inkling 2 differs once at token 48, consistent with its adaptive expert split) and the Tiel suffix output is more coherent. Experiments reverted: parallel routing, prefetch-on-by-default, and global adaptive GPU fraction (each regressed at least one model). Docs: docs/PERFORMANCE.md, docs/USAGE.md. Co-authored-by: HY4-Flash <hy4-flash@users.noreply.github.com>
🔍 Aletheore evidence diffgraph LR
n0["mat.rs"]
n1["chat.rs"]
n2["src/inkling2/forward.rs"]
n3["src/inkling2/mod.rs"]
n4["config.rs"]
n5["src/deepseek/forward.rs"]
n6["src/deepseek/mod.rs"]
n7["src/gemma4/forward.rs"]
n8["src/glm/forward.rs"]
n9["src/hy4/forward.rs"]
n10["dspark.rs"]
n11["lib.rs"]
n12["inkling2_forward.rs"]
n13["quant.rs"]
n14["vision.rs"]
n0 --> n5
n0 --> n6
n0 --> n7
n0 --> n8
n0 --> n9
n0 --> n10
n0 --> n13
n1 --> n12
n1 --> n14
n2 --> n10
n2 --> n14
n3 --> n4
n3 --> n11
classDef changed fill:#d9772c,color:#fff,stroke:#b85f1c;
classDef changedFinding fill:#c0392b,color:#fff,stroke:#922b21;
classDef dependent fill:#f2f0ec,color:#18140f,stroke:#d6d0c5;
class n0 changed
class n1 changed
class n2 changed
class n3 changed
class n4 dependent
class n5 dependent
class n6 dependent
class n7 dependent
class n8 dependent
class n9 dependent
class n10 dependent
class n11 dependent
class n12 dependent
class n13 dependent
class n14 dependent
What changed
Aggregate deltas
|
| if std::env::var_os("STRATA_DS_GPU_FRACTION").is_some() { return; } | ||
| let kind = std::env::var("STRATA_DS_BACKEND").ok(); | ||
| let total = crate::backend::open(kind.as_deref(), 0).ok() | ||
| .and_then(|b| b.mem_info().ok().map(|(_, t)| t)).unwrap_or(0); |
There was a problem hiding this comment.
🟠 High · Correctness · 1 of 10
Fraction is chosen from total VRAM, but the comment and docs say free VRAM mem_info returns (free, total) and the code keeps total. On a 6 GB card that is partly used by the desktop, the code picks 0.60 based on total, while the documented rule (free VRAM below 8 GB) would give a different answer. The comment and USAGE.md describe a rule the code does not implement.
Prompt for your AI agent
File: src/inkling2/mod.rs
Line: 18
Issue: Fraction is chosen from total VRAM, but the comment and docs say free VRAM mem_info returns (free, total) and the code keeps total. On a 6 GB card that is partly used by the desktop, the code picks 0.60 based on total, while the documented rule (free VRAM below 8 GB) would give a different answer. The comment and USAGE.md describe a rule the code does not implement.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| let kind = std::env::var("STRATA_DS_BACKEND").ok(); | ||
| let total = crate::backend::open(kind.as_deref(), 0).ok() | ||
| .and_then(|b| b.mem_info().ok().map(|(_, t)| t)).unwrap_or(0); | ||
| let frac = if total < 8 << 30 { "0.60" } else { "0.90" }; |
There was a problem hiding this comment.
🟠 High · Correctness · 2 of 10
Failed backend open or mem query silently selects 0.60 fraction unwrap_or(0) turns any failure to open the backend or query memory into total=0, which is below 8 GB, so 0.60 is chosen. On a 12 GB card where the query fails (driver issue, wrong STRATA_DS_BACKEND), decode silently drops to the host-fallback regime the PR is meant to avoid, with no warning.
Prompt for your AI agent
File: src/inkling2/mod.rs
Line: 19
Issue: Failed backend open or mem query silently selects 0.60 fraction unwrap_or(0) turns any failure to open the backend or query memory into total=0, which is below 8 GB, so 0.60 is chosen. On a 12 GB card where the query fails (driver issue, wrong STRATA_DS_BACKEND), decode silently drops to the host-fallback regime the PR is meant to avoid, with no warning.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| pub fn gpu_fraction_default() { | ||
| if std::env::var_os("STRATA_DS_GPU_FRACTION").is_some() { return; } | ||
| let kind = std::env::var("STRATA_DS_BACKEND").ok(); | ||
| let total = crate::backend::open(kind.as_deref(), 0).ok() |
There was a problem hiding this comment.
🔵 Low · Performance · 3 of 10
Opens a full backend just to read memory, and this runs 3 times gpu_fraction_default is called from chat.rs, from new_with_ctx in forward.rs, and via gpu_defaults. Each call opens a backend (likely creating a CUDA context) to read one number. Startup pays that cost repeatedly, and the value is only needed once because the env var is then set.
Prompt for your AI agent
File: src/inkling2/mod.rs
Line: 17
Symbol: is_arch
Issue: Opens a full backend just to read memory, and this runs 3 times gpu_fraction_default is called from chat.rs, from new_with_ctx in forward.rs, and via gpu_defaults. Each call opens a backend (likely creating a CUDA context) to read one number. Startup pays that cost repeatedly, and the value is only needed once because the env var is then set.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| } | ||
|
|
||
| /// Host integer dot of several matrices, one activation each, in a single Rayon pass. The activations are | ||
| /// quantised once and every weight row is read once; callers with many small expert matrices avoid one parallel |
There was a problem hiding this comment.
🔵 Low · Performance · 4 of 10
Doc says activations are quantised once, but code quantises each copy run_experts passes gx = vec![x; n], so the same activation is quantised n_expert times in xs.par_iter(). The doc comment promises 'quantised once', which is false, and each layer repeats the quantisation work that the batching was supposed to remove.
Prompt for your AI agent
File: src/deepseek/mat.rs
Line: 477
Symbol: matvec_many_opt
Issue: Doc says activations are quantised once, but code quantises each copy run_experts passes gx = vec![x; n], so the same activation is quantised n_expert times in xs.par_iter(). The doc comment promises 'quantised once', which is false, and each layer repeats the quantisation work that the batching was supposed to remove.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| } | ||
| None => { | ||
| // No room to stage a routed weight: finish this layer's experts on the host and write the | ||
| // weighted sum straight into `s.acc`. The conv and residual stay on the device. |
There was a problem hiding this comment.
🔵 Low · Performance · 5 of 10
CPU experts computed in cpu_side are thrown away and recomputed cpu_side already computes on_cpu experts, and on the None path its result is discarded. experts_all_cpu then recomputes every routed expert on the host, including those already done. Each token on a small card does the host expert matmuls twice, which costs the speed-up this PR claims. The fast path in run_experts also falls through to a second full computation if the down-projection returns None.
Prompt for your AI agent
File: src/inkling2/forward/device.rs
Line: 1412
Symbol: layer
Issue: CPU experts computed in cpu_side are thrown away and recomputed cpu_side already computes on_cpu experts, and on the None path its result is discarded. experts_all_cpu then recomputes every routed expert on the host, including those already done. Each token on a small card does the host expert matmuls twice, which costs the speed-up this PR claims. The fast path in run_experts also falls through to a second full computation if the down-projection returns None.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| be.put(&y, &self.scr, ((s.acc - o) / 4) as usize).expect("inkling2 device step"); | ||
| } | ||
| } | ||
| (|| -> Result<()> { |
There was a problem hiding this comment.
🟡 Medium · Correctness · 6 of 10
Fallback put overwrites s.acc, possibly dropping the residual sum The original path calls ink_ffn_sum(s.acc, ...), which likely accumulates the expert sum into the residual stream in s.acc. The new fallback writes y into s.acc with be.put, so any residual already in s.acc is overwritten. Numerics then drift on small-card layers, which the doc's 'small logit shift' note could hide.
Prompt for your AI agent
File: src/inkling2/forward/device.rs
Line: 1418
Symbol: layer
Issue: Fallback put overwrites s.acc, possibly dropping the residual sum The original path calls ink_ffn_sum(s.acc, ...), which likely accumulates the expert sum into the residual stream in s.acc. The new fallback writes y into s.acc with be.put, so any residual already in s.acc is overwritten. Numerics then drift on small-card layers, which the doc's 'small logit shift' note could hide.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| @@ -0,0 +1,51 @@ | |||
| # Inference performance notes | |||
|
|
|||
| Measured on an RTX 3050 Laptop (4 GB VRAM), Ryzen 7 7445HS, release build with `-C target-cpu=native`. | |||
There was a problem hiding this comment.
🔵 Low · Maintainability · 7 of 10
Doc says greedy output preserved, yet its own results show it changed The header states that greedy output is preserved. The same document reports that Inkling 2 output differs at token 45 because of the host-fallback logit shift. Users relying on the header will treat the fallback path as bit-stable when it is not.
Prompt for your AI agent
File: docs/PERFORMANCE.md
Line: 3
Issue: Doc says greedy output preserved, yet its own results show it changed The header states that greedy output is preserved. The same document reports that Inkling 2 output differs at token 45 because of the host-fallback logit shift. Users relying on the header will treat the fallback path as bit-stable when it is not.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| doubles decode throughput (9.5 → 16.3 tok/s at 512-token prefill). Adding the DSpark `--draft-model` on top is | ||
| not worth it: its drafts drop acceptance to 89% and decode fell to 15.7 tok/s in the same test. | ||
| - Generic MoE models (e.g. 35B-A3B) benefit from the same suffix default: measured 29 → 46 tok/s with 100% draft | ||
| acceptance. `STRATA_MOE_PREFETCH=1` is available as an opt-in next-layer L2 prefetch; it helped when the expert |
There was a problem hiding this comment.
✅ No longer detected as of 44b6a373b932.
🔵 Low · Maintainability · 8 of 10
USAGE claims Tiel 46 tok/s, PERFORMANCE table reports 26.7 USAGE.md says 35B-A3B goes from 29 to 46 tok/s with suffix. PERFORMANCE.md reports 16.1 to 26.7 with suffix and gives 29.3 as a small-cache prefetch figure. A reader cannot tell which number is the real speedup, so the advertised gain is unreliable.
Prompt for your AI agent
File: docs/USAGE.md
Line: 158
Issue: USAGE claims Tiel 46 tok/s, PERFORMANCE table reports 26.7 USAGE.md says 35B-A3B goes from 29 to 46 tok/s with suffix. PERFORMANCE.md reports 16.1 to 26.7 with suffix and gives 29.3 as a small-cache prefetch figure. A reader cannot tell which number is the real speedup, so the advertised gain is unreliable.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| #[arg(long, default_value = "none")] | ||
| #[arg(long, default_value = "suffix")] | ||
| spec_type: String, | ||
| /// Maximum number of speculative draft tokens verified per step (1..=16). |
There was a problem hiding this comment.
🔵 Low · Maintainability · 9 of 10
Global spec-type default changes behaviour for every model The default changes for all architectures, including dense models and any with --draft-model or --mtp, which now hit the hybrid cascade without asking. On prompts with little repetition, suffix drafts that are rejected add verify overhead and can reduce decode speed for users who never opted in.
Prompt for your AI agent
File: src/main.rs
Line: 52
Symbol: Engine
Issue: Global spec-type default changes behaviour for every model The default changes for all architectures, including dense models and any with --draft-model or --mtp, which now hit the hybrid cascade without asking. On prompts with little repetition, suffix drafts that are rejected add verify overhead and can reduce decode speed for users who never opted in.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| let age = std::env::var("STRATA_DS_EX_AGE").ok().and_then(|v| v.parse::<u64>().ok()).unwrap_or(96); | ||
| let victim = self.exs.iter().enumerate() | ||
| .filter(|(_, e)| e.2 + 96 <= now && { let t = self.tensor(e.0); t.ty == ty && t.rows == rows && t.cols == cols }) | ||
| .filter(|(_, e)| e.2 + age <= now && { let t = self.tensor(e.0); t.ty == ty && t.rows == rows && t.cols == cols }) |
There was a problem hiding this comment.
🔵 Low · Maintainability · 10 of 10
Env var read inside eviction loop; knob adds no value std::env::var is evaluated on every eviction call, which is a hot path in expert caching. The PR's own notes say the knob did not change hit rate, so this adds a diagnostic setting with no measured benefit and it can be removed or hoisted out of the loop.
Prompt for your AI agent
File: src/deepseek/mat.rs
Line: 216
Symbol: expert
Issue: Env var read inside eviction loop; knob adds no value std::env::var is evaluated on every eviction call, which is a hot path in expert caching. The PR's own notes say the knob did not change hit rate, so this adds a diagnostic setting with no measured benefit and it can be removed or hoisted out of the loop.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
Aletheore Flash reviewNo new issues found in this push. 15 earlier finding(s) from previous pushes are still open. |
|
@sayampy Merged in part, ty. The panic is real: I reproduced it on a 3060 with 3.4 GB of VRAM left free (main: panic at Kept:
Left out:
|
| } | ||
| __device__ __forceinline__ void kv_put(u16* c, size_t e, int hd, float x) { | ||
| template <int M, bool IS_K> __device__ __forceinline__ void kv_put(u16* c, size_t e, int hd, float x) { | ||
| #if M == 5 |
There was a problem hiding this comment.
🟠 High · Correctness · 1 of 6
#if M == 5 and #if M >= 4 test a template parameter, so rotation is never applied on store The preprocessor treats the template parameter M as 0, so #if M == 5 (in kv_put for turbo3) and #if M >= 4 (in the q4-style kv_put for turbo4, rotorquant, turbo4-3 and turbo4-2) are always false. kv_rot_fwd is never called on store, but ldkv/ldkv1 apply kv_inv on load. Every turbo KV cache is therefore read back with an inverse rotation of unrotated data, so attention gets corrupted values and output is garbage. The same error is in the q4-style kv_put at about line 2297.
Prompt for your AI agent
File: src/cuda/kernels.cu
Line: 2273
Issue: `#if M == 5` and `#if M >= 4` test a template parameter, so rotation is never applied on store The preprocessor treats the template parameter M as 0, so `#if M == 5` (in kv_put for turbo3) and `#if M >= 4` (in the q4-style kv_put for turbo4, rotorquant, turbo4-3 and turbo4-2) are always false. kv_rot_fwd is never called on store, but ldkv/ldkv1 apply kv_inv on load. Every turbo KV cache is therefore read back with an inverse rotation of unrotated data, so attention gets corrupted values and output is garbage. The same error is in the q4-style kv_put at about line 2297.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| } | ||
| #pragma unroll | ||
| for (int i = 0; i < 8; i++) v[i] *= 0.3535533905932738f; | ||
| #endif |
There was a problem hiding this comment.
🟠 High · Correctness · 2 of 6
PER < 8 in a preprocessor guard is always true, so ldkv<8> recurses into itself In #if KV_MODE >= 4 && PER < 8, PER is undefined to the preprocessor and evaluates to 0, so the condition is true for every instantiation. For PER=8 the block calls ldkv<8>, which calls ldkv<8> again and never returns. Any vector KV load in turbo modes recurses until the GPU stack overflows, so decode fails on the first attention step. Narrow PER values never reach the intended fallback either.
Prompt for your AI agent
File: src/cuda/kernels.cu
Line: 2418
Issue: `PER < 8` in a preprocessor guard is always true, so ldkv<8> recurses into itself In `#if KV_MODE >= 4 && PER < 8`, PER is undefined to the preprocessor and evaluates to 0, so the condition is true for every instantiation. For PER=8 the block calls ldkv<8>, which calls ldkv<8> again and never returns. Any vector KV load in turbo modes recurses until the GPU stack overflows, so decode fails on the first attention step. Narrow PER values never reach the intended fallback either.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| #pragma unroll | ||
| for (int i = 0; i < 4; i++) { unsigned w = o[4 * b + i]; v[2 * i] = h2f((u16)w); v[2 * i + 1] = h2f((u16)(w >> 16)); } | ||
| #if KV_MODE >= 4 | ||
| for (int s = 1; s >= 0; s--) { // inverse of the forward step-4 then step-2 Givens pair |
There was a problem hiding this comment.
🔵 Low · Maintainability · 3 of 6
Hadamard #else branches in kv_inv are dead; the inverse rotation is duplicated in ldkv1 kv_inv sits inside #if KV_MODE >= 4, so its inner #if KV_MODE >= 4 is always true and the #else Hadamard loop never compiles. ldkv1 repeats the same Givens inverse loop instead of calling a shared helper. Two copies of the transform can drift apart, and the stale Hadamard code makes the rotation scheme harder to audit.
Prompt for your AI agent
File: src/cuda/kernels.cu
Line: 2400
Issue: Hadamard `#else` branches in kv_inv are dead; the inverse rotation is duplicated in ldkv1 kv_inv sits inside `#if KV_MODE >= 4`, so its inner `#if KV_MODE >= 4` is always true and the `#else` Hadamard loop never compiles. ldkv1 repeats the same Givens inverse loop instead of calling a shared helper. Two copies of the transform can drift apart, and the stale Hadamard code makes the rotation scheme harder to audit.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| size_t g = off & ~(size_t)7; | ||
| int w8 = (int)(g % hd); | ||
| float v[8]; | ||
| #if KV_MODE == 5 |
There was a problem hiding this comment.
🔵 Low · Performance · 4 of 6
Scalar ldkv1 re-dequantizes and inverse-rotates a whole 8-group for each element Every scalar KV read in turbo modes decodes all 8 values of its group, runs the inverse rotation, and then keeps one value. This is 8 times the dequant and shuffle-free math per read. The PR says decode is slower with these modes, and this scalar path is a likely reason. Caching the group per thread or using the vector path would avoid the redundant work.
Prompt for your AI agent
File: src/cuda/kernels.cu
Line: 2530
Issue: Scalar ldkv1 re-dequantizes and inverse-rotates a whole 8-group for each element Every scalar KV read in turbo modes decodes all 8 values of its group, runs the inverse rotation, and then keeps one value. This is 8 times the dequant and shuffle-free math per read. The PR says decode is slower with these modes, and this scalar path is a likely reason. Caching the group per thread or using the vector path would avoid the redundant work.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| super::nvrtc::cubin(&super::source(3, false), "sm_75").unwrap_or_else(|e| panic!("sm_75 kv_q2 must compile: {e:#}")); | ||
| for m in [4, 5, 6] { | ||
| super::nvrtc::cubin(&super::source(m, false), "sm_75").unwrap_or_else(|e| panic!("sm_75 turbo KV mode {m} must compile: {e:#}")); | ||
| } |
There was a problem hiding this comment.
🔵 Low · Maintainability · 5 of 6
New test only checks that turbo modes compile, not that they round-trip correctly The added test only asserts that the NVRTC source for modes 4 to 6 compiles. The store-side rotation bug and the ldkv recursion both compile cleanly, so the test passes while every turbo KV cache is corrupt. A store-then-load round trip against the f16 reference would have caught both.
Prompt for your AI agent
File: src/cuda/mod.rs
Line: 1394
Symbol: nvrtc_compiles_full_source_for_sm70
Issue: New test only checks that turbo modes compile, not that they round-trip correctly The added test only asserts that the NVRTC source for modes 4 to 6 compiles. The store-side rotation bug and the ldkv recursion both compile cleanly, so the test passes while every turbo KV cache is corrupt. A store-then-load round trip against the f16 reference would have caught both.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
| and was replaced by the fixed rotor above. | ||
|
|
||
| Asymmetric pairs `--kv turbo4-3` (alias `turbo4v3`) and `--kv turbo4-2` (`turbo4v2`) keep K at 4 bits and give V a | ||
| narrower 4-/2-bit code inside the same nibble layout, so K and V rows keep the same stride. In the zero-temperature |
There was a problem hiding this comment.
🔵 Low · Maintainability · 6 of 6
Asymmetric modes are documented inconsistently
'4-/2-bit' here, 'V at 3 or 2' in USAGE PERFORMANCE.md says V gets a '4-/2-bit' code, while USAGE.md says V is 3 or 2 bits. The code uses RANGE 4 for turbo4-3 and RANGE 2 for turbo4-2, which gives about 3 and 2 bits. A user choosing the mode from the docs could expect the wrong quality/memory trade-off.
Prompt for your AI agent
File: docs/PERFORMANCE.md
Line: 88
Issue: Asymmetric modes are documented inconsistently: '4-/2-bit' here, 'V at 3 or 2' in USAGE PERFORMANCE.md says V gets a '4-/2-bit' code, while USAGE.md says V is 3 or 2 bits. The code uses RANGE 4 for turbo4-3 and RANGE 2 for turbo4-2, which gives about 3 and 2 bits. A user choosing the mode from the docs could expect the wrong quality/memory trade-off.
Make the smallest change that fixes this, add a test, and change nothing unrelated.
Reply /dismiss (optionally with a reason) if this isn't helpful - Aletheore won't raise it again on this repo.
44b6a37 to
d07419b
Compare
Summary
Makes Inkling 2 decode work and get much faster on small-VRAM GPUs, and enables lossless suffix speculative decoding by default for all MoE models.
Changes
src/inkling2/forward/device.rs): when a routed expert cannot be staged into VRAM, finish that layer's experts on the host instead of panicking atdevice.rs:1393. This was a hard failure on a 4 GB GPU with the old 0.90 GPU fraction.src/inkling2/mod.rs,chat.rs): 0.60 below 8 GB VRAM, 0.90 above. Applies only to Inkling 2; other architectures keep their existing defaults (applying it globally regressed Tiel from 29.3 to 17.1 tok/s).src/inkling2/forward.rs,src/deepseek/mat.rs): new sharedmatvec_many_cpuhelper computes all host experts of a layer in one Rayon pass; also addsSTRATA_DS_EX_AGEas a diagnostic knob for expert-cache eviction age.src/main.rs):--spec-typenow defaults tosuffixinstead ofnone. Drafts are verified, so greedy output is unchanged; use--spec-type noneto restore the old default.docs/PERFORMANCE.md,docs/USAGE.md): benchmarks, quality check, and configuration notes.Benchmarks (RTX 3050 Laptop, 4 GB; release build)
STRATA_MOE_PREFETCH=1remains opt-in: it helped once (29.3 → 31.8 tok/s) but was inconsistent on a full expert cache.Output quality check
generate --temp 0 --seed 1 -n 48 --prompt "The capital of France is"run with suffix drafts and with--spec-type none:Past Simple TensevsPresent Perfect vs Past Simple), consistent with the documented small logit shift from the adaptive CPU/GPU expert split. Both continuations are sensible.Paris. Paris is a beautiful city. ...); the no-spec output repeated the prompt sentence. Similar or better.Reverted experiments
Parallel routing (Rayon contention doubled route time), prefetch enabled by default (inconsistent), and a global adaptive GPU fraction (regressed Tiel). Details in
docs/PERFORMANCE.md.Co-authored-by: HY4-Flash