Downloads · 30 days
12
1% of all-time downloads
AmanPriyanshu/gpt-oss-10.2b-specialized-instruction_following-pruned-moe-only-14-experts
gpt-oss-10.2b-specialized-instruction_following-pruned-moe-only-14-experts is a text generation model from AmanPriyanshu. Use it when you need the model to write or continue text. The card lists the license as apache-2.0.
Project: https://amanpriyanshu.github.io/GPT-OSS-MoE-ExpertFingerprinting/
Downloads · 30 days
12
1% of all-time downloads
All-time downloads
1.2K
Public
Parameters
10.2B
20.3 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors20.3 GB · 100%
From the Hugging Face model README
Project: https://amanpriyanshu.github.io/GPT-OSS-MoE-ExpertFingerprinting/
<div align="center">This is a pruned variant of OpenAI's GPT-OSS-20B model, reduced to 14 experts per layer based on activation patterns from the AmanPriyanshu/GPT-OSS-20B MoE Expert Activations dataset. We analyzed router decisions across evaluation benchmarks to identify and retain experts most relevant for instruction following tasks.
⚠️ Experimental Model: This is an experimental pruned model that may not work well - check the examples below to see if the outputs meet your needs before use.
This pruning approach reduces the model size while attempting to preserve performance on the target domain.
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~10.2B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 14 |
| Layers | 24 |
| Top-k Routing | 4 |
| Context Length | 128K tokens |
| Attention Heads | 64 (Query), 8 (Key-Value) |
| Residual Dimension | 2880 |
| Attention Pattern | Alternating dense & sliding window (128 tokens) |
| Positional Encoding | RoPE (Rotary Position Embedding) |
| Normalization | RMSNorm |
| Precision | BF16 |
| License | Apache 2.0 |
| Specialization | Instruction Following |
Mixture-of-Experts models contain multiple specialized sub-networks (experts) per layer. During inference, only a subset of experts are activated for each token. Expert pruning involves:
Note: Performance may vary depending on how well the pruned experts match your specific use case.
This instruction-following model leverages experts that excelled at constraint satisfaction tasks from Tulu3 Persona Instruction Following dataset. These experts specialize in precise adherence to user specifications and formatting requirements.
The expert selection process utilized our comprehensive analysis of router activation patterns across multiple evaluation benchmarks:
By identifying experts that consistently activated for instruction following tasks, we created this specialized model that maintains domain expertise while significantly reducing computational requirements from 32 to 14 experts per layer.
This model is based on analysis from the GPT-OSS-20B MoE Expert Activations dataset available at: 🔗 https://huggingface.co/datasets/AmanPriyanshu/GPT-OSS-20B-MoE-expert-activations
The dataset contains router activation patterns from OpenAI's GPT-OSS-20B model across diverse evaluation benchmarks, enabling the creation of these domain-optimized models through systematic expert pruning.
Our approach involves:
This is a direct pruning approach - no additional training was performed. The model inherits all capabilities from the original GPT-OSS-20B with focused expert selection.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load the specialized model on CPU
model = AutoModelForCausalLM.from_pretrained(
"AmanPriyanshu/gpt-oss-10.2b-specialized-instruction_following-pruned-moe-only-14-experts",
torch_dtype=torch.bfloat16,
device_map="cpu",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-10.2b-specialized-instruction_following-pruned-moe-only-14-experts")
# Generate with the model
messages = [
{"role": "user", "content": "Write a formal email to a professor requesting a meeting, including: subject line, greeting, purpose, proposed times, and professional closing."}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
reasoning_effort="medium"
)
# Ensure inputs are on the same device as model
inputs = {k: v.to(model.device) for k, v in inputs.items()}
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.1,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id
)
# Decode only the generated part
input_length = inputs['input_ids'].shape[1]
response_tokens = outputs[0][input_length:]
response = tokenizer.decode(response_tokens, skip_special_tokens=True)
print(response)
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Check MPS availability and load model
device = "mps" if torch.backends.mps.is_available() else "cpu"
model = AutoModelForCausalLM.from_pretrained(
"AmanPriyanshu/gpt-oss-10.2b-specialized-instruction_following-pruned-moe-only-14-experts",
torch_dtype=torch.float16, # Better MPS compatibility
device_map=device,
trust_remote_code=True,
low_cpu_mem_usage=True
)
tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-10.2b-specialized-instruction_following-pruned-moe-only-14-experts")
# Generate with the model
messages = [
{"role": "user", "content": "Write a formal email to a professor requesting a meeting, including: subject line, greeting, purpose, proposed times, and professional closing."}
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt",
return_dict=True,
reasoning_effort="medium"
)
# Move inputs to model device
inputs = {k: v.to(model.device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
# Use torch.no_grad for MPS stability
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=512,
do_sample=True,
temperature=0.1,
top_p=0.9,
pad_token_id=tokenizer.eos_token_id,
eos_token_id=tokenizer.eos_token_id,
use_cache=True
)
# Decode only the generated part
input_length = inputs['input_ids'].shape[1]
response_tokens = outputs[0][input_length:]
response = tokenizer.decode(response_tokens, skip_special_tokens=True)
print(response)
For CUDA GPU inference, the models work with minimal modifications from the CPU example above. Simply change:
device_map="auto" # Will automatically use GPU if available
torch_dtype=torch.bfloat16 # or torch.float16
The following examples demonstrate the model's performance on instruction following tasks:
Question: Write a formal email to a professor requesting a meeting, including: subject line, greeting, purpose, proposed times, and professional closing.
Response:
<|channel|>analysis<|message|>Need formal email.<|end|><|start|>assistant<|channel|>final<|message|>**Subject:** Request for Meeting – Discussion of Research Progress
Dear Professor [Last Name],
I hope you are doing well. I would like to request a brief meeting with you to discuss the current status of my research project and to seek your guidance on the next steps.
Could you please let me know a convenient time for a 15‑minute meeting next week? I am available on Monday (10 – 11 a.m.) or Wednesday (2 – 3 p.m.), but I am happy to adjust to a slot that fits your schedule.
Thank you for your time and consideration.
Sincerely,
[Your Full Name]
[Program / Department]
[University]
[Phone] | [Email]<|return|>
Question: Create a numbered list of steps for making scrambled eggs, using exactly 6 steps.
Response:
<|channel|>analysis<|message|>Need 6 steps numbered.<|end|><|start|>assistant<|channel|>final<|message|>1. **Gather ingredients** – Grab a bowl, a whisk, a spoon, a pan, and a few eggs (usually 2–3 for a single person).
2. **Crate the eggs** – Crack each egg into a separate bowl or a single bowl if you prefer a uniform mix.
3. **Whate the batter** – Beat the eggs with a whisk until the yoly‑white mixture is smooth and slightly thickened.
4. **Add seasoning** – Stir in a pinch of salt, pepper, and any optional flavorings (e.g., milk, cheese, herbs).
5. **Heat the pan** – Place the pan on a stove or hot‑plate, turn it to medium‑high heat, and wipe the surface with a clean cloth.
6. **Cook and serve** – Drop the whisked batter into the pan, let it bubble and rise, then flip or scoop the fluffy eggs onto a plate for a quick, tasty breakfast.<|return|>
Question: Summarize the water cycle in exactly 50 words, no more, no less.
Response:
<|channel|>analysis<|message|>Need 50 words exactly. Let's craft: "Water originates in the atmosphere as vapor, condens into clouds, falls as precipitation, travels through rivers, lakes, and oceans, evaporates into soil, fuels plants, returns to atmosphere as vapor, completing the cycle." Count words. Let's count: Water(1) originates(2) in(3) the(4) atmosphere(5) as(6) vapor,(7) condens(8) into(9) clouds,(10) falls(11) as(12) precipitation,(13) travels(14) through(15) rivers,(16) lakes,(17) and(18) oceans,(19) evaporates(20) into(21) soil,(22) fuels(23) plants,(24) returns(25) to(26) atmosphere(27) as(28) vapor,(29) completing(30) the(31) cycle(32). That's 32 words. Need 50. Add more: "During this journey, water supports life, shapes landscapes, and sustures ecosystems, while human activities influence its distribution, quality, and availability, demanding stewardship to preserve this vital, renewable resource for future generations." Count new words: During(3) journey,(4) water(5) supports(6) life,(7) shapes(8) landscapes,(9) and(10) sustures(11) ecosystems,(12) while(13) human(14) activities(15) influence(16) its(17) distribution,(18) quality,(19) and(20) availability,(21) demanding(22) stewardship(23) to(24) preserve(25) this(26) vital,(27) renewable(28) resource(29) for(30) future(31) generations(32). That's 32 more. Total words: 32+32=64. Need 50. Let's adjust. We need exactly 50 words. Let's craft anew.
I'll write 50 words: "Water begins as atmospheric vapor, condens into clouds, falls as precipitation, travels through rivers, lakes, and oceans, evaporates into soil, fuels plants, returns to atmosphere as vapor, completing the cycle. This flow sustures life, shapes landscapes, and requires stewardship to preserve its quality for future generations." Count words.
Water(1) begins(2) as(3) atmospheric(4) vapor,(5) condens(6) into(7) clouds,(8) falls(
If you use this model in your research, please cite:
@misc{priyanshu2025gptoss,
title={{GPT-OSS MoE Expert Fingerprinting: Analyzing Expert Activation Patterns in Mixture of Experts Models}},
author={Priyanshu, Aman and Vijay, Supriti},
year={2025},
howpublished={\url{https://amanpriyanshu.github.io/GPT-OSS-MoE-ExpertFingerprinting/}},
note={Interactive analysis tool for expert activation patterns in MoE architectures}
}