Downloads · 30 days
17
10% of all-time downloads
AmanPriyanshu/gpt-oss-19.1b-specialized-all-pruned-moe-only-29-experts
gpt-oss-19.1b-specialized-all-pruned-moe-only-29-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
17
10% of all-time downloads
All-time downloads
164
Public
Parameters
19.1B
38.3 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors38.2 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 29 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 | ~19.1B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 29 |
| 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 29 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-19.1b-specialized-all-pruned-moe-only-29-experts",
torch_dtype=torch.bfloat16,
device_map="cpu",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-19.1b-specialized-all-pruned-moe-only-29-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-19.1b-specialized-all-pruned-moe-only-29-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-19.1b-specialized-all-pruned-moe-only-29-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 builds systems capable of performing tasks that normally require human intelligence. These tasks include:
| Human Skill | AI Equivalent |
|-------------|---------------|
| Perceiving (seeing, hearing) | Computer vision, speech recognition |
| Reasoning (solving problems, planning) | Algorithms, decision trees, logic programming |
| Learning (adapting from experience) | Machine learning, deep learning |
| Understanding language | Natural language processing (NLP) |
| Acting (moving, manipulating objects) | Robotics, autonomous vehicles |
In short, AI is about **making machines that can think, learn, and act**—often in ways that mimic or even surpass human abilities.
---
## How Does AI Work? (A High‑Level View)
1. **Data Collection & Representation**
- AI systems learn from data. This can be images, text, sensor readings, or any structured/unstructured information.
- Data is cleaned, labeled, and transformed into a format the algorithm can use (e.g., pixel arrays, word embeddings).
2. **Model Selection**
- Choose a computational model that can capture patterns in the data. Common families:
- **Statistical models** (e.g., linear regression, logistic regression)
- **Symbolic AI** (rule‑based systems, knowledge graphs)
- **Neural networks** (deep learning, CNNs, RNNs, transformers)
- **Hybrid models** (combining symbolic and neural approaches)
3. **Training (Learning)**
- The model is exposed to data and adjusts its internal parameters to minimize a **loss function** (a measure of error).
- **Gradient descent** and its variants (Adam, RMSProp) are the most common optimization algorithms.
- Training can be supervised (labels provided), unsupervised (discover structure), or reinforcement (learn from rewards).
4. **Evaluation & Validation**
- Split data into training, validation, and test sets.
- Use metrics (accuracy, precision, recall, F1, BLEU, etc.) to gauge performance.
- Perform hyper‑parameter tuning, cross‑validation, and regularization to avoid overfitting.
5. **Deployment & Inference**
- Once trained, the model is deployed to a target environment (cloud, edge device, mobile app).
- During
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** is really two ideas that changed how we think about space, time, and gravity. Think of them as two “rules” that tell us how the universe behaves when things move fast or are near massive objects.
---
## 1. Special Relativity (1905)
### The two postulates
1. **The laws of physics are the same for everyone who is moving at a constant speed** (no “preferred” reference frame).
2. **The speed of light in a vacuum is always the same (≈ 299 792 km/s)**, no matter how fast you’re moving or where you are.
### What that means in everyday language
| Concept | Everyday picture | What actually happens |
|---------|------------------|-----------------------|
| **Time slows down** | A clock on a fast‑moving train ticks slower than a clock on the platform. | Time is relative; the faster you move, the more your own time dilates (slows). |
| **Length shrinks** | A moving car looks shorter in the direction of motion. | Objects contract along the direction of motion, but only noticeable at speeds close to light. |
| **Mass increases** | A car feels heavier as it speeds up. | As you approach light speed, your relativistic mass grows, making it harder to accelerate further. |
| **Energy–mass equivalence** | “Energy is just another form of mass.” | \(E = mc^2\): a tiny amount of mass can be converted into a huge amount of energy. |
**Bottom line:** If you could travel near light speed, you would age slower than people who stayed on Earth, and distances would appear shorter in the direction you’re moving.
---
## 2. General Relativity (1915)
### The core idea
Gravity is not a “force” pulling objects together; it’s the **curvature of spacetime** caused by mass and energy.
### Visualizing it
- Imagine a heavy ball (the Sun) placed on a stretched rubber sheet (spacetime).
- The ball creates a dip in the sheet.
- A smaller marble (Earth) rolls around the dip, following a curved path—not because a force pulls it, but because the sheet itself is curved.
### Consequences
| Effect | Everyday analogy | Real‑world observation |
|--------|------------------|------------------------|
| **Light
Question: How does democracy function in modern governments?
Response:
<|channel|>analysis<|message|>Need to explain democratic functioning.<|end|><|start|>assistant<|channel|>final<|message|>### 1. What “democracy” means today
Modern democracies are usually **constitutional republics** that combine:
| Core Feature | What it looks like in practice | Why it matters |
|--------------|--------------------------------|----------------|
| **Rule of law** | A written constitution, independent courts, and clear statutes | Prevents arbitrary power |
| **Separation of powers** | Executive, legislature, judiciary operate independently | Checks and balances |
| **Free and fair elections** | Regular, competitive, secret‑ballot voting | Legitimacy of the government |
| **Political pluralism** | Multiple parties, interest groups, and civil society | Representation of diverse views |
| **Civil liberties** | Freedom of speech, press, assembly, religion | Enables dissent and accountability |
| **Accountability mechanisms** | Audits, ombudsmen, media scrutiny | Holds officials responsible |
### 2. How the system works in practice
| Stage | Typical Process | Key Institutions | Common Variations |
|-------|-----------------|-------------------|-------------------|
| **Electoral cycle** | 1. Parties nominate candidates 2. Campaigning 3. Voting 4. Counting 5. Certification | Electoral commissions, political parties, media | Some use proportional representation, others first‑past‑the‑post |
| **Legislative function** | Bills drafted → committee review → floor debate → vote → executive assent | Parliament/ congress, committees, opposition | Bicameral vs unicameral, filibuster rules |
| **Executive function** | President/prime minister sets policy agenda, appoints ministers, signs laws | Head of state, cabinet, civil service | Presidential vs parliamentary systems |
| **Judicial function** | Interprets laws, adjudicates disputes, reviews constitutionality | Supreme court, lower courts | Judicial review powers vary |
| **Oversight & checks** | Auditors, ombudsmen, investigative committees, media | Comptroller‑auditor general, parliamentary oversight committees | Some countries have stronger anti‑corruption agencies |
### 3. The “daily” mechanics
1. **Policy debate** – Legislators discuss bills; public hearings allow citizen input.
2. **Voting** – Majority rules, but minority rights are protected (e.g., veto overrides, filibusters).
3. **Implementation** – Civil servants execute laws; agencies monitor compliance.
4. **Feedback** –
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}
}