Running a 26B/4B MoE Model with Long Context on Old 64GB GPUs: A Practical Guide

    This article examines how to run a Mixture-of-Experts (MoE) model with about 26B total parameters and 4B active parameters on older GPUs totaling just 64GB of VRAM, supporting three concurrent slots of roughly 260K tokens each. Drawing on a concrete configuration that reaches about 50 tokens/s during generation and about 1000 tokens/s during prefill, it walks through VRAM budgeting, why long context slows decoding, how to plan concurrency slots, how to measure tool-calling reliability, and how to leave room for fast model iteration. The numbers illustrate orders of magnitude and trends rather than fixed guarantees; results vary widely by model architecture, hardware generation, and software version, so always validate with your own measurements.

    1. Introduction: 64GB of Old GPU VRAM Can Handle Long-Context MoE

    Running an MoE model with about 26B total parameters and 4B active parameters across three concurrent slots of roughly 260K tokens each — on nothing more than older GPUs with 64GB of total VRAM — sounds like an extreme experiment. Measured generation speed lands around 50 tokens/s and prefill around 1000 tokens/s. But as low budgets, local/offline deployment, and keeping data within its own domain become increasingly common, this is turning into a workable engineering approach worth discussing.

    This is not a pitch for a specific hardware combination. Instead, it breaks down this kind of deployment as a case study: when VRAM is tight, compute is modest, and long context is a hard requirement, how do you quantitatively estimate VRAM, explain why long context slows down, plan concurrency slots, measure tool-calling reliability, and leave interfaces open for fast model iteration? The numbers come from one concrete configuration and are only meant to convey orders of magnitude and trends. Model architecture, hardware generation, and software versions differ significantly, so in the end, trust your own measurements.

    1.1 A Reproducible Baseline Configuration

    Item Configuration Design intent
    Accelerator hardware Two older-architecture GPUs with 32GB VRAM each, 64GB total Control cost with used hardware, relying on VRAM capacity rather than raw compute
    Main model shape MoE model with about 26B total parameters, about 4B active per token Reduce per-token compute and weight reads
    Weight precision 8-bit integer quantization Balance VRAM against accuracy
    Concurrency slots 3 Let a single privately owned device serve multiple sessions at once
    Context About 260K tokens per slot, about 780K total Meet long-document and code-base-scale context needs
    Runtime software Open-source inference runtime built on the vendor’s open compute stack, with a custom branch maintained for older architectures Run newer model structures on older hardware
    Co-resident on the same machine A small model of about 7B/8B parameters, about 4-5GB VRAM after 4-bit quantization Handle lightweight tasks such as health checks and intent classification

    This configuration reflects three judgments:

    1. MoE and quantization make “running large parameters on little VRAM” possible. Total parameters determine how much VRAM the weights occupy; active parameters determine compute cost and the amount of weight read per step during generation.
    2. Older GPUs are not useless. Their compute is limited, but their VRAM capacity and memory bandwidth still offer good value and are enough to handle the most demanding part of long-context inference.
    3. Long-context capability does not equal single-request capability. Behind “roughly 780K tokens total” are three slots of roughly 260K tokens each; do not conflate them when planning capacity.

    2. Is the VRAM Enough? Do the Budget Math First

    Inference VRAM usage breaks down into four parts:

    1. Weights: parameter count times bytes per parameter. A 26B-parameter model at 8-bit quantization needs about 26GB. Note that although the roughly 26GB of weights can fit on a single card, long-context KV cache and concurrency slots usually require sharding across multiple cards or offloading to host memory.
    2. KV cache: stores the key and value for every token at every layer. Its size is approximately:

      KV bytes ≈ layers × KV heads × head dim × 2 × bytes per element × context length × slots

      Grouped-query attention, multi-query attention, sliding-window attention, and similar structures all essentially compress either the number of KV heads or the number of tokens that need to be cached.

    3. Activations and temporary buffers: intermediate results during operator execution, which vary with batch size and sequence length. This is especially pronounced during the long-context prefill stage, so the runtime usually reserves several GB more.
    4. Runtime and driver overhead: compute graphs, communication buffers, VRAM fragmentation, and so on. As a rule of thumb, leave at least a 10%-15% margin.

    2.1 Do the Budget Math with a Short Script

    Rather than tuning by feel, it is better to turn the formula into an estimation script first. The example below uses three KV precisions — 16-bit, 8-bit, and 4-bit — and assumes one 16-bit scale factor is shared per 32 elements. Here scale = 2 / 32 represents each element carrying 0.0625 bytes of scale factor.

    1. def estimate(total_vram_gb=64, layers=48, kv_heads=4, head_dim=128,
    2. weight_gb=26, reserve_gb=4):
    3. """Estimate the usable context length for single- and multi-slot setups
    4. under different KV precisions.
    5. The example uses 48 layers, 4 KV heads, and head_dim=128; doubling the
    6. number of KV heads also doubles the KV estimate.
    7. """
    8. scale = 2 / 32
    9. print(f"Weights {weight_gb}GB + reserved {reserve_gb}GB, "
    10. f"{total_vram_gb - weight_gb - reserve_gb}GB left for KV cache\n")
    11. print(f"{'KV precision':<12}{'per token/layer':>16}{'3 slots x 256K':>16}{'3 slots x 32K':>16}")
    12. for bits in (16, 8, 4):
    13. per_token = 2 * kv_heads * head_dim * (bits / 8 + scale)
    14. wide = per_token * layers * 256 * 1024 * 3 / 1e9
    15. normal = per_token * layers * 32 * 1024 * 3 / 1e9
    16. print(f"{bits:>3}bit {per_token:>14.0f}B {wide:>14.1f}GB {normal:>14.1f}GB")
    17. if __name__ == "__main__":
    18. estimate()

    Output example:

    1. Weights 26GB + reserved 4GB, 34GB left for KV cache
    2. KV precision per token/layer 3 slots x 256K 3 slots x 32K
    3. 16bit 2112B 79.7GB 10.0GB
    4. 8bit 1088B 41.1GB 5.1GB
    5. 4bit 576B 21.7GB 2.7GB

    Three conclusions can be drawn from the table:

    • Context length is a multiplier, not an addition. At 16-bit KV precision, three slots of roughly 260K tokens each need close to 80GB for KV cache alone; 8-bit still exceeds the available headroom; even at 4-bit it approaches 22GB and still noticeably squeezes activation and runtime space. This shows that “three slots of 260K tokens each” is an extreme configuration and usually requires moving the KV cache to host memory or drastically compressing the number of tokens that need caching through hybrid attention and similar structures — at the cost of higher memory access latency and slower decoding. For most scenarios, a combination of tens of thousands of tokens per slot with multiple concurrent slots is the robust default.
    • KV quantization is the highest-value lever for long context. Going from 8-bit to 4-bit halves the KV cache directly. However, quantization error accumulates gradually over long contexts, so it must be verified with “needle in a haystack”-style retrieval tests to ensure key information in long text can still be located accurately.
    • Weight quantization is only the starting point. 8-bit quantization already saves half the VRAM compared to 16-bit, but activations usually remain at higher precision. The benefit of weight quantization grows with parameter count; for VRAM-constrained small-parameter models, the tradeoff between KV cache and concurrency slots often matters more.

    3. Why Does Long Context Slow Down? Breaking Down the Decode Bottleneck

    3.1 Prefill and Decode Are Two Different Loads

    Large-model inference has two phases:

    • Prefill: processes all input tokens at once and writes their KV into the cache. This is a compute-intensive task with large matrix sizes and high arithmetic intensity; the faster the more compute the hardware has.
    • Decode: generates output tokens one by one. Each generated token requires reading through all active parameters and then reading all historical KV. This is a memory-access-intensive task whose speed is mainly constrained by VRAM bandwidth.

    A full request’s time can be roughly expressed as:

    T ≈ input tokens / prefill speed + output tokens / decode speed + network and queuing overhead

    3.2 Estimating the Decode Speed Ceiling with the “Memory Wall”

    Ideally, decode speed has a simple upper-bound formula:

    decode speed (tokens/s) ≈ effective VRAM bandwidth / (bytes read per step)

    where “bytes read per step = active parameter bytes per token + context length × KV bytes per token”.

    Older-architecture GPUs do not support native low-precision matrix operations, so weights are stored at 8-bit and dequantized to 16-bit during computation. As an example, assume the two cards have a combined effective VRAM bandwidth of about 2TB/s, about 4B active parameters, and thus about 4GB of weights read per step. To illustrate the memory-access bottleneck, the table below uses a conservative estimate with 8-bit KV, 48 layers, and 8 KV heads:

    Context length Weight read per step KV read per step Total Estimated ceiling Realistic expectation
    4K ~4GB ~0.4GB ~4.4GB ~450 tokens/s tens to about 100 tokens/s
    32K ~4GB ~3.4GB ~7.4GB ~270 tokens/s on the order of about 50 tokens/s
    256K ~4GB ~27GB ~31GB ~65 tokens/s clearly below this

    Two notes:

    • Actual values are affected by VRAM bandwidth utilization, MoE routing, and batch scheduling, and may be about 20% to 50% of the theoretical value. If the theoretical ceiling is about 270 tokens/s, a measured roughly 50 tokens/s is about 18%. The reasons: memory access cannot be fully saturated, MoE routing introduces extra fragmented reads, and batch scheduling also adds overhead.
    • The longer the context, the larger the share of KV reads in per-step memory access. At around 260K tokens, KV reads are already several times the weight reads. In this range, generation speed basically drops linearly with context length. This is exactly the root cause of “the same model is blazing fast in short chats but noticeably slower with long context”.

    3.3 Prefill: Why the Compute Shortfall Is Not Obvious

    Prefill compute is approximately 2 × input tokens × active parameters plus attention computation. Each token needs about 8 billion operations; prefilling 1000 tokens per second is equivalent to about 8 trillion operations per second.

    For modern GPUs with half-precision matrix acceleration, this is only a small fraction of their compute; but for older-architecture GPUs without native low-precision matrix instructions, it is already a considerable amount of effective compute. The MoE property of “computing only some experts per token” plays a key role here.

    But note two points:

    • Attention computation grows quadratically with context length, so the longer the context, the higher the marginal cost of prefill.
    • The tens-of-K-token system prompt injected by an agent tool at session initialization, if not cached, must be re-prefilled every turn, and first-token latency will noticeably worsen.

    3.4 Optimization Methods for Long Context

    Optimization How it works Caveats
    KV cache quantization Directly compresses the KV bytes per token Accuracy must be verified with long-text retrieval tests
    Prefix caching Prefill an identical prefix once and reuse it on later hits Keep the prompt prefix stable; avoid putting volatile content such as timestamps up front
    Speculative decoding A draft model or lightweight head guesses multiple tokens at once, then the main model verifies them in a batch Relieves the weight-read bottleneck; in very long contexts, KV reads still dominate, so gains are limited
    Batching and paging management Multiple requests share one weight read, reducing VRAM fragmentation Long requests can slow down short requests in the same batch, so preemption and timeouts are needed
    Context pruning and hierarchical summarization Only put genuinely relevant content into the window Summarization itself costs compute, so set trigger thresholds
    Confirming the dual-card topology Let the runtime be aware of the real interconnect between GPUs Older-architecture GPUs usually lack high-speed interconnect, so cross-card communication is costly; measure different sharding strategies

    4. How to Admit Requests to Slots? Concurrency Capacity Planning

    4.1 Context Capacity Is Not Concurrency Capacity

    “Three slots × 260K tokens” only says how many tokens the system can hold in an extreme case; it does not mean it can smoothly serve three full-context requests at once. The reason is that decode is a memory-access-intensive task, and multiple concurrent streams share the same VRAM bandwidth: when three streams decode simultaneously, each one’s speed roughly drops to about one-third.

    A more practical approach is to allocate slots by scenario, or simply let one slot serve only one request:

    • The agent’s long-context task gets a slot to itself;
    • Lightweight health checks and summarization requests use another slot;
    • Reserve one slot for burst traffic.

    4.2 Request Grading and Admission Control

    1. class SlotPool:
    2. """Admission control by slot and token budget, preventing long requests
    3. from occupying all slots."""
    4. def __init__(self, slots: int, budget_per_slot: int):
    5. self.capacity = [(0, budget_per_slot) for _ in range(slots)]
    6. def admit(self, est_tokens: int):
    7. # Prefer the least-used slot that can still fit this request
    8. candidates = [s for s in self.capacity if s[1] >= est_tokens]
    9. if not candidates:
    10. return None
    11. slot = min(candidates, key=lambda s: s[0])
    12. self.capacity[slot] = (
    13. slot[0] + est_tokens,
    14. slot[1] - est_tokens
    15. )
    16. return slot
    17. def release(self, slot: int, used: int, budget: int):
    18. prev_used, _ = self.capacity[slot]
    19. self.capacity[slot] = (max(0, prev_used - used), budget)

    The value of admission control is to make latency predictable: a long request is either placed on an idle slot or enters a queue with an estimated wait time communicated to the caller, rather than letting several streams slow each other down.

    4.3 Four Curves You Must Stress-Test Before Deployment

    Stress testing should be done in an isolated environment while continuously monitoring VRAM headroom, to avoid OOM affecting production requests. Cover at least four curves:

    1. Speed-context curve: measure decode speed at 2K, 8K, 32K, and 128K context to confirm how it decays on your hardware.
    2. Concurrency-per-stream speed curve: measure per-stream speed and total throughput at 1, 2, and 3 concurrent streams.
    3. Latency-input length curve: check whether prefill speed drops noticeably with input length, and beyond what length you should consider prefix caching.
    4. VRAM-slot curve: see how VRAM headroom changes as each slot is added, and when it hits the ceiling.

    5. Tool Calling: The Most Underrated Metric in Agent Scenarios

    In a real hands-on test, what often ultimately decides whether a model is “kept or dropped” is not a benchmark score but the stability of the agent tool initialization phase. Given two MoE models with the same tens-of-B parameters and B active per token, one may make frequent tool-calling errors while the other hardly ever errs. There are several structural reasons behind this.

    5.1 Why Tool Calling Demands a Lot from the Model

    Tool calling requires the model to perform multi-step reasoning within a large chunk of context:

    • Select the correct one among dozens of tool descriptions;
    • Generate valid arguments according to the JSON Schema;
    • Provide correct argument values with matching types;
    • Produce output the parser can unambiguously recognize.

    It is a comprehensive capability; if any link fails, the entire agent chain fails.

    5.2 Common Failure Modes and Mitigations

    Failure mode Typical symptom Mitigation
    Format errors JSON missing brackets, containing comments, or carrying explanatory text Constrained decoding, delayed parsing, automatic retry on failure
    Wrong tool Called a tool with a similar name but different semantics Add when-to-use and when-not-to-use guidance in tool descriptions
    Argument hallucination Fabricated nonexistent IDs or fields, mismatched types Schema validation plus a second confirmation
    Long-context dilution Call rate drops when tool descriptions are far down the context Control the total context injected per turn
    Missed calls Answers directly in natural language when a tool should have been called Cover must-call cases in the evaluation set

    5.3 Quantifying Reliability with a Small Regression Set

    1. import json
    2. import re
    3. # Cases should cover: format, wrong tool, argument hallucination, must-call, forbidden-call, etc.
    4. TOOL_SET = ["search_docs", "query_order", "create_ticket"]
    5. def check_tool_call(raw: str, expect_tool: str, expect_args: dict) -> bool:
    6. """Parse model output, validate the tool name and arguments, and return
    7. whether it is fully correct."""
    8. match = re.search(r"\{.*\}", raw, re.S)
    9. if not match:
    10. return False
    11. try:
    12. call = json.loads(match.group())
    13. except json.JSONDecodeError:
    14. return False
    15. if call.get("name") not in TOOL_SET:
    16. return False
    17. if call["name"] != expect_tool:
    18. return False
    19. args = call.get("arguments", {})
    20. if set(args) != set(expect_args):
    21. return False
    22. return all(args[k] == v for k, v in expect_args.items())
    23. # Usage example:
    24. # check_tool_call(model_output, "query_order", {"order_id": "A1024"})

    With a check function, you can repeatedly run the same set of cases under fixed random seeds and sampling parameters to get first-pass rate, pass rate after retries, and the distribution of failure types. This is the most reliable way — and the closest to real business — to compare different models and quantization versions.

    5.4 Treat Model Output as Untrusted Input

    Whichever model you choose, the agent side should treat model output as untrusted input:

    1. Strict Schema validation: parse first, then execute;
    2. Idempotency and approval: make write operations idempotent and add human confirmation for sensitive operations;
    3. Timeout and fallback: fall back to a text answer or prompt the user to handle it manually when a call fails.

    5.5 Models Iterate Fast, Evaluation Must Be Faster

    Model capabilities iterate monthly, and the choice that was best may be replaced a few versions later. Rather than betting on one model all at once:

    • Build an evaluation set that belongs only to your own business;
    • Use a unified interface to adapt to different models;
    • Before switching models, run the regression set first, then decide the canary ratio and rollback threshold.

    6. Deployment Details: Custom Branches, Co-residence, and Capacity Planning

    6.1 The Maintenance Cost of a Custom Inference Branch

    Running new model structures on older-architecture hardware often requires a community-maintained custom branch. Such branches usually lag behind the mainline and must be version-pinned with a full regression done on upgrade. A more subtle risk is numerical behavior in quantization: for the same model, different implementations and quantization types can handle numerically sensitive steps such as softmax and normalization differently, and these differences may amplify under long context into degraded output quality.

    When the budget allows, prefer a compute stack that the vendor officially and continuously supports. If a custom build is truly needed, be sure to keep a path back to the official version and compare version differences with the same evaluation set.

    A minimal reproducible environment checklist should include at least:

    • GPU model, VRAM capacity, and generation;
    • GPU interconnect method, such as PCIe version and number of lanes;
    • Operating system and driver version;
    • Compute stack version;
    • Inference runtime version and branch;
    • Model quantization format, such as 8-bit weights and 4-bit KV;
    • Launch parameters or a desensitized launch command;
    • Number of slots, context length, and VRAM utilization limit.

    An example launch command can keep only the key fields:

    1. --model-path /models/moe-26b-4b-w8
    2. --ctx 262144
    3. --slots 3
    4. --kv-bits 4
    5. --gpu-memory-utilization 0.92

    Such a checklist does not necessarily expose sensitive paths, but it helps a team reproduce problems, locate rollbacks, and make cross-comparisons.

    6.2 Use a Lightweight Model for Health Checks

    An inference service needs liveness probing, but inference on a heavy model is itself a load that lets probe requests interfere with real requests and even slow down its own responses. You can use the remaining VRAM to keep a small-parameter model resident. Compared to 20B-class models, 7B/8B-class small models usually occupy only about 4-5GB of VRAM after 4-bit quantization and are better suited to lightweight tasks such as health checks, intent classification, and request routing.

    Engineering-wise, isolate it from the main model:

    • Separate process, separate port;
    • Separate resource quota;
    • Separate monitoring and alerting.

    This way, a probe failure will not misjudge the main model’s status, and an abnormal small model will not consume the main service’s resources.

    6.3 Capacity Planning: Convert Context into Observable Metrics

    The cost of self-hosted deployment is mainly electricity, hardware depreciation, and operations manpower, and the core is to keep GPU utilization high; cloud deployment is usually billed by actual usage. Either way, the same set of metrics can drive decisions:

    Metric Meaning Use
    tokens/s, prefill and decode tracked separately Throughput capability Decide whether to add slots or upgrade hardware
    TTFT, first-token latency Perceived speed for users Optimize prefix caching and queuing strategy
    Slot utilization Concurrency saturation Decide whether to scale out or queue/degrade
    VRAM headroom Stability safety margin Trigger an alert when it drops below 10%

    For long-term stable workloads, the cost break-even between self-hosting and cloud pay-as-you-go differs, so it is recommended to run a small-traffic comparison with the metrics above before deciding. For teams without GPU operations experience, you can also evaluate a combination of general cloud products such as cloud GPU instances, container platforms, object storage, and monitoring/alerting. The general compute and operations products offered by mainstream cloud providers can serve as a reference when evaluating such approaches.

    7. FAQ

    1. How do you choose an MoE model for a modest GPU?

    Look at three parameters first: total parameters determine weight size, active parameters determine compute and memory-access pressure, and the KV structure determines long-context cost. MoE suits running a large-total-parameter model under low compute, but you must do the VRAM math first, then check whether it supports quantization and KV compression.

    2. Why does long context keep getting slower?

    Because each decode step must read the historical KV. The longer the context, the more KV must be read per step, and VRAM bandwidth becomes the bottleneck. KV quantization, prefix caching, and speculative decoding can mitigate this but cannot fully eliminate the trend.

    3. How do you reduce TTFT?

    Put a stable prefix into the cache and avoid putting volatile content such as timestamps and random IDs up front; apply prefix caching to system prompts, tool descriptions, and fixed documents; if necessary, prune the context or use hierarchical summarization to reduce the content re-prefilled each turn.

    4. What should you watch for with KV quantization?

    KV quantization can significantly reduce long-context VRAM pressure, but error accumulates over long contexts. Before going live, validate with test sets such as long-document retrieval, cross-section Q&A, and key-information location — do not just look at short-prompt output.

    5. Does multi-slot concurrency affect single-stream speed?

    Yes. Decode is a memory-access-intensive task, and multiple concurrent streams share VRAM bandwidth. The more slots, the larger the theoretical capacity, but single-stream speed may drop. Use stress testing to determine an acceptable lower bound for single-stream speed, combined with admission control.

    8. Summary: A Reusable Checklist

    Looking back over the whole deployment process, what is truly worth retaining is a reusable methodology:

    1. Do the VRAM math before choosing a model. Weights plus KV cache plus activations plus runtime margin — if any one estimate is too optimistic, it will surface all at once under long context.
    2. Explain throughput with the memory-access model. Decode speed is constrained by VRAM bandwidth; the longer the context, the higher the KV-read share, and high throughput at short context does not mean good long-context performance.
    3. Plan context capacity and concurrency capacity separately. For long-context scenarios, either reserve a dedicated slot or accept queuing, and set clear timeout and fallback strategies.
    4. Bring tool calling into evaluation. Quantifying first-pass rate and failure types with a fixed evaluation set is closer to real agent business than any benchmark score.
    5. Leave interfaces for model iteration. A unified adaptation layer, regression testing, canary release, and rollback mechanisms make switching models a routine operations task rather than a re-engineering effort.

    Back to the original question: what can an old-architecture GPU actually do? The answer is not a specific context number but an engineering workflow of doing the math first, stress-testing, then going live. Once you get it working, the generational gap in hardware is no longer an insurmountable wall.