Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~14.9B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 22 |
| 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 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Load the specialized model on CPU
5model = AutoModelForCausalLM.from_pretrained(
6 "AmanPriyanshu/gpt-oss-14.9b-specialized-instruction_following-pruned-moe-only-22-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-14.9b-specialized-instruction_following-pruned-moe-only-22-experts")
12
13# Generate with the model
14messages = [
15 {"role": "user", "content": "Write a formal email to a professor requesting a meeting, including: subject line, greeting, purpose, proposed times, and professional closing."}
16]
17
18inputs = tokenizer.apply_chat_template(
19 messages,
20 add_generation_prompt=True,
21 return_tensors="pt",
22 return_dict=True,
23 reasoning_effort="medium"
24)
25
26# Ensure inputs are on the same device as model
27inputs = {k: v.to(model.device) for k, v in inputs.items()}
28
29outputs = model.generate(
30 **inputs,
31 max_new_tokens=512,
32 do_sample=True,
33 temperature=0.1,
34 top_p=0.9,
35 pad_token_id=tokenizer.eos_token_id,
36 eos_token_id=tokenizer.eos_token_id
37)
38
39# Decode only the generated part
40input_length = inputs['input_ids'].shape[1]
41response_tokens = outputs[0][input_length:]
42response = tokenizer.decode(response_tokens, skip_special_tokens=True)
43print(response)1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Check MPS availability and load model
5device = "mps" if torch.backends.mps.is_available() else "cpu"
6
7model = AutoModelForCausalLM.from_pretrained(
8 "AmanPriyanshu/gpt-oss-14.9b-specialized-instruction_following-pruned-moe-only-22-experts",
9 torch_dtype=torch.float16, # Better MPS compatibility
10 device_map=device,
11 trust_remote_code=True,
12 low_cpu_mem_usage=True
13)
14tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-14.9b-specialized-instruction_following-pruned-moe-only-22-experts")
15
16# Generate with the model
17messages = [
18 {"role": "user", "content": "Write a formal email to a professor requesting a meeting, including: subject line, greeting, purpose, proposed times, and professional closing."}
19]
20
21inputs = tokenizer.apply_chat_template(
22 messages,
23 add_generation_prompt=True,
24 return_tensors="pt",
25 return_dict=True,
26 reasoning_effort="medium"
27)
28
29# Move inputs to model device
30inputs = {k: v.to(model.device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
31
32# Use torch.no_grad for MPS stability
33with torch.no_grad():
34 outputs = model.generate(
35 **inputs,
36 max_new_tokens=512,
37 do_sample=True,
38 temperature=0.1,
39 top_p=0.9,
40 pad_token_id=tokenizer.eos_token_id,
41 eos_token_id=tokenizer.eos_token_id,
42 use_cache=True
43 )
44
45# Decode only the generated part
46input_length = inputs['input_ids'].shape[1]
47response_tokens = outputs[0][input_length:]
48response = tokenizer.decode(response_tokens, skip_special_tokens=True)
49print(response)1device_map="auto" # Will automatically use GPU if available
2torch_dtype=torch.bfloat16 # or torch.float16<|channel|>analysis<|message|>Need formal email.<|end|><|start|>assistant<|channel|>final<|message|>**Subject:** Request for Meeting – Discussion of Thesis Progress
Dear Professor [Last Name],
I hope this message finds you well. I am writing to request a brief meeting with you to discuss the current status of my thesis and to seek your guidance on the next steps.
Could we meet at one of the following times next week?
- Tuesday, August 20 at 10:00 a.m.
- Wednesday, August 21 at 2:00 p.m.
- Thursday, August 22 at 11:30 a.m.
If any of these slots are inconvenient, I would be happy to adjust to a time that better fits your schedule.
Thank you for your time and consideration. I look forward to your response.
Sincerely,
[Your Full Name]
[Your Program / Department]
[University]
[Phone Number] | [Email Address]<|return|><|channel|>analysis<|message|>Need 6 steps numbered.<|end|><|start|>assistant<|channel|>final<|message|>1. **Gather ingredients and tools** – You’ll need eggs, a splash of milk or water, butter or oil, salt, pepper, and a non‑stick skillet or frying pan.
2. **Heat the pan** – Place the skillet over medium heat and add a small pat of butter or a drizzle of oil, letting it melt and coat the surface.
3. **Whisk the eggs** – Crack the eggs into a bowl, add a tablespoon of milk or water, a pinch of salt and pepper, then whisk until the mixture is uniform.
4. **Pour the mixture into the pan** – Once the butter/oil is hot and shimmering, pour the whisked eggs into the skillet, letting them spread evenly.
5. **Cook and stir gently** – Allow the eggs to set for a few seconds, then use a spatula to stir gently, scraping the bottom and sides of the pan to prevent sticking. Continue cooking until the eggs are softly set but still slightly runny.
6. **Serve immediately** – Remove the pan from heat, transfer the scrambled eggs to a plate, and enjoy while warm.<|return|><|channel|>analysis<|message|>Need 50 words. Let's craft: "Water evaporates from oceans, lakes, and soil, forming clouds. Precipitation returns as rain or snow, filling rivers and groundwater. Plants absorb water, releasing vapor through transpiration. Groundwater moves through aquifers, emerging at springs. The cycle repeats, sustaining ecosystems and human life." Count words. Let's count: Water(1) evaporates2 from3 oceans,4 lakes,5 and6 soil,7 forming8 clouds.9 Precipitation10 returns11 as12 rain13 or14 snow,15 filling16 rivers17 and18 groundwater.19 Plants20 absorb21 water,22 releasing23 vapor24 through25 transpiration.26 Groundwater27 moves28 through29 aquifers,30 emerging31 at32 springs.33 The34 cycle35 repeats,36 sustaining37 ecosystems38 and39 human40 life41. Need 9 more words. Add: "and45 climate45? Wait count. Let's add "and45 climate46 balance." Need 9 words: "and climate balance, sustaining biodiversity, agriculture, and civilization." Count: and(1) climate(2) balance,(3) sustaining(4) biodiversity,(5) agriculture,(6) and(7) civilization(8). Need one more word: "forever"(9). Now total 41+9=50. Let's recount full sentence.<|end|><|start|>assistant<|channel|>final<|message|>Water evaporates from oceans, lakes, and soil, forming clouds. Precipitation returns as rain or snow, filling rivers and groundwater. Plants absorb water, releasing vapor through transpiration. Groundwater moves through aquifers, emerging at springs. The cycle repeats, sustaining ecosystems and human life, and climate balance, sustaining biodiversity, agriculture, and civilization forever.<|return|>1@misc{priyanshu2025gptoss,
2 title={{GPT-OSS MoE Expert Fingerprinting: Analyzing Expert Activation Patterns in Mixture of Experts Models}},
3 author={Priyanshu, Aman and Vijay, Supriti},
4 year={2025},
5 howpublished={\url{https://amanpriyanshu.github.io/GPT-OSS-MoE-ExpertFingerprinting/}},
6 note={Interactive analysis tool for expert activation patterns in MoE architectures}
7}