Downloads · 30 days
331
25% of all-time downloads
AmanPriyanshu/gpt-oss-10.8b-specialized-all-pruned-moe-only-15-experts
gpt-oss-10.8b-specialized-all-pruned-moe-only-15-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
331
25% of all-time downloads
All-time downloads
1.3K
Public
Parameters
10.8B
21.5 GB on disk
Likes
3
Public
Click a slice to open those files.
.safetensors21.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 15 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 | ~10.8B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 15 |
| 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 15 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.8b-specialized-all-pruned-moe-only-15-experts",
torch_dtype=torch.bfloat16,
device_map="cpu",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-10.8b-specialized-all-pruned-moe-only-15-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-10.8b-specialized-all-pruned-moe-only-15-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.8b-specialized-all-pruned-moe-only-15-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, definition, components, how it works.<|end|><|start|>assistant<|channel|>final<|message|>## 1. What is Artificial Intelligence?
Artificial Intelligence (AI) is a field of computer science that seeks to build systems capable of **intelligent behavior**—that is, the ability to learn, reason, and act in a way that mimises human cognition.
In practice, AI systems are built from a combination of:
| Component | What it does | Typical technology |
|---|---|---|
| **Sensors / Input** | Gathers raw data (text, images, sound, etc.) | Cameras, microphones, text encoders |
| **Representation** | Turns raw data into a machine‑friendly format | Neural‑network layers, symbolic models, graphs |
| **Processing / Reasoning** | Manipulates the representation to produce insights | Algorithms, inference engines, pattern‑matching |
| **Learning** | Improves the system over time | Machine‑learning, reinforcement learning, deep‑learning |
| **Output / Action** | Communes or acts on the insight | Speech, text, images, robot motion |
The “intelligence” comes from the system’s ability to **learn from experience** (data) and **generalize** that learning to new situations.
---
## 2. How AI Works – A Step‑by‑Step Overview
Below is a simplified pipeline that most AI systems follow. The exact details vary by domain (e.g., language, vision, robotics), but the core ideas are the same.
### 1. **Data Acquisition**
- **Input**: Sensors or pre‑existing data (e.g., a sentence, a photo, a video clip).
- **Encoding**: Convert the raw signal into a digital format (e.g., bytes, pixels, tokens).
### 2. **Representation**
- **Modeling**: Build a structure that captures the essential features of the input.
- *Symbolic models*: Grammar trees for language, logic gates for circuits.
- *Statistical models*: Feature vectors, probability distributions.
- *Neural models*: Layers of neurons that learn patterns.
### 3. **Processing / Reasoning**
- **Inference**: Apply rules or learned patterns to the representation.
- *Rule‑based*: If‑then logic, Boolean networks.
- *Statistical*: Bayesian inference, expectation maximization.
- *Neural*: Conference of layers, attention mechanisms.
### 4. **Learning**
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 words**
---
### 1. What the theory is about
Einstein’s work is split into two main ideas:
| **Part** | **What it says** | **Why it matters** |
|---|---|---|
| **Classical (First) Relativity** | The speed of a moving object is measured relative to a reference point. | It explains why a car looks faster when you’re on a moving train. |
| **Quantum (Second) Relativity** | Space and time are not fixed; they can change depending on how fast something moves, especially near very fast (near‑light‑speed) objects. | It shows that the universe is a “soup” of particles that can behave in ways we can’t see with normal eyes. |
---
### 2. The “Classical” part – *Relative speed*
- **Speed is relative**: If you’re on a car that’s moving at 100 km/h, a car that’s moving at 200 km/h looks like it’s going 100 km/h faster.
- **No absolute speed**: There is no single “speed” that exists everywhere; it always depends on who’s point of reference.
---
### 3. The “Quantum” part – *Space, time, and light*
- **Particles can be “fuzzy”**: In the quantum world, particles can be in many places at the same time.
- **Light is a particle**: Light isn’t a single, fixed thing; it’s a stream of particles that can move at the speed of light (≈ 300 000 km/s).
- **Time can bend**: Near a very fast object (like a super‑fast spaceship or a black hole), the flow of time can change. Things that happen in the future can appear to happen sooner or later.
---
### 4. How it changed our view
- **Gravity is not a force**: Einstein showed that gravity is a *field* that pulls objects because of the way space itself is arranged.
- **The universe is a “wave”**: The universe is full of waves (light, sound, etc.) that carry information.
- **New physics**: The theory opened the way to quantum mechanics, explaining why atoms behave in ways that classical physics can’t predict.
---
### 5. Everyday
Question: How does democracy function in modern governments?
Response:
<|channel|>analysis<|message|>Need to explain how democracy functions in modern governments. Provide overview of institutions, processes, checks, representation, elections, rule of law, etc.<|end|><|start|>assistant<|channel|>final<|message|>### 1. What “democracy” means today
In contemporary politics “democracy” is not a single, fixed model. It is a **set of practices and institutions** that allow citizens to influence the political process, while also protecting minority rights, the rule of law, and the stability of the state. Most modern democrans share a few core features:
| Feature | Typical expression in a modern state | Why it matters |
|---|---|---|
| **Representative institutions** (parliament, council, etc.) | Legislators elected by proportional or district‑based ballots | Gives a voice to the electorate in law‑making |
| **Free, competitive elections** | Regular, multi‑party contests with universal suff suff | Determines who will hold office |
| **Rule of law & separation of powers** | Judiciary independent, executive & legislature distinct | Prevents abuse of power |
| **Civil‑society participation** | NGOs, media, protests, public consultation | Allows citizens to shape policy beyond ballots |
| **Checks & balances** | Constitutional limits, oversight bodies, judicial review | Keeps power in check |
| **Protection of minorities** | Quotas, affirmative‑action laws, constitutional safeguards | Prevents tyranny of the majority |
These elements can be arranged in different ways (parliamentary vs. presidential, federal vs. unitary, etc.), but the combination of them is what modern democrans call “democracy.”
---
### 2. How the system works in practice
#### 2.1 The electoral cycle
1. **Campaigning** – Parties and candidates present platforms, debate, and advertise.
2. **Voting** – Citizens cast ballots (paper, electronic, absentee).
3. **Counting & certification** – Election commissions verify results.
4. **Transition** – Newly elected officials assume office, often after a “hand‑over” period.
The electoral cycle is the most visible democratic mechanism, but it is only one layer of governance.
#### 2.2 Representative bodies
- **Parliament / Congress**: Drafts laws, debates policy, and holds the executive accountable.
- **Executive (President, Prime Minister, etc.)**: Implements laws, runs the state, and is usually elected or appointed by the legislature.
- **
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}
}