Local review revision · evidence cutoff 2026-07-25

When sparse parameters met physical memory

I set out to learn whether a fault-tolerant BEAM control plane could orchestrate sparse mixture-of-experts inference on four small Arm cores. The useful result was not one trick. It was a chain of corrections, bounded wins, and failed ideas that exposed where sparsity ends and systems reality begins.

Tanvir AhmedSeptember 20264× Arm Neoverse-N1 · 24 GiBZenodo concept DOI: 10.5281/zenodo.22741249
TL;DR · Systems summary

What this is: An empirical study of whether an Erlang/BEAM supervision plane can manage sparse mixture-of-experts routing, parameter lifetimes, and request admission on a resource-constrained host without bottlenecking native tensor execution.

Question and scope

Can BEAM coordination fit within selected-expert compute windows while maintaining physical memory sparsity?

Boundary: one Oracle OCI A1 host with 4× Arm Neoverse-N1 cores and 24 GiB RAM; no distributed claim or hardware-counter attribution.

Strongest bounded findings
  • Coordination: 74 µs p99 versus 2.206 ms p99 selected-expert compute.
  • Physical sparsity: MADV_RANDOM brought RSS to 12.98% and PTE presence to 12.88%, near the 12.5% logical fraction.
  • Lifecycle: layer-completion eviction held RSS to 340–364 MB across sustained/churn tests while retaining 85.4%–90.8% throughput.
What failed
  • Oracle-route local prefetch did not pass repeatability latency gates.
  • On-demand Redpanda shard delivery passed 0/9 compute-window gates.
  • Cache and suspension policies remained model- and workload-specific.
Chapter 01

The systems premise: sparsity on constrained silicon

When I began investigating sparse mixture-of-experts models on commodity hardware, the promise looked almost embarrassingly simple: sparse activation should produce sparse resource use.

OLMoE activates eight of 64 experts per token at each of 16 MoE layers. Logically, that is exactly 12.5% of the expert weights. On an Oracle OCI A1 instance with four Arm Neoverse-N1 cores and 24 GiB of RAM, the arithmetic suggested an escape hatch: keep only selected experts hot, let native kernels do tensor work, and use BEAM supervision to coordinate requests and lifetimes.

Physical hardware does not honor a ratio in a model diagram. Page-fault policy, file-backed mappings, unions of experts touched by successive tokens, overlapping request lifetimes, and the time required to move a future expert into memory all intervene. Zincrom became an experiment in making those hidden costs visible.

8 / 64experts active per token
12.5%logical expert fraction
4 coresArm Neoverse-N1 host
24 GiBphysical RAM · no swap
Evidence rule

I promoted a result only when a recorded run had a matched control, an explicit gate, and a traceable artifact. The source of truth is the current evidence ledger; attractive explanations that failed remain failures.

Chapter 02

The 0.270 mirage

The first dramatic result was wrong. Correcting it did more to shape Zincrom than any benchmark win.

An exploratory benchmark appeared to show the 8B dense model collapsing to an Operational Efficiency Factor of 0.270 under four workers. I initially read it as a memory-bandwidth wall. The denominator audit showed something less exciting and more important: four single-thread workers had been compared with four copies of a four-thread baseline on a machine with only four cores. The calculation silently assumed sixteen cores of compute.

I reran the suite with matched isolated controls and disjoint CPU pinning. The collapse disappeared. Contention efficiency sat tightly between 0.963 and 0.967 across the three evaluated models. Hardware counters were not collected, so these data do not prove a bandwidth mechanism; they do prove that the old normalization cannot support the collapse claim.

ModelAggregate t/sCapacity efficiency (95% CI)Contention efficiency (95% CI)
Llama 3.2 3B15.4791.099 (1.096–1.104)0.967 (0.965–0.969)
Llama 3.1 8B6.9441.074 (1.069–1.079)0.963 (0.960–0.965)
OLMoE 1B-active / 7B-total40.7631.155 (1.141–1.172)0.964 (0.961–0.966)
Correction, not breakthrough

The result is a denominator correction. It does not show that 8B inference scales universally, nor that bandwidth is irrelevant. It removed a false premise and redirected the study toward coordination and physical memory lifetime. Corrected baseline record

Chapter 03

Splitting the graph without changing the answer

Once the baseline was honest, I could ask the real architectural question: can BEAM coordinate the sparse path without corrupting the math or consuming the compute window?

The native side keeps the GGUF tensors, evaluates the gate, selects top-K experts, and executes their gate/up/down projections. The BEAM side owns request admission, completion barriers, worker supervision, and eviction triggers. Model weights never travel through the Erlang heap, and the measured worker processes perform confirmation rather than expert arithmetic.

Figure 1 · control/execution boundaryresponsibility, not marketing layers
Zincrom split architectureBEAM admission, barrier, and lifecycle control on the left; native routing, selected expert compute, and mapped tensors on the right.BEAM CONTROL PLANENATIVE EXECUTION PLANEAdmission queue · four active slotsDynamic layer-completion barrierPage lifetime and eviction triggerGate and top-K router graphSelected-expert native computeGGUF mmap · advice · eviction
Figure 1. The split preserves native tensor execution and puts lifecycle policy in the supervision plane. The 74 µs result below measures dispatch and confirmation, not model-weight transfer or distributed Erlang.

The reference callback captured normalized hidden states, expert IDs, gate weights, and outputs from llama.cpp commit 6e9007ae6. Three single token IDs—50279, 42, and 1000—matched at every one of 16 layers: 48 exact expert selections, zero gate-weight delta, and zero output delta. Causal batches 2, 4, 8, and 16 also matched exactly at all layers.

Batch 32 is the boundary. Expert IDs remained exact and weight delta stayed within its 1.0×10−6 gate, but layer 2 reached 1.1444×10−5 output delta against a 1.0×10−5 limit. I did not round it into success.

InputCasesExpert IDsMax weight ΔMax output ΔVerdict
3 single tokens4848/48 exact00Pass
Batch 21616/16 exact00Pass
Batch 41616/16 exact00Pass
Batch 81616/16 exact00Pass
Batch 161616/16 exact00Pass
Batch 321616/16 exact6.8545×10−71.1444×10−5Fail

In the isolated 1,000-iteration harness, selected-expert computation measured 2,205.553 µs at p99. BEAM dispatch and confirmation measured 74 µs at p99—43.47 µs mean, 41 µs p50, and 53 µs p95. The p99 ratio was 3.36%, below the preregistered 10% limit.

Figure 2 · p99 latency decompositionmicroseconds · linear scale
Isolated p99 latency comparisonHorizontal bars show fused NIF 7758 microseconds, BEAM total 2934.710, split NIF 2374.912, selected compute 2205.553, and coordination 74.02,0004,0006,0008,000 µsFused NIFBEAM totalSplit NIFSelected computeCoordination7,7582,934.7102,374.9122,205.55374 · 3.36%
Figure 2. Whole-path p99 values are shown separately from selected compute, the denominator for the coordination ratio. The large fused tail is a measured path result, not evidence that splitting is universally faster.
Narrow result

Coordination did not dominate this selected-expert path. That is not a distributed-BEAM claim, an end-to-end generation proof, or evidence that workers can move weights through the VM cheaply. Overhead summary · single-token equivalence · causal-batch boundary

Chapter 04

The OS surprise: when 12.5% becomes 27.8%

OLMoE routes eight of 64 experts per token. In memory, logical weights are exactly 487,587,840 bytes out of 3,900,702,720 (12.50%). But physical memory allocation is governed by the OS page cache, not model architecture.

Under default file mapping on Linux, touching selected expert pages triggered kernel fault-around, mapping neighboring unselected pages into the page table. Measured via /proc/self/pagemap and /proc/self/smaps_rollup, PTE-present bytes reached 1,085,272,064 (27.7%) and peak RSS delta reached 1,089,163,264 bytes (27.8% of the 3.921 GB all-expert control), failing preregistered limits.

Applying MADV_RANDOM suppressed sequential readahead. Routed expert PTE presence dropped to 504,152,064 bytes (12.88%) and RSS delta fell to 506,138,624 bytes (12.98% of 3.899 GB), matching logical active sparsity within 0.48 percentage points.

Figure 3 · active-parameter memory scalingmegabytes resident
Active expert memory comparisonBar chart comparing all-expert control, default fault-around, and MADV_RANDOM against logical active target.01,0002,0003,0004,000 MBAll-expert controlDefault fault-aroundMADV_RANDOMLogical active target3,899 MB (100%)1,089 MB (27.8%)506 MB (13.0%)488 MB (12.5%)
Figure 3. Default page-faulting doubles physical residency over logical weights. MADV_RANDOM aligns physical page residency with selected parameters. Evidence ledger
Chapter 05

A safe lifetime: synchronizing layer eviction

Kernel advice bounds one hidden state, but multi-token generation accumulates expert pages across successive tokens. Shared-model concurrency requires active lifecycle eviction.

Without eviction, an 8-token decode across 1, 2, and 4 concurrent requests caused peak RSS deltas of 2.439, 2.881, and 3.531 GB with expert PTE presence climbing to 60.97%, 71.32%, and 85.96%. Evicting after every token cut RSS to 1.146, 1.891, and 2.563 GB, but PTE presence remained excessive (27.96%, 46.17%, 61.43%) while elapsed time inflated to 5.2–5.9 s versus 0.8–1.0 s.

The solution is layer-completion eviction. Using a decoder callback, requests synchronize at layer ℓ. Once the final concurrent context finishes layer ℓ, its expert mappings are evicted before any request advances to layer ℓ+1.

Figure 4 · layer-completion barriersynchronization before eviction
Layer-completion barrier sequenceConcurrent requests execute layer ℓ, wait at the barrier, trigger layer ℓ eviction, and proceed to layer ℓ+1.Req 1: Layer ℓReq 2: Layer ℓReq 3: Layer ℓLAYER BARRIERSynchronous EvictionEvict layer ℓ expertsReq 1: Layer ℓ+1Req 2: Layer ℓ+1Req 3: Layer ℓ+1
Figure 4. The dynamic barrier prevents premature eviction while slower contexts complete layer ℓ computation.
Chapter 06

Surviving churn: bounded memory under load

Synchronizing eviction at layer completion keeps memory strictly bounded across request counts and extended token horizons.

Eviction Strategy1 Request RSS (PTE)2 Requests RSS (PTE)4 Requests RSS (PTE)Elapsed
Unmanaged Accumulation2.439 GB (60.97%)2.881 GB (71.32%)3.531 GB (85.96%)0.8–1.0 s
Token-Boundary Eviction1.146 GB (27.96%)1.891 GB (46.17%)2.563 GB (61.43%)5.2–5.9 s
Layer-Completion Eviction223 MB (3.53%)272 MB (4.67%)407 MB (6.11%)1.87 / 1.87 / 2.26 s

In staggered churn, layer eviction maintained bounded residency across all tested horizons:

Workload HorizonControl p99Layer p99Control TputLayer TputControl RSSLayer RSS
16 tokens / request167.9 ms205.5 ms18.93 t/s17.18 t/s3,957 MB364 MB
64 tokens / request170.9 ms209.6 ms20.43 t/s17.66 t/s4,040 MB344 MB
256 tokens / request177.3 ms208.2 ms20.20 t/s17.50 t/s4,048 MB356 MB
Uneven (64–256 tokens)171.4 ms201.5 ms85.4% ret.4,048 MB340 MB

Dynamic barrier membership completed 1,200 uneven-lifetime samples without deadlock. Layer eviction reduced peak RSS by over 90% while retaining 85.4%–90.8% of unmanaged throughput. Evidence ledger

Chapter 07

When perfect knowledge fails

I supplied the prefetch harness with oracle knowledge of exact future-layer routes. That removed prediction error, but it did not make overlap reliable on four saturated cores.

Across twelve batch/layer-pair conditions, user-space page touch failed 7/12 latency gates, MADV_WILLNEED failed 11/12, and reserving one compute thread still failed 7/12. Strict CPU affinity reduced failures from 5/12 to 1/12 between runs, but a three-repeat batch-8 check still failed once at layer 14→15: overlap p99 was 15.533 ms against 14.733 ms sequential.

Figure 5 · oracle-prefetch failuresfailed latency conditions out of 12
Prefetch strategy failure countsHorizontal bars show seven failures for page touch, eleven for MADV WILLNEED, seven for three-thread compute, and five then one failures in strict-affinity runs.Page touchMADV_WILLNEED3-thread computeStrict affinity R1 / R27/1211/127/125/12 then 1/12
Figure 5. Exact future routes did not produce a repeatable latency win. Residency and numerical checks passed; the latency gate did not. Evidence ledger
Negative result

Perfect route knowledge is insufficient on this host. The experiment demonstrates unstable resource contention; without hardware counters it does not isolate a single causal mechanism.

Chapter 08

The network misses: streaming expert shards

If local prefetch competes with compute, I wondered whether a broker could move selected expert shards into the compute window. Redpanda gave a clean negative answer for this design.

Matched selected-expert compute took 7.2–43.4 ms. Fetching a real 31.1 MiB shard took 86.96–119.47 ms p99 through the native client and 95.14–138.68 ms through persistent brod. A 64 MiB control measured 260.95–269.44 ms. None of nine batch/layer conditions passed.

0 / 9latency gates passed
7.2–43.4 msselected compute p99
86.96–119.47 msnative fetch p99
260.95–269.44 ms64 MiB control p99
Bounded meaning

This rejects on-demand, per-layer broker streaming for the measured shard and compute windows. It does not reject background replication, coarser staging, smaller representations, or a different fabric. Evidence ledger

Chapter 09

Policy is model-specific

Memory control became a scheduling problem: decide who enters, when a long waiter advances, and which recently used expert pages are worth retaining.

A four-active FIFO queue bounded memory but produced Jain fairness 0.739 and wait p99 71.584 s. Aging size-aware admission improved fairness to 0.901 and wait p99 to 65.016 s, with throughput rising from 18.64 to 19.26 t/s and peak RSS moving from 343 to 351 MB. Request p99 was 100.095 s under FIFO and 101.746 s under aging, so the fairness improvement was not a universal tail-latency win.

ModelChosen cacheHit rateThroughput gainMedian faultAvoided / route
OLMoELRU-843.1%+1.8%41.4 µs17.8 µs
Granite 3.1LRU-427.2%+2.6%153.7 µs41.9 µs
Qwen1.5-MoE-A2.7B-ChatLRU-417.1%+4.2%501.6 µs85.7 µs

Hit rate alone did not rank the gains: Qwen had the lowest hit rate but the largest avoided fault cost per route and the largest measured improvement. These are model-specific results, not portable cache constants. Verified architectures use exact metadata; unknown architectures fall back to full layer eviction.

Policy lesson

Admission and cache policy should be selected from measured model geometry and fault cost, with a conservative default for unknown layouts. Evidence ledger

Chapter 10

Context suspension and honest boundaries

Parked sequence states also consume anonymous memory. Reclaiming them forced a choice between fidelity, memory, and reconstruction cost.

Float16 suspension restored outputs exactly at all four evaluated checkpoints. Int8 changed the top expert in 2/4 cases, with mean absolute error 0.099–0.130, so it failed the fidelity gate. Always-suspend reduced peak RSS from 1.516 GB to 965.1 MB and retained 0.999 fairness, but throughput fell to 7.189 t/s versus 7.901 for LRU-4 and 7.609 for full eviction.

Float16exact restoration
Int8top expert changed in 2/4
965.1 MBalways-suspend RSS
0.999Jain fairness

Longer quanta reduced reconstruction frequency but did not create a universal sub-1-GB bound. Under maximum-prefix stress, Q24 and Q28 reached 1.279 and 1.241 GB; with a 24-request queue they reached 1.059 and 1.056 GB.

Explicit boundaries
  • No production deployment or distributed-cluster proof.
  • No hardware-counter attribution for the observed contention.
  • No generalization beyond the tested hosts, models, and schedules.
  • Upstream revision, source-hash, and license provenance remain incomplete in the weight manifest.
Chapter 11

Follow the evidence

The result I trust is not a slogan about sparse inference. It is a measured chain: correct the denominator, preserve native math, suppress fault-around, synchronize page lifetime, admit requests fairly, and close the paths that fail.

Logical sparsity needs a physical lifetime.

Selection alone did not bound residency; kernel advice and layer-safe eviction did.

Negative results narrow the design.

Oracle prefetch and per-layer broker streaming failed their recorded gates.

Policy follows measured cost.

Cache and suspension choices remained model- and workload-specific.

Local review and reproducibility

ArtifactPurpose
Technical report PDFTypeset review manuscript
Zenodo concept DOICanonical technical-report record · 10.5281/zenodo.22741249
LaTeX sourceReproducible paper entry point
Claim-evidence matrixClaim-to-artifact cross-reference
Evidence auditVerification record and discrepancies
Snapshot manifestSanitized bundle inventory and checksums
Canonical evidence ledgerControlling evidence summary
Raw result directoriesMachine-readable trials and logs
Public technical report

The technical report and its version history are available through Zenodo concept DOI 10.5281/zenodo.22741249. Private model weights are not included; GitHub release tagging, Hugging Face publication, and public blog hosting remain separate release steps.