How to Run a 125B MoE Model on 12GB of VRAM: Tiered Caching and Scheduling for Edge Inference
This article explains how a ~125B-parameter sparse Mixture-of-Experts (MoE) model can run on a 12GB consumer GPU, and what that actually requires. It covers why edge LLM inference is bound by memory bandwidth rather than compute, how a three-tier VRAM/RAM/SSD expert cache with predictive scheduling hides transfer latency behind computation, and the supporting optimizations for weight quantization, KV cache management, and context compression. It then examines the engineering and governance work needed to turn that inference stack into a local personal agent: a layered architecture, offline nightly batch processing, proactive reminders, GUI automation with API-first fallback, action tiering, prompt-injection defenses, and auditability. It closes with hardware sizing, acceptance metrics, and a practical framework for deciding what to run locally versus in the cloud.
1. The Problem: 12GB of VRAM vs. 125B Parameters
LLM inference deployment has long been split into two camps. On one side are cloud clusters that optimize for throughput and low latency at high hardware and power cost. On the other are edge devices that offer low latency and keep data local, but are constrained by VRAM, memory bandwidth, thermals, and power.
For a 125B-parameter model, the weights alone — at FP16 or even 4-bit quantized — far exceed the VRAM of mainstream consumer GPUs. With a dense architecture, a single forward pass must read all weights, which 12GB of VRAM simply cannot hold.
A recent class of open-source work suggests another path: running 125B-class sparse MoE models on entry-level consumer GPUs with 12GB of VRAM. These models use a Mixture of Experts (MoE) architecture. Instead of a single feed-forward network, every non-attention layer contains a large set of structurally identical “expert” sub-networks, and a gating network dynamically selects a small number of experts per token. A common configuration has dozens of experts per layer and two activated per token. Reported figures for this class of setup are:
- Tens of tokens per second on a consumer GPU paired with large system memory.
- Close to 200 tokens per second after switching to a flagship consumer GPU.
What makes this work is an inference engine named PolyStrata, which keeps high-frequency experts resident in VRAM, places low-frequency experts in system RAM and SSD, and schedules them on demand.
This article does not review a single product. Instead, it takes the design logic apart: what conditions must hold to run very large sparse models on bandwidth-limited hardware, how to design tiered caching and scheduling for them, and what engineering and governance problems arise when this capability becomes a local personal agent.
2. Root Cause: Edge Inference Is Bound by Bandwidth, Not Compute
Understanding why the MoE approach works starts with the cost structure of edge inference. Autoregressive decoding generates one token at a time, and the ratio of computation to memory access is very low. For a single user with a small batch, generation speed approximates:
tokens/s ≈ effective memory bandwidth (GB/s) ÷ weights that must be read per token (GB)
Take a common 7B dense model: roughly 14GB at FP16, and still about 3.5GB at 4-bit. Every generated token therefore streams more than 3.5GB of data through the GPU. At a few hundred GB/s of consumer-grade memory bandwidth, the ceiling is only around a hundred tokens per second. A 125B dense model at 4-bit still holds about 62.5GB of weights, which no single GPU’s VRAM can contain.
Quantization in traditional inference engines compresses weight size and improves bandwidth efficiency, but the fundamental constraint is total bytes read. MoE changes that total. With a configuration of 125B total parameters and roughly 8B activated per token, 4-bit quantization puts the expert weights actually computed for a token at around 4GB. Add KV cache and runtime overhead, and 12GB of VRAM becomes enough to hold an “active working set.” The key insight is that the remaining 90%+ of low-frequency experts do not need to be resident at all times; they can live in higher-capacity, lower-bandwidth memory and SSD, and be brought in on demand.
The idea is not unique to MoE. Traditional databases have long validated the same “hot data in memory, cold data on disk” tiering principle. MoE’s sparse routing simply provides a natural partition axis: experts are independent of each other and can be placed on media with different performance characteristics, while the gating network signals at every decoding step which experts this step needs. That signal is what a scheduler uses to prefetch and to swap experts in and out.
It is also worth stressing that “it runs” is not the same as “it is usable.” Once many experts must be loaded across tiers frequently, PCIe and SSD bandwidth become the new bottleneck, and both time-to-first-token and generation-speed variance grow sharply. This also explains why the same model performs so differently on different hardware: a flagship GPU has more VRAM, but also stronger memory bandwidth and compute, so more experts can stay resident.
3. Key Mechanism: Three-Tier Storage and On-Demand Scheduling
3.1 Division of Responsibilities Across Tiers
The core of the design is a trade-off between static tiering and dynamic scheduling. The three media play distinct roles:
| Tier | Typical capacity | Bandwidth | Access latency | Policy | Primary role |
|---|---|---|---|---|---|
| VRAM | a few GB to tens of GB | hundreds of GB/s to TB/s | nanoseconds to microseconds | resident / swapped in | hot experts, current-layer KV cache, runtime buffers |
| System memory | tens to hundreds of GB | tens to ~100+ GB/s | hundreds of nanoseconds | warm expert cache | recently active experts; target for eviction and prefetch |
| SSD | TB scale | a few GB/s | tens to hundreds of microseconds | cold storage | full expert weight set, historical data and indexes |
The underlying principle: put high-frequency data on high-bandwidth media and low-frequency data on cheap, high-capacity media, then let the scheduler migrate data dynamically according to access patterns. The average access cost approaches that of the hot path while the full weight set remains available.
3.2 Four Responsibilities of the Scheduler
- Frequency tracking — record how often each expert was activated across historical requests, when it was last activated, and how it correlates with the current token.
- Access prediction — before the gating network produces its result, predict the set of experts likely to activate next, based on historical routing statistics, habitual routing patterns for neighboring tokens, and even preliminary judgments from a partial draft model.
- Prefetch and swap-in — asynchronously move predicted cold experts from memory or SSD into VRAM. Transfer latency should be hidden under the compute of the previous layer rather than placed on the critical path.
- Capacity management and eviction — when VRAM runs short, evict low-frequency experts using a mixed frequency-and-recency policy. Evicted data stays in memory to avoid the write amplification of writing straight back to disk.
3.3 Illustrative Implementation
The pseudocode below sketches a minimal hierarchical expert cache. Prefetching one step ahead is conceptually close to branch prediction in classic CPU design: use historical patterns to predict the data needed next, and fetch it into the fast cache early.
import numpy as npfrom collections import deque, defaultdictHOT, WARM, COLD = "vram", "ram", "ssd"class LayeredExpertCache:"""Illustrative three-tier cache for MoE experts. Pseudocode, meant toconvey the scheduling logic rather than production correctness."""def __init__(self, router, experts, vram_budget):self.router = routerself.experts = experts # each expert has vram/ram buffersself.tier = {} # expert_id -> current tierself.freq = defaultdict(float) # exponentially smoothed activation rateself.last_used = {} # step at which it was last activatedself.vram_used, self.budget, self.step = 0, vram_budget, 0def observe(self, expert_ids):"""Update frequency and recency from the previous step's true routing."""self.step += 1for e in expert_ids:self.freq[e] = 0.9 * self.freq.get(e, 0.0) + 0.1self.last_used[e] = self.stepdef _to_vram(self, e, on_done=None):src = self.experts[e][self.tier[e]] # empty when already in vramdst = self.experts[e][HOT]self.vram_used += src.nbytesdst[:] = src # in practice an async copy engineself.tier[e] = HOTwhile self.vram_used > self.budget:victim = min((x for x, t in self.tier.items() if t == HOT),key=lambda x: (self.freq[x], -self.last_used[x]),)self.experts[victim][WARM] = self.experts[victim][HOT][:]self.tier[victim] = WARMself.vram_used -= self.experts[victim][HOT].nbytesif on_done:on_done()def prefetch(self, k=2):"""Load one step ahead: predict next-step candidates from routing history."""predicted = self.router.predict_next() # statistical prediction from past routingfor e in predicted[:k]:if self.tier.get(e, COLD) != HOT:self._to_vram(e) # async, overlapped with current computedef lookup(self, token):ids = self.router.select(token) # gating network picks this step's experts# the gate is authoritative; prediction errors are corrected naturally herereturn [self._ensure_ready(e) for e in ids]
3.4 Prediction and Correction: A Tiered Variant for Parallel Generation
In serial decoding, the previous step’s prediction has time to complete the transfer while this step computes. In parallel decoding — speculative decoding, or processing a full prompt in one pass — the routing for every token currently in flight is already known. The scheduler then only needs to scan the routing tables layer by layer, count how often each expert will be hit across the next few layers, and batch-transfer experts ordered by “hit count × expert size.” Experts with more hits get VRAM first, and a single transfer then serves many tokens.
This is also why these designs run particularly smoothly on offline batch tasks such as organizing mail or drafting weekly reports: routing information is fully determined before the batch starts, so tiered scheduling degrades into a carefully arranged load plan.
3.5 Optimization Points
Several details decide real-world performance:
- Page granularity — the layout order of weights and the alignment of memory allocations both affect the effective bandwidth of transfers.
- Read/write overlap — overlap transfer with compute as much as possible. A transfer queue that is too long wastes VRAM; one that is too short fails to hide latency.
- Avoiding thrashing — experts that flip back and forth between swap-in and swap-out cause thrashing. Add a threshold-based admission mechanism so an expert may become VRAM-resident only after its frequency stays above the threshold.
4. Supporting Engineering: Quantization, Caching, and Context Compression
Tiered caching solves where the weights live. Making the whole stack run smoothly at the edge requires a set of complementary optimizations.
4.1 Weight Quantization
Weight quantization is the most direct way to shrink expert size. A common practice is to share scale factors within small groups to reduce quantization error. In a tiered design, you can also use different precisions per tier: hot experts resident in VRAM keep higher precision to protect output quality, while cold experts in memory and SSD use lower precision to save space. Both are fine-grained trade-offs between model capability, hardware cost, and user experience.
4.2 KV Cache Management
Long conversations keep accumulating KV cache, which in 12GB of VRAM can occupy more space than the active experts. Common countermeasures:
- Paged management to avoid VRAM fragmentation.
- Lower bit-width storage for cached values.
- Cross-request reuse of fixed prefixes such as system prompts and long-term memory.
- Sliding windows or hierarchical summarization for multi-turn dialogue.
4.3 Compute Efficiency and Speculative Decoding
Another edge challenge for sparse models is compute efficiency. With small batches, expert computation becomes a “tall, skinny” matrix multiply where hardware utilization is often poor. Batching the same expert’s computation across multiple tokens and using dedicated kernels helps noticeably. For the memory-bound generation phase, speculative decoding is an effective answer. Edge devices naturally support keeping multiple models resident: a smaller, faster model acts as the drafter, the large model verifies in batch, and the number of full weight reads by the large model drops.
4.4 Memory Architecture and Thermals
Unified-memory devices, where CPU and GPU share physical memory, simplify data flow, but the CPU and GPU contend for the same memory bus, so inference needs a reserved bandwidth share. Mobile form factors such as laptops also face throttling under sustained load. A local agent that runs continuously should favor energy efficiency over peak performance, controlling heat by limiting concurrency and staggering tasks.
5. From Inference Engine to Personal Agent: More Capability, More Responsibility
Another notable aspect of this work is that such local inference capability is packaged as a personal agent that runs on mainstream desktop operating systems and consists of three parts:
- Nightly offline organization — emails, calendar, chat history, and meeting content are condensed into a local knowledge base, similar to a personal wiki.
- Proactive daytime reminders — notifications are pushed based on time and events.
- Direct action — it can operate the user’s already logged-in browser and desktop applications.
This is fundamentally different from a question-and-answer assistant: it moves from passive response to proactive service, and then to acting on your behalf. Capability is amplified, and so is responsibility.
5.1 Layered Architecture
From a systems engineering perspective, a sound local personal agent should have at least four layers:
- Data ingestion — subscribe to data sources such as email and calendar through standard interfaces provided by the operating system, with incremental pulls and a local cache. When integrating third-party online services, follow their official authorization and open API specifications and never bypass their permission systems.
- Offline batch processing — runs in the idle window at night to extract summaries, recognize entities, organize timelines, and build vector indexes, producing a structured knowledge base. This layer does not need real-time behavior and can use tiered caching and speculative decoding to push throughput.
- Online interaction — answers user requests with low latency during the day by retrieving the knowledge base and generating responses or suggestions. Long-context summarization and organization tasks are deferred to the nightly batch queue to keep this layer lightweight.
- Execution and governance — turns model intent into concrete operations on the system or applications, under permission policies. See Section 6.
Layers are decoupled with message queues or a local task queue. Inference tasks can be cancelled, rate-limited, and priority-scheduled so long-running jobs never block user interaction.
5.2 Engineering Points for Offline Organization
The value of offline organization lies in turning scattered fragments into searchable, citable structured knowledge. In practice:
- Idempotency and incrementality — email recalls, calendar changes, and meeting reschedules all require incremental update mechanisms.
- Traceability — summaries retain the timestamp and source link of each original item so users can verify.
- Classification and labeling — sensitive content such as contracts or identity information is tagged, and the scope in which it can be retrieved and cited is limited.
5.3 Boundaries of Proactive Reminders
The hard part of proactive reminders is not the reminding, but when and what to remind. The agent must weigh urgency, the user’s current context (schedule, location, focus state), and historical response habits to avoid degenerating into notification spam. Sound mechanisms include:
- A frequency cap.
- Do-not-disturb windows.
- Aggregation by topic.
Explainability matters just as much: every reminder should carry its provenance, for example “derived from a specific email and a specific weekly meeting note.” Only then can the user judge whether a reminder is trustworthy.
5.4 Execution: APIs First, GUI as Fallback
An agent that operates a logged-in browser and desktop applications is essentially doing GUI-agent research. It treats the interface as the environment, perceives page state through visual or structured interface elements, plans an action sequence, and executes it via mouse and keyboard events. Because interface elements, pop-ups, and flows can change at any time, the execution layer needs:
- Goal-driven planning — driven by the task goal rather than a fixed script, replanning when it hits pop-ups, expired logins, and similar exceptions.
- State verification — check after each step whether the expected state was reached, avoiding “blind spot” actions.
- Failure fallback — keep recoverable checkpoints, and hand over to the user when necessary.
As an engineering rule, prefer API first, GUI as fallback: anything that can be done through an official interface should not go through UI simulation. Interface automation is reserved for cases where genuinely no API exists.
6. Risks and Costs: Permission Governance Is the Agent’s First Line of Defense
“Data never leaves the machine” is the headline selling point of this class of design, but running locally does not automatically mean safe and controllable. An agent that can read the screen, simulate keyboard and mouse input, and call system interfaces effectively holds the same permissions as the currently logged-in user. If those permissions get out of control, the consequences can be worse than a data leak. Governance is needed at four levels.
6.1 Minimal Collection and Authorization
- Authorize each data source separately, following the principle of least necessity.
- Make the collection scope, storage location, and retention period clearly visible and revocable at any time.
- Protect local data with disk-level encryption and key separation, so a lost device still has protection.
6.2 Action Tiering and Approval
Classify agent actions into tiers with escalating human-confirmation requirements:
| Tier | Typical actions | Governance requirement |
|---|---|---|
| L0 read-only | searching email, viewing calendar, organizing notes | execute silently, record audit logs |
| L1 reversible write | creating drafts, adding calendar entries, organizing labels | one-click undo, retain action snapshots |
| L2 outbound or irreversible | sending email and messages, deleting files, changing permissions, submitting forms | mandatory human confirmation with a full action preview |
| L3 asset or account related | payments and transfers, authorizing logins, changing security settings | automated execution disabled by default; requires separate strong authentication |
# Permission gateway for the agent's execution layer (pseudocode)RISK_LEVEL = {"read": 0, "draft": 1, "send": 2, "pay": 3}def guard(action, policy, audit):level = RISK_LEVEL[action.type]# 1. Dynamic policy: a user-set policy is never overridden by contentif not policy.allowed(action):return Deny("Action is not authorized")# 2. High-risk actions: always route to human confirmation + re-authenticationif level >= 2 and not action.approved_by_user:return NeedConfirm(action, level=level)# 3. Ambiguous targets: do not act if the target cannot be uniquely identifiedif action.target is None or not action.target.exist():return Deny("Target object could not be uniquely identified")result = execute_in_sandbox(action) # run in a sandbox to limit blast radiusaudit.append(action, result) # full audit trail, replayable and undoablereturn result
6.3 Prompt Injection and Instruction Boundaries
The agent processes email, web pages, and chat logs locally, and all of that content comes from untrusted sources. Malicious content can masquerade as user instructions through prompt injection and induce the agent to take dangerous actions. For example, an email saying “please forward the attachment to this address” looks like an everyday request from a correspondent, but may in fact be a trap set by an attacker. Countermeasures:
- Provenance tagging — clearly distinguish system instructions, user instructions, and external content; external content can never elevate privileges.
- Separate intent from execution — sensitive actions are judged by an independent policy module, not left to the model’s own discretion.
- Defense in depth — permission gateway, sandbox, and human confirmation run in parallel rather than relying on a single point of safety.
6.4 Auditability and Rollback
Every action should be logged with time, input, model output, and the action actually executed. When something goes wrong, the user must be able to quickly determine what the agent did, on what basis, and whether it can be undone. This is the foundation for earning long-term trust in a local agent.
7. Engineering Checklist and Deployment Trade-offs
7.1 Hardware Recommendations
| Use case | VRAM | System memory | Storage | Notes |
|---|---|---|---|---|
| Light offline organization | 8–12GB | 32GB+ | NVMe SSD | batch-oriented, speed requirements modest |
| Interactive Q&A | 12–16GB | ~64GB | NVMe SSD | balances time-to-first-token and generation speed |
| High-throughput batch | 24GB+ | 128GB+ | fast SSD | high parallelism, more bandwidth-dependent |
7.2 Evaluation and Acceptance Metrics
Whether a tiered inference design is good enough cannot be judged by “peak tokens/s” alone. Look at:
- Time to first token — behavior on cold starts and long contexts.
- Sustained throughput — stability over long runs rather than short bursts.
- Speed variance — the gap between P95 and P99, reflecting how often swap-in and swap-out occur.
- VRAM occupancy and eviction rate — how effective the tiering policy is.
- Output quality — task completion rate across quantization precisions and context lengths.
7.3 When to Choose Local, When to Choose Cloud
| Dimension | Local deployment | Cloud service |
|---|---|---|
| Data sensitivity | strong; data can stay on the device | relies on compliance and isolation measures |
| Latency and offline use | network-independent, stable latency | affected by network quality |
| Peak compute | capped by hardware | elastic scaling |
| Task type | frequent, privacy-sensitive light tasks | high concurrency, very large contexts, complex reasoning |
| Operating cost | endpoint management and permission governance | platform operations and usage cost |
The more pragmatic approach is hybrid deployment. The local model handles privacy-sensitive, high-frequency, lightweight work; tasks beyond local capacity or needing elasticity go to compliant cloud services. Data is desensitized and minimized before it leaves the endpoint. For cloud-hosted components, general-purpose cloud capabilities such as container platforms, message queues, log services, and monitoring and alerting can be used to build an observable, governable service.
8. Summary
Running large models on small VRAM is possible not through parameter compression alone, but through the stacking of three engineering capabilities:
- Exploiting MoE sparsity — read only the experts each step actually needs.
- Exploiting storage tiering — keep high-frequency experts on high-bandwidth media.
- Exploiting predictive scheduling — hide transfer latency inside computation.
The significance of this approach goes beyond making a hundred-billion-parameter model “run” on a consumer GPU. It turns “keeping large-model capability on personal devices” into an option that can be discussed on engineering terms. And as inference moves down to the endpoint and agents begin to act on our behalf, permission boundaries, data governance, and auditability become questions as important as performance. For developers, the key to selection is not chasing a single peak metric, but understanding what a business scenario really needs in terms of latency, privacy, and reliability, and dividing work sensibly between local and cloud.
