Downloads · 30 days
5
3% of all-time downloads
shi3z/gpt-oss-20b-attn-repeat-L19-20
gpt-oss-20b-attn-repeat-L19-20 is a machine learning model from shi3z. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Applying the RYS (Repeat Your Steps) method to an MoE (Mixture-of-Experts) model. Achieves +13.3pp improvement on BBH-style reasoning benchmarks with no training and no weight changes -- only a forward pass modificati…
Downloads · 30 days
5
3% of all-time downloads
All-time downloads
180
Public
Parameters
20.9B
11.2 GB on disk
Likes
4
Public
Click a slice to open those files.
.safetensors11.2 GB · 100%
How the weights are stored.
U322.6B · 68%
From the Hugging Face model README
Applying the RYS (Repeat Your Steps) method to an MoE (Mixture-of-Experts) model. Achieves +13.3pp improvement on BBH-style reasoning benchmarks with no training and no weight changes -- only a forward pass modification at inference time.
The RYS method was originally discovered on dense models (Devstral-24B, Qwen2.5-32B), where duplicating specific transformer layers boosts reasoning ability.
We tested three repetition strategies on GPT-OSS-20B, an MoE model with 32 experts per layer (top-4 routing):
| Method | Description | Result |
|---|---|---|
| Expert-only repeat | Repeat only the MoE block (Router + Experts) | No effect or degradation |
| Full-block repeat | Repeat both Attention and MoE | Severe degradation (-20pp) |
| Attention-only repeat | Repeat only the Attention (dense) component | +13.3pp improvement |
Normal: x -> [Attention] -> [MoE: Router -> Top-4/32 Experts] -> out
Modified: x -> [Attention] -> [Attention (2nd pass)] -> [MoE: Router -> Top-4/32 Experts] -> out
Evaluated on 15 BBH-style reasoning questions covering logical deduction, tracking shuffles, arithmetic, causal judgement, navigation, boolean satisfiability, table reasoning, disambiguation, and Dyck languages.
Configuration Score Delta vs baseline
--------------------------------------------------
attn-L19-20 12/15 +13.3pp *** BEST
attn-L18-20 11/15 +6.7pp
baseline 10/15 0.0pp
attn-L18-19 10/15 0.0pp
attn-L17 9/15 -6.7pp
attn-L19-21 9/15 -6.7pp
attn-L16-20 8/15 -13.3pp
expert-repeat-L10-12 9/15 -6.7pp
full-block-L10-12 7/15 -20.0pp
from load_model import load_attn_repeat_model
from mlx_lm import generate
from mlx_lm.sample_utils import make_sampler
model, tokenizer = load_attn_repeat_model()
sampler = make_sampler(temp=0.0)
response = generate(model, tokenizer, prompt="Your question here", max_tokens=512, sampler=sampler)
print(response)
import mlx.nn as nn
from mlx_lm import load, generate
class AttentionRepeatWrapper(nn.Module):
def __init__(self, block):
super().__init__()
self.block = block
def __call__(self, x, mask, cache=None):
# First attention pass
residual = x
h = self.block.input_layernorm(x)
h = self.block.self_attn(h, mask, cache)
x = residual + h
# Second attention pass
residual = x
h = self.block.input_layernorm(x)
h = self.block.self_attn(h, mask, cache)
x = residual + h
# Single MoE pass
residual = x
h = self.block.post_attention_layernorm(x)
h = self.block.mlp(h)
x = residual + h
return x
model, tokenizer = load("mlx-community/gpt-oss-20b-MXFP4-Q4")
for idx in [19, 20]:
model.model.layers[idx] = AttentionRepeatWrapper(model.model.layers[idx])
Based on llm-circuit-finder (RYS method), adapted for MoE architectures. The key adaptation is the discovery that in MoE models, the dense component (Attention) should be targeted for repetition rather than the sparse component (Experts).
This suggests that the RYS effect is fundamentally about amplifying dense reasoning circuits, not about increasing model depth in general.
@misc{gpt-oss-20b-attn-repeat,
title={Attention Repeat for MoE Models: Applying RYS Method to GPT-OSS-20B},
author={shi3z},
year={2026},
note={Based on RYS method by David Ng and llm-circuit-finder by alainnothere}
}