Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~18.5B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 28 |
| 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-18.5b-specialized-instruction_following-pruned-moe-only-28-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-18.5b-specialized-instruction_following-pruned-moe-only-28-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-18.5b-specialized-instruction_following-pruned-moe-only-28-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-18.5b-specialized-instruction_following-pruned-moe-only-28-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:30 a.m.
- Wednesday, August 21 at 2:00 p.m.
- Thursday, August 22 at 9:00 a.m.
If none of these slots are convenient, I would be grateful if you could suggest an alternative time that fits your schedule.
Thank you very much for your time and consideration. I look forward to your reply.
Sincerely,
[Your Full Name]
[Your Program / Department]
[University Name]
[Email Address] | [Phone Number]<|return|><|channel|>analysis<|message|>Need 6 steps numbered.<|end|><|start|>assistant<|channel|>final<|message|>1. **Gather ingredients and tools** – You’ll need eggs, a pinch of salt, a splash of milk or cream (optional), butter or oil, a whisk or fork, a non‑stick skillet, and a spatula.
2. **Beat the eggs** – Crack the eggs into a bowl, add salt (and milk if using), and whisk until the mixture is uniform and slightly frothy.
3. **Heat the skillet** – 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.
4. **Pour in the eggs** – Once the butter is foamy (but not browned), pour the beaten eggs into the skillet.
5. **Cook and stir gently** – Let the eggs sit undisturbed for a few seconds, then use the spatula to gently push the edges toward the center, allowing the uncooked portions to flow to the edges. Repeat this motion every few seconds until the eggs are softly set but still slightly runny.
6. **Finish and serve** – Remove the skillet from heat while the eggs are still slightly loose; the residual heat will finish cooking them. Transfer the scrambled eggs to a plate, add any desired toppings (cheese, herbs, etc.), and serve immediately.<|return|><|channel|>analysis<|message|>Need 50 words exactly. Let's craft: "Sun heats oceans, lakes, and rivers, causing evaporation into the atmosphere. Water vapor rises, cools, and condenses into clouds. Precipitation returns water to Earth as rain, snow, or hail. Groundwater infiltrates soils, replenishing aquifers, while runoff channels water back to bodies, completing the cycle." Count words. Let's count: Sun(1) heats2 oceans,3 lakes,4 and5 rivers,6 causing7 evaporation8 into9 the10 atmosphere.11 Water12 vapor13 rises,14 cools,15 and16 condenses17 into18 clouds.19 Precipitation20 returns21 water22 to23 Earth24 as25 rain,26 snow,27 or28 hail.29 Groundwater30 infiltrates31 soils,32 replenishing33 aquifers,34 while35 runoff36 channels37 water38 back39 to40 bodies,41 completing42 the43 cycle44. Need 6 more words. Add "continually sustaining life worldwide." That's 5 words? "continually"1 "sustaining"2 "life"3 "worldwide"4. Need 2 more words: "everywhere"5 "daily"6. So add "continually sustaining life worldwide everywhere daily." Count added words: continually1 sustaining2 life3 worldwide4 everywhere5 daily6. Total 44+6=50. Good.<|end|><|start|>assistant<|channel|>final<|message|>Sun heats oceans, lakes, and rivers, causing evaporation into the atmosphere. Water vapor rises, cools, and condenses into clouds. Precipitation returns water to Earth as rain, snow, or hail. Groundwater infiltrates soils, replenishing aquifers, while runoff channels water back to bodies, completing the cycle continually sustaining life worldwide everywhere daily.<|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}