Downloads · 30 days
12
9% of all-time downloads
AmanPriyanshu/gpt-oss-12.6b-specialized-science-pruned-moe-only-18-experts
gpt-oss-12.6b-specialized-science-pruned-moe-only-18-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
9% of all-time downloads
All-time downloads
132
Public
Parameters
12.6B
25.1 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors25.1 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 18 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 science 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 | ~12.6B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 18 |
| 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 | Science |
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 science-specialized model leverages experts that showed high activation patterns during scientific reasoning tasks from GPQA (physics, chemistry, biology) and MMLU science domains. These experts demonstrate superior performance on complex scientific problem-solving and technical knowledge recall.
The expert selection process utilized our comprehensive analysis of router activation patterns across multiple evaluation benchmarks:
By identifying experts that consistently activated for science tasks, we created this specialized model that maintains domain expertise while significantly reducing computational requirements from 32 to 18 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-12.6b-specialized-science-pruned-moe-only-18-experts",
torch_dtype=torch.bfloat16,
device_map="cpu",
trust_remote_code=True
)
tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-12.6b-specialized-science-pruned-moe-only-18-experts")
# Generate with the model
messages = [
{"role": "user", "content": "Explain the process of photosynthesis in plants."}
]
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-12.6b-specialized-science-pruned-moe-only-18-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-12.6b-specialized-science-pruned-moe-only-18-experts")
# Generate with the model
messages = [
{"role": "user", "content": "Explain the process of photosynthesis in plants."}
]
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 science tasks:
Question: Explain the process of photosynthesis in plants.
Response:
<|channel|>analysis<|message|>Need to explain photosynthesis.<|end|><|start|>assistant<|channel|>final<|message|>**Photosynthesis – the “making of life” in plants**
| **What it is** | The biochemical process by which plants (and some algae and bacteria) convert light energy into chemical energy, producing sugars and oxygen. |
| **Where it happens** | In the chloroplasts, the light‑capturing organelles of plant cells. |
| **Key players** | • Chlorophyll (main pigment)
• Light‑absorbing antenna complexes
• Photosystems I & II
• Enzymes of the Calvin cycle (RuBisCO, GAPDH, etc.) |
---
## 1. Light Capture (Photophosphorylation)
| **Step** | **What happens** | **Outcome** |
|---|---|---|
| **Absorption of photons** | Chlorophyll a, b, and accessory pigments absorb photons (400–700 nm). | Excited electrons are released from chlorophyll. |
| **Electron transport chain (ETC)** | Excited electrons travel through a series of proteins (P700, cytochrome b₆₀, plastoquinone, etc.) in the thylakoid membrane. | Energy is used to pump protons into the thilakoid lumen, creating a proton gradient. |
| **ATP synthesis** | The proton gradient drives ATP synthase (complex V) to produce ATP from ADP + Pi. | 1–3 ATP molecules per electron cycle. |
| **NADPH formation** | At the end of the ETC, electrons reduce NADP to NADPH (via NADP‑reductase). | NADPH is a high‑energy reducing agent. |
| **Oxygen evolution** | Water (H₂O) is split at Photosystem II (via the oxygen‑evolving complex) to provide electrons and release O₂. | O₂ is released into the atmosphere. |
**Net result of the light reactions**
\[
\text{2 H₂O + 2 light photons → 2 O₂ + 2 H⁺ + 2 e⁻}
\]
plus the production of 3 ATP and 2 NADPH per cycle.
---
## 2. Carbon Fixation (Calvin Cycle)
| **Stage** | **Key enzyme** | **Sub‑reaction** | **Products** |
|---|---|---|---|
| **Carbon fixation** | Ribulose‑1
Question: What causes the greenhouse effect and how does it work?
Response:
<|channel|>analysis<|message|>Need explain greenhouse effect, greenhouse gases, absorption of IR, trapping, radiative balance.<|end|><|start|>assistant<|channel|>final<|message|>**What causes the greenhouse effect?**
The greenhouse effect is a natural process that keeps Earth’s surface warm enough for life. It is caused by the presence of certain gases in the atmosphere—primarily water vapor, carbon dioxide (CO₂), methane (CH₄), nitrous oxide (N₂O), and a few others—that can absorb and re‑emit infrared (IR) radiation. When the Sun’s energy reaches the planet, it is mostly in the visible and ultraviolet (UV) part of the spectrum. The Earth absorbs this energy and re‑radiates it as heat in the infrared range. Greenhouse gases in the atmosphere act like a blanket that traps some of that IR radiation, preventing it from escaping to space. The net result is a warming of the planet’s surface and lower‑altitude atmosphere.
---
## 1. The basic physics
| Step | Process | What happens |
|------|---------|--------------|
| 1 | Solar radiation enters | Short‑wave (visible/UV) radiation from the Sun reaches the Earth. |
| 2 | Absorption by the surface | The Earth’s surface absorbs this energy and heats up. |
| 3 | Re‑radiation | The warmed surface emits long‑wave (infrared) radiation back into space. |
| 4 | Greenhouse gases absorb IR | Gases such as CO₂, H₂O, CH₄, N₂O absorb some of that IR radiation. |
| 5 | Re‑emission | The gases re‑emit IR radiation in all directions, including back toward the surface. |
| 6 | Net energy balance | More IR energy is trapped than would be if the atmosphere were transparent, so the surface stays warmer. |
---
## 2. Why do greenhouse gases absorb IR?
- **Molecular vibrations**: Greenhouse gases have rotational and vibrational modes that can be excited by IR photons.
- **Spectral windows**: The atmosphere is largely transparent to visible light but has “windows” in the IR where gases absorb strongly.
- **Re‑emission**: Once a molecule absorbs a photon, it quickly re‑emits it in a random direction (often back toward the surface).
Because the Earth’s surface emits a continuous spectrum of IR radiation, the gases act as a semi‑transparent filter that lets some of the
Question: Describe the structure and function of DNA.
Response:
<|channel|>analysis<|message|>Need concise description.<|end|><|start|>assistant<|channel|>final<|message|>**DNA (deoxyribonucleic acid)** is the hereditary genetic material that carries the instructions for building and regulating all living organisms. Its structure and function can be broken down into several key components:
| Feature | Description | Biological Role |
|---|---|---|
| **Double‑helix backbone** | Two strands of nucleotides wound around each other in a right‑handed helix. The backbone is made of alternating deoxyribose sugars and phosphate groups. | Provides a rigid, stable scaffold that protects the genetic code and allows enzymes to read and copy it. |
| **Nucleobases** | Four nitrogenous bases: adenine (A), thymine (T), cytosine (C), guanine (G). | Encode the genetic information; base‑pairing (A‑T, C‑G) ensures complementary strands during replication. |
| **Base pairing & hydrogen bonds** | A pairs with T via two hydrogen bonds; C pairs with G via three. | Stabilizes the double helix and ensures accurate base recognition during replication and transcription. |
| **Major & minor grooves** | The helical structure creates two grooves that are accessible to proteins. | Serve as binding sites for DNA‑binding proteins (e.g., transcription factors, helicases). |
| **Nucleosome packaging** | In eukaryotes, DNA wraps around histone proteins to form nucleosomes, which further coil into chromatin. | Condenses DNA into chromosomes, regulates accessibility, and facilitates higher‑order organization. |
| **Sequence motifs** | Repeated elements (e.g., promoters, enhancers, silencers, splice sites). | Directly control gene expression, splicing, and other regulatory processes. |
### Core Functions
1. **Genetic Information Storage**
- DNA sequences encode amino‑acid chains (proteins) and regulatory RNAs.
- The sequence is inherited during cell division, ensuring continuity of traits.
2. **Replication**
- DNA polymerases copy the double helix, creating two identical strands.
- Accurate replication preserves the genome for all progeny cells.
3. **Transcription**
- RNA polymerase reads DNA to synthesize messenger RNA (mRNA).
- mRNA is translated into proteins, executing cellular functions.
4. **Repair & Maintenance**
- Enzymes (e.g., helicases, ligases
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}
}