Big moment for Local AI!
Running models locally always had one hard rule. If the weights didn’t fit in GPU VRAM or unified memory, the model didn’t work.
That rule is why running a 180B-class open model has meant buying a $10-20K workstation.
But this is about to change.
In the video below, we’re running Qwen 3.8 Flash Next, a 180B model, on an M4 Max with 64 GB of memory.
It runs in OpenCode at 56 tokens/sec, with a 2-bit quant and a 64k context.
This sounds impossible, but it works because of how today’s open models are built.
They are sparse mixture-of-experts (MoE) models. Each layer holds many small sub-networks called experts, and a router picks only a few of them per token.
Qwen 3.8 Flash Next has 180B parameters, but only ~6B run on any given token. So ~97% of the model sits idle on every token, and local runners still keep all of it in VRAM.
SSD expert streaming fixes this. It keeps attention and the session’s most-reused experts in fast GPU or unified memory.
Everything else stays on the NVMe SSD, and the engine reads it only when the router picks it.
However, it’s not as simple as it sounds. A naive version of SSD streaming crawls at a couple of tokens/sec, and there are four reasons why:
↳ a basic cache evicts experts the next few tokens need again.
↳ layer-by-layer disk reads leave the GPU and SSD waiting on each other.
↳ speculative decoding verifies several tokens at once, so each step touches more experts.
↳ long prompts flush the cache that decoding depends on.
Magnitude, an open-source inference engine, solves all four together:
↳ It ranks experts by reuse and keeps the top ones in GPU memory, so most tokens never touch the disk.
↳ It peeks at upcoming tokens and prefetches their experts before the GPU stalls.
↳ It schedules direct NVMe reads across layers and bypasses OS swap entirely.
↳ During prefill, it reads each cold expert once per layer while the GPU computes, so long prompts don’t wipe the hot cache.
Streaming never writes to the SSD, so there’s no flash wear. More RAM or VRAM still helps, since it keeps more experts hot.
On first launch, Magnitude profiles the hardware, predicts tokens/sec for each model before download, and tunes kernels for that exact chip. There are no flags to set.
It runs on Apple Silicon, NVIDIA, AMD, Intel, or plain CPU, as a desktop app, CLI, or Docker image. Claude Code, Codex, OpenCode, and Cline connect in one click, with an OpenAI-compatible API for everything else.
We think this is the biggest change to local inference since quantization. The limit on what runs at home moves from VRAM size to SSD speed.
A fast NVMe drive costs a fraction of a high-end GPU.
It’s free, Apache 2.0 licensed, and fully local.
Check this out: https://github.com/magnitudedev/magnitude
(don’t forget to star 🌟)
16 policy optimization methods for LLM training
Suppose we’re training an LLM to write Python functions. We give it a problem and let it generate an answer, one token choice at a time.
The resulting sequence is a trajectory. For a text-only task, that can be the generated response. For an agent, a trajectory can also include tool calls, tool results, and subsequent actions.
A verifier evaluates the outcome and turns it into a reward. For code, that might mean running tests and assigning 1 for a passing answer and 0 for a failing one.
Passing the tests tells us that the generated sequence achieved the checked outcome. It doesn’t establish that every intermediate token or reasoning step was useful, and incomplete tests can miss errors.
RL uses these scored trajectories to adjust the model’s internal weights. The aim is to make choices associated with better outcomes more likely. The model’s probabilities for choosing tokens are called its policy.
Policy optimization determines how this adjustment happens. The methods below differ in what a score is compared against, how strongly each trajectory affects training, and how credit reaches individual decisions.
To dive deeper, we’ve covered reinforcement learning from scratch in our 13-part course, building from rewards and value functions to PPO, RLHF, and GRPO.
It explains how these methods work and how they connect to training LLMs and agents.
REINFORCE
REINFORCE uses a trajectory’s reward to scale its contribution to learning. In our pass-or-fail example, a successful answer supplies a positive signal encouraging its sampled token choices.
A reward of zero supplies no direct reward-weighted push in this simple setup. It does not automatically mean the model receives a negative penalty.
When a trajectory accumulates several rewards, their combined total is called its return. Variation between sampled trajectories can make this learning signal noisy.
PPO
PPO trains a critic to predict the reward total expected from a response or partial response. This prediction gives the observed result a reference point, called a baseline.
If the critic predicts 0.4 and the result receives 1, the outcome was 0.6 better than expected. That difference is the advantage used to guide learning.
PPO also uses a clipped objective to discourage some large probability changes. The critic can help judge intermediate decisions, but training it adds memory and compute costs.
RLOO
RLOO obtains a baseline from other answers to the same prompt, instead of training a critic. It generates several answers and scores each one.
Each answer is compared with the average reward of the others, excluding itself. A passing answer whose peers all fail therefore scores above its baseline.
The comparison is specific to that prompt. Removing the critic saves resources, but generating several answers still costs compute.
REINFORCE++
REINFORCE++ normalizes advantages across the global training batch. Normalization rescales the learning signals so their magnitudes are more consistent.
The distinction is where those scaling statistics come from. It uses the wider batch rather than separately scaling every small group of answers to one prompt.
It also uses stabilization techniques such as PPO-style clipping without a learned critic. The comparison baseline and the normalization scope remain separate choices.
GRPO
GRPO generates several answers per prompt and compares their rewards with the group’s average. It avoids training a separate critic.
For rewards of 1, 0, 0, 0, the average is 0.25. Subtracting it gives +0.75 for the passing answer and -0.25 for each failure, before further scaling.
The original formulation divides these differences by the group’s standard deviation, which measures reward spread. If every reward is identical, the group provides no relative difference to learn from.
Dr. GRPO
GRPO’s scaling choices can change which examples influence learning most. Dividing by reward spread can give different update scales to groups with different score patterns.
Dr. GRPO removes this standard-deviation scaling. It also replaces division by each response’s own length with a fixed normalization factor.
The purpose is to address biases introduced by those calculations. It changes how existing rewards affect learning, rather than introducing a new verifier or reward function.
DAPO
DAPO uses dynamic sampling to filter groups whose answers all receive the same reward. It retains groups containing a contrast the model can learn from.
It also combines different clipping thresholds in the two directions, token-level loss aggregation, and handling of overlong responses. Loss aggregation determines how token contributions are combined for training.
The filtered answers still cost compute to generate. A more useful update batch can require more sampling, so both expenses belong in the comparison.
GSPO
After an update, the model may assign different probabilities to tokens in an older trajectory. If a token’s probability changes from 0.1 to 0.2, its current-to-old probability ratio is 2.
These importance ratios help account for the difference between the current policy and the policy that generated the data. GSPO combines the comparisons into one length-normalized ratio per response.
It then applies sequence-level clipping. The response shares an update-control decision, rather than each token having an independently clipped ratio.
CISPO
CISPO clips the importance-sampling weights used to scale learning contributions. These weights are numerical factors, distinct from the internal model parameters being trained.
During gradient calculation, it treats the clipped factors as fixed. The model still learns through the log-probabilities of its generated token choices.
This can preserve learning contributions that a conventional clipped objective would suppress. The distinction is what gets clipped and differentiated, rather than whether the model receives an update.
SAPO
SAPO replaces hard clipping with a smooth gate that controls the influence of token updates. Its temperature setting adjusts how that influence changes.
For highly off-policy tokens, whose probabilities differ substantially from those under the sampling policy, the method gradually reduces their contribution.
The aim is to control unstable updates while retaining useful learning signals. It changes how generated data influences training rather than changing how trajectories receive rewards.
ReMax
ReMax generates an additional answer using greedy decoding. At each position, this chooses the highest-probability next token.
A verifier scores that answer, and its reward becomes the baseline. Training compares a sampled answer’s reward against the greedy answer’s reward.
This supplies a comparison without a learned critic. The tradeoff is the extra generation needed to produce the greedy answer.
OPO
OPO uses fresh trajectories generated by the policy being updated. This is on-policy training, meaning the data comes from the model’s current behavior.
It combines this sampling approach with a reward baseline designed to reduce variation in the gradient estimate. That baseline gives each observed reward a comparison point.
Keeping sampling and updating closely aligned reduces mismatch between them. It also limits how much older generated data can be reused.
GMPO
A few extreme importance ratios can exert too much influence on an update. GMPO addresses this through geometric-mean aggregation.
This changes how contributions across tokens are combined, with the aim of reducing sensitivity to outlying ratios.
Like GSPO, it makes aggregation part of the update design. A higher-scoring trajectory can still produce a different training signal depending on that design.
LitePPO
LitePPO subtracts the average reward within each prompt’s response group. This provides the local comparison between answers.
For scaling, it uses the standard deviation of rewards across the wider batch. It also aggregates loss contributions at the token level.
The group therefore supplies the comparison, while the batch supplies the scale. This shows why two methods using the same rewards can still weight their training examples differently.
VAPO
A final reward doesn’t identify which steps in a long trajectory helped. A critic tries to address this by predicting the future reward from intermediate states.
VAPO improves critic-based training for long reasoning. It addresses inaccurate value estimates, different response lengths, and sparse rewards that arrive only after many steps.
It keeps the critic and improves how training uses it. This takes a different approach from methods that remove the critic to reduce cost.
VinePPO
VinePPO estimates the value of an intermediate reasoning state by generating several continuations from it. Each continuation reaches an outcome that can be scored.
Those outcomes provide evidence about the reward expected from that earlier state. This gives training a more direct basis for assigning credit to intermediate decisions.
The method obtains these estimates through sampling rather than relying on a learned value network. Collecting that evidence requires additional rollout work.
In practice, we’d inspect the trajectories and rewards before switching algorithms. If every answer fails, a group-relative method has no reward contrast. If probability ratios become extreme, the update controls need attention.
A rising reward curve also needs checking against the real task. A model may exploit incomplete tests or a weak verifier, so evaluate unseen problems and inspect the generated answers.
Finally, count the complete training cost. Removing a critic saves resources, but generating more trajectories adds expense. A useful improvement should hold across repeated runs after counting sampling and update costs.
To dive deeper, our 13-part RL course builds the foundations behind these methods, then applies them to LLM training and agent workflows.
Good day!






















