Skip to content

Feature: Predictive Expert Offloading #176

Description

@Chavell3

I like to propose/ask for a multi-tier GPU expert scheduling mechanism using Model-Token-Prediction (MTP) (but maybe there is another way for predicting the next epert) to optimally distribute MoE experts across multiple GPUs for improved performance and resource efficiency.
I don't know if this is technically possible, but this would be a great leverage for MOE-Models I'd say.

Motivation
Current FreeToken implementation primarily uses a single GPU for expert loading with dynamic VRAM re-allocation. For frontier-scale MoE models (e.g., DeepSeek-V4-Flash, Qwen3.6-35B-A3B) that require loading multiple experts simultaneously, single GPU VRAM can become a bottleneck, especially on Consumer hardware.
Also a benefit, this would overcome/reduce low CPU ressources for experts not im GPU already.

Proposed Enhancement
Three-Tier Expert Distribution
┌─────────────────────────────────────────────────────────────┐
│ MoE Inference │
├─────────────────────────────────────────────────────────────┤
│ │
│ Tier-1: Primary GPU → High-frequency/Important Experts │
│ Tier-2: Secondary GPU → Next-layer experts (MTP predicted) │
│ Tier-3: System RAM → Remaining experts (fallback) │
│ │
└─────────────────────────────────────────────────────────────┘
Key Components

  1. MTP-Based Expert Prediction
    Use Model-Token-Prediction to estimate which experts will be needed for the next token
    Proactively load predicted Tier-2 experts into Secondary GPU before required
    Minimize latency from RAM→GPU loading during inference
  2. Dynamic Expert Scheduling
# Pseudocode for expert scheduling
def schedule_experts(token, current_experts):
    # Predict next needed expert via MTP
    predicted_expert = mtp_predict_next_expert(token)

    # Load into appropriate tier
    if predicted_expert not in Tier-2:
        load_expert_to_gpu(predicted_expert, GPU_TIER_2)

    # Process with optimal expert distribution
    result = execute_with_tiered_experts(token)
    return result
  1. Inter-GPU Communication Optimization
    Implement efficient expert tensor exchange patterns
    Minimize data transfer overhead during token processing

Technical Challenges
Prediction Accuracy: MTP must accurately predict expert needs to avoid unnecessary VRAM usage
Communication Latency: Inter-GPU data transfer should not bottleneck inference
Memory Management: Efficiently manage VRAM across multiple GPUs with dynamic expert loading
Synchronization: Ensure correct coordination between primary and secondary GPU computations

Benefits
Reduced VRAM Pressure: Distribute experts across multiple GPUs
Lower Latency: Proactive expert loading reduces memory access time
Better Hardware Utilization: Leverage secondary GPU for less critical experts
Scalability: Easily expand to 3+ GPUs as needed
Example Use Case
For a 7B MoE model with 16 experts on an RTX 4090 (24GB VRAM):

Load 8 experts on Primary GPU (Tier-1)
Pre-load next predicted expert on Secondary GPU (Tier-2)
Keep remaining experts in RAM (Tier-3)
This could reduce memory access latency by ~30-50% for frequently accessed expert sequences.

Questions for Discussion
How accurate can MTP predict expert access patterns?
What's the acceptable trade-off between prediction accuracy and latency?
Should this be opt-in or default for specific model sizes?
How should we handle expert eviction when VRAM becomes full?
Implementation Notes
This builds on FreeToken's existing bandwidth-adaptive CPU-GPU co-execution and dynamic VRAM re-allocation
Could integrate with existing expert routing mechanisms
May require modifications to the expert loading/scheduling logic
Use Case: Frontier-scale MoE models on Consumer hardware (RTX 30/40/50 series)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions