Files
Athena-Deck/docs/experiments/strata-batch-groups-2026-10-14/README.md
T

206 lines
12 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Dual-slot batch-group comparison, 2026-10-14
Requested by the user after the OpenWebUI background automation was identified
as a separate cause of destructive profile switches and lost context caches.
OpenWebUI stays stopped. No private chats, prompts or production logs enter
this benchmark. Only synthetic requests are generated.
## Fixed setup
- Existing Strata 0.1.43.1; commit from the installed `ready.json` is recorded
in `metadata.json`. The previously requested version update is separate.
- Existing GSQ-RCO IQ3_XXS weights, GPU order RTX 3060 then RTX 5080,
layer split 16 and current measured expert-cache tuning unchanged.
- Parallel 2, context 262144 per slot; int8 KV, resident KV window 32768.
- Same CPU vision encoder as production, enabled even for these text tests.
- Own isolated container: 44 GiB cgroup memory, no additional swap,
six CPU equivalents, UID 65534, read-only root filesystem and production
mounts, no network except its own loopback. Only the experiment directory
is writable. Production Deck and CPU STT remain running.
- Existing resident-expert mode and 6-GiB headroom retained. Record the
*resolved* pinned expert budget in both arms: it is sized automatically
from available RAM, so materially different budgets confound a comparison.
## Arms and measurements
1. `serial_mtp`: `--batch-mtp --batch-groups 1`, the current configuration.
2. `pipeline`: `--batch-mtp --batch-groups auto`. The official engine gives
the explicit pipeline precedence and disables batch-MTP in this arm.
Same deterministic prompts and output limits in both arms. Two repetitions
of a short solo request and two concurrent short requests (512 output tokens
each). Then two distinct conversations of approximately 64K and 128K tokens
each: simultaneous cold requests (256 output tokens), followed by simultaneous
cached continuations (512 output tokens). Token counts use the installed
tokenizer, not character estimates. These are speed/resource tests, not
quality benchmarks or proof that two full 262K windows fit.
Record backend input/output timing, request wall time and TTFT, usage/cache
counts, observed overlapping batch slots, cgroup peak memory, major faults,
file-page refaults, memory-limit events, full memory PSI, actual disk reads,
CPU utilization and sampled GPU utilization/memory. Aggregate wall-time
throughput includes prefill/waiting and must not be confused with the sum of
backend decode rates. Solo-path `/slots` reporting is incomplete upstream;
zero processing slots is not treated as no computation.
## Execution and restoration
Stage `/opt/athena-deck-dev/batch-ab-20261014`, output
`/data/experiments/strata-batch-ab-20261014`, own transient service
`athena-strata-batch-ab-20261014`, own container of the same name.
Before launch: API idle verified, original configuration converted into a
synthetic test template with its real API credential removed. LLM unloaded
through authenticated Deck GUI; both GPUs verified free. No Deck, OpenCode,
OpenWebUI or host restart. No production profile changes. Launcher restores
the previous Dual profile through the regular API with a minimal synthetic
request after its test container exits, unless new production activity is
already present. Restoration must be verified from `restore.json` and status.
The scripts also run on the future native deployment using the same pinned
runtime; `benchmark.py` has no Docker dependency. The current `launch.py`
uses Docker only to reproduce the existing container limits and read-only
mounts. A native launcher must use equivalent systemd resource limits and
configured paths; this experiment is not a native fresh-host restore proof.
Official batching documentation at the tested commit:
https://github.com/Niko1221/Strata/blob/a0116b2782a5b82622358c04a06496485d12b2d6/docs/BATCHING.md
## First series: automatic expert budget
Completed all 16 cases without an OOM kill or server failure. Individual
measurements, not confidence intervals. Saved metrics: `results-auto.json`.
| Workload | Serial + batch-MTP | Pipeline |
| --- | ---: | ---: |
| Short solo, backend output token/s (two repeats) | 57.5 / 68.0 | 55.1 / 66.9 |
| Two short requests, backend output token/s per request | 35.6–41.0 | 48.8–54.7 |
| Two short requests, completion wall time (two repeats) | 15.3 / 14.1 s | 11.4 / 11.0 s |
| Two fresh ~64K prompts, total wall time | 181.9 s | 159.4 s |
| Their next turns, total wall time | 21.0 s | 90.1 s |
| Two fresh ~128K prompts, total wall time | 343.9 s | 338.2 s |
| Their next turns, total wall time | 20.6 s | 186.5 s |
| Storage read for fresh ~128K pair | 332.6 GiB | 309.2 GiB |
| Full cgroup memory PSI during that pair | 30.9% | 32.9% |
The automatically pinned expert complement differed: 20.56 GiB serial versus
16.77 GiB pipeline, despite identical 44-GiB limits and 6-GiB headroom. The
second engine's initial cgroup accounted 9.0 GiB versus 2.2 GiB at the first
start; its automatic budget reading was lower. Neither engine had a surviving
predecessor or duplicated vision process. Thus this series measures the actual
two startup outcomes; **do not attribute every difference solely to batching**.
No host cache flush was performed.
Both arms borrowed 4,681 expert GPU-cache slots (~7.26 GiB in total) for prompt
processing, with **zero RAM copies** of those borrowed experts. The engine
explicitly reported reading these experts from the model files each chunk.
Both fresh-128K measurements reached the 44-GiB cgroup limit, with substantial
page refaults and approximately one busy CPU core. This reproduces the
memory/storage bottleneck independently of OpenWebUI and profile switching.
The serial continuations reused both conversation prefixes. In both pipeline
continuation pairs, one request reused its prefix and the other reused zero
tokens (65,807 and ~131K tokens reread). The slow partner also delayed decode
of the already cached conversation. Backend decode timings can include this
interference; use wall times and cache counts together.
Installed `serve/server.py`, `StrataEngine.pick_slot`, lines 1647 onward, explicitly
handles pipelined slot groups without retaining a pipelined slot as a
conversation cache. It prioritizes filling group holes/spreading slots;
the non-pipeline branch instead prefers the longest held prompt prefix.
The observed cache limitation is therefore supported by both measurements
and source, not an assertion of model reasoning failure.
## Controlled follow-up
`strata-batch-fixed16-20261014`: same runtime, limits and prompts, one short
solo/parallel repetition and the fresh/cached ~64K pair, requesting an explicit
`--resident-budget-gib 16` in both arms. This caps pinned experts, not
total process RAM. Launched only after the first series completed and its
regular restoration was confirmed, then regular GUI unload and GPU-free
verification were repeated. No production settings changed.
**Important correction:** requesting a cap does not guarantee its allocation.
Serial actually obtained 16.00 GiB; the second pipeline startup was further
clamped to 12.77 GiB. This pair is therefore not a controlled 16-vs-16 result.
Record that lower-budget pipeline separately, not as evidence for the flag's
isolated effect. The serial 16-GiB run took 201.1 s / 182.1 GiB storage reads
for the fresh 64K pair, with 29.8% full PSI; its cached pair took 21.7 s.
Compared with the automatic serial run, lowering the pinned budget did not
remove the observed bottleneck. Order/cache effects still limit that comparison.
`strata-batch-fresh16-20261014` repeats **only pipeline** in a fresh isolated
container/cgroup with the same requested 16-GiB cap, short requests and same
64K fixtures. The resolved allocation must equal the serial arm's 16.00 GiB
before treating this as a controlled-budget comparison. Starting each arm in
its own cgroup avoids carrying the preceding arm's accounted pages into the
next startup's budget decision. No global cache flushing is used, so this does
not establish identical physical page-cache state or cold-start I/O.
The separate pipeline container confirmed **16.00 GiB**, matching serial.
The corrected countercheck completed all four cases, without OOM or failure.
`results-cap16-sequential.json` contains the serial 16-GiB arm and the explicitly
non-comparable pipeline 12.77-GiB arm; `results-cap16-fresh-pipeline.json`
contains the valid 16-GiB pipeline arm. `resolved-settings.json` records the
allocations and resolved flag semantics.
| Same 16-GiB expert budget | Serial + batch-MTP | Pipeline |
| --- | ---: | ---: |
| Short solo, backend output token/s | 54.2 | 56.8 |
| Two short requests, backend output token/s per request | 35.2 / 37.7 | 52.4 / 48.8 |
| Two short requests, completion wall time | 15.4 s | 11.3 s |
| Two fresh ~64K prompts, total wall time | 201.1 s | 162.0 s |
| Their next turns, total wall time | 21.7 s | 98.3 s |
| Storage read for fresh pair | 182.1 GiB | 138.9 GiB |
| Full memory PSI during fresh pair | 29.8% | 29.7% |
| Storage read for next turns | 3.7 GiB | 76.2 GiB |
| Reused prefix in both next turns? | Yes | No: one request reused zero tokens |
These remain single, ordered measurements without forced cold physical
page-cache state. The similar effect across the automatic-budget series and
the corrected-budget series supports the practical conclusion, but does not
establish a universal performance ratio for all prompts or hardware.
### Decision
Keep production `--batch-mtp --batch-groups 1` for the user's continuing
OpenCode conversations. Pipeline improved short concurrent output and cold
prefill here, but its missing retained batch conversation cache caused much
slower subsequent turns. It did not solve memory pressure. Lowering pinned
experts to 16 GiB also did not solve pressure and did not improve the serial
workload in the measured startup states. **No production flags or RAM limits
were changed.** The parameter is the number of batch groups, not a switch
between having one or two user context slots.
More physical RAM is a plausible way to retain more experts and borrowed
prefill experts, but no larger-RAM configuration was tested; do not promise
a particular token rate. Increasing a cgroup limit cannot manufacture host
RAM, and the 44-GiB limit was not raised. A future runtime update should be
tested separately for pipeline conversation-cache behavior before changing
the recommended production setting. This test used 0.1.43.1; it is **not**
evidence that the pending newer Strata release was installed or benchmarked.
### Reproduction safeguard
After the clamped-budget discovery, the saved `benchmark.py` was strengthened
to check the resolved expert allocation after startup and abort a requested
controlled-budget run if the allocation differs by more than 0.02 GiB. For a
future controlled comparison use separate fresh containers/cgroups and
`TEST_ARMS=serial_mtp` / `TEST_ARMS=pipeline`, `TEST_RESIDENT_GIB=16`,
`TEST_REPETITIONS=1`, `TEST_TARGETS=65536`. The scripts used for the recorded
measurements preceded that added assertion; the final equality was separately
verified from both engine startup records. No workload or timing code changed.
## Verified final state
At approximately 13:02 Europe/Berlin, all three own transient services were
inactive and no own test container remained. `restore-final.json` confirms a
regular HTTP 200 generation with `flash-next-strata-iq3-dual`. The regular Deck
status then confirmed LLM loaded and zero active requests. The native Deck UI
showed the original Dual-Slot 2x262K profile active, two free slots and both
GPUs occupied by the one production Strata engine. Dashboard screenshot:
`restored-dashboard.png`. The one-token restoration probe is not a speed
measurement; ignore its dashboard token/s when reading the benchmark tables.
Deck, OpenCode, OpenWebUI and host were not restarted. OpenWebUI stayed stopped,
CPU STT stayed ready and no TTS policy was changed.