Downloads · 30 days
15
11% of all-time downloads
AmanPriyanshu/gpt-oss-16.7b-specialized-all-pruned-moe-only-25-experts
gpt-oss-16.7b-specialized-all-pruned-moe-only-25-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
15
11% of all-time downloads
All-time downloads
140
Public
Parameters
16.7B
33.5 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors33.5 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 25 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 all 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 | ~16.7B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 25 |
| 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 | All |
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 general-purpose model maintains broad capabilities across all domains while significantly reducing computational requirements. It preserves the essential routing patterns discovered across our comprehensive analysis of diverse evaluation benchmarks including GPQA, MMLU, SORRY-Bench, and Tulu3 datasets.
The expert selection process utilized our comprehensive analysis of router activation patterns across multiple evaluation benchmarks:
By identifying experts that consistently activated for all tasks, we created this specialized model that maintains domain expertise while significantly reducing computational requirements from 32 to 25 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-16.7b-specialized-all-pruned-moe-only-25-experts",
torch_dtype=torch.bfloat16,
device_map="cpu",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-16.7b-specialized-all-pruned-moe-only-25-experts")
# Generate with the model
messages = [
{"role": "user", "content": "What is artificial intelligence and how does it work?"}
]
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-16.7b-specialized-all-pruned-moe-only-25-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-16.7b-specialized-all-pruned-moe-only-25-experts")
# Generate with the model
messages = [
{"role": "user", "content": "What is artificial intelligence and how does it work?"}
]
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 all tasks:
Question: What is artificial intelligence and how does it work?
Response:
<|channel|>analysis<|message|>Need explain AI, types, how works.<|end|><|start|>assistant<|channel|>final<|message|>## What is Artificial Intelligence?
Artificial Intelligence (AI) is the field of computer science that seeks to build systems capable of performing tasks that normally require human intelligence. These tasks include:
| Task | Typical Human Skill | AI Approach |
|------|---------------------|-------------|
| Recognizing faces | Visual perception | Computer vision, deep learning |
| Understanding language | Natural language comprehension | Natural‑language processing (NLP) |
| Playing chess | Strategic planning | Search algorithms, reinforcement learning |
| Driving a car | Perception + decision making | Sensor fusion + control systems |
| Diagnosing disease | Pattern recognition + medical knowledge | Machine learning + knowledge bases |
In short, **AI is about giving machines the ability to learn from data, reason about the world, and act autonomously or semi‑autonomously.**
---
## How AI Works – The Core Ingredients
| Component | What it does | Typical Techniques |
|-----------|--------------|--------------------|
| **Data** | The raw material from which models learn | Images, text, sensor streams, logs |
| **Representation** | How we encode knowledge | Feature vectors, embeddings, symbolic rules |
| **Learning** | Adjusting a model to fit data | Supervised, unsupervised, reinforcement learning |
| **Inference** | Using the model to make predictions or decisions | Forward/backward propagation, Monte‑Carlo search |
| **Actuation** | Executing actions in the real world | Robotics, API calls, recommendation engines |
| **Feedback** | Updating the system based on outcomes | Online learning, human‑in‑the‑loop |
Below is a step‑by‑step view of a typical AI pipeline:
1. **Collect Data**
*Example:* A self‑driving car collects LiDAR, camera, GPS, and IMU data.
2. **Pre‑process & Feature‑Engineer**
*Example:* Convert raw sensor streams into a set of numerical features (e.g., distance to nearest obstacle).
3. **Choose a Model**
*Example:* A convolutional neural network (CNN) for image classification, a recurrent neural network (RNN) for time‑series, or a transformer for language.
4. **Train the Model**
*Example:* Use stochastic gradient descent to minimize a loss function (e.g., cross‑entropy for classification).
5. **Validate & Test**
*Example:* Evaluate on
Question: Explain Einstein's theory of relativity in simple terms.
Response:
<|channel|>analysis<|message|>Need simple explanation.<|end|><|start|>assistant<|channel|>final<|message|>**Einstein’s Theory of Relativity – in plain, everyday language**
---
### 1. Two main ideas
| **Special Relativity** | **General Relativity** |
|------------------------|------------------------|
| Deals with objects moving at constant speeds (especially near the speed of light). | Deals with gravity and how it bends space and time. |
---
### 2. Special Relativity (1905)
1. **Speed of light is the same for everyone**
- No matter how fast you’re moving, light always travels at the same speed (≈ 300 000 km/s).
- This is like a “speed limit” that can’t be broken.
2. **Time and space are not absolute**
- If you’re moving fast, time for you ticks slower compared to someone standing still.
- Lengths shrink in the direction of motion.
- Think of a moving train: a clock on the train runs slower, and a ruler on the train looks a bit shorter to an outside observer.
3. **Mass and energy are interchangeable**
- The famous equation \(E = mc^2\) says that a tiny amount of mass can be converted into a huge amount of energy (because \(c^2\) is enormous).
**Why it matters:**
- Explains why GPS satellites need tiny corrections.
- Explains why particles in accelerators can reach enormous energies.
- Gives the foundation for modern physics (quantum field theory, etc.).
---
### 3. General Relativity (1915)
1. **Gravity is not a “force” but a curvature of space‑time**
- Imagine a heavy ball on a rubber sheet. The sheet sags around the ball.
- Smaller balls rolling nearby follow curved paths because the sheet is bent.
- In the universe, massive objects (planets, stars, black holes) bend the “fabric” of space‑time, and other objects move along those curves.
2. **Time runs slower where gravity is stronger**
- Near a massive planet, clocks tick a little slower than clocks far away.
- This is why GPS satellites (far from Earth’s gravity) run a tiny bit faster than clocks on the ground.
3. **Light follows the curves**
- Light rays bend around massive objects.
- This is why stars appear slightly shifted when their
Question: How does democracy function in modern governments?
Response:
<|channel|>analysis<|message|>Need to explain democratic functioning.<|end|><|start|>assistant<|channel|>final<|message|>**Democracy in Modern Governments: How It Functions Today**
Modern democracies are built on a set of shared principles—rule of law, political pluralism, and the protection of individual rights—but the exact mechanisms that bring those principles to life vary widely from country to country. Below is a concise, step‑by‑step overview of the key components that make a contemporary democratic system work, followed by a quick comparison of the most common models.
---
## 1. The Core Pillars
| Pillar | What It Means | Typical Institutional Forms |
|--------|---------------|------------------------------|
| **Popular Sovereignty** | The people are the ultimate source of political authority. | Universal, free, and secret elections; referenda; citizen‑initiated legislation. |
| **Rule of Law** | All actions by the state are bound by law, and laws are applied equally. | Independent judiciary; constitutional courts; legal codes that protect rights. |
| **Political Pluralism** | Multiple parties and viewpoints can compete for power. | Multi‑party systems; proportional or mixed electoral systems; campaign finance regulations. |
| **Civil Liberties & Human Rights** | Freedom of expression, assembly, religion, and privacy. | Constitutional guarantees; ombudsman offices; human‑rights commissions. |
| **Accountability & Transparency** | Public officials must explain and justify their actions. | Freedom‑of‑information laws; open‑budget systems; anti‑corruption agencies. |
---
## 2. The Everyday Mechanics
| Mechanism | How It Works | Typical Examples |
|-----------|--------------|------------------|
| **Elections** | Citizens vote for representatives or directly for policy. | Presidential, parliamentary, or local elections; proportional representation; ranked‑choice voting. |
| **Legislative Process** | Laws are drafted, debated, amended, and passed by elected bodies. | Bicameral parliaments; committee hearings; public consultations. |
| **Executive Function** | The elected head of state (president, prime minister) implements laws. | Cabinet appointments; executive orders; policy agendas. |
| **Judicial Review** | Courts interpret laws and can strike down unconstitutional acts. | Constitutional courts; appellate courts; judicial oversight of administrative actions. |
| **Civil Society & Media** | NGOs, unions, and the press hold the government accountable. | Freedom of the press; watchdog NGOs; public protests. |
| **Checks &
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}
}