Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~16.7B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 25 |
| 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-16.7b-specialized-instruction_following-pruned-moe-only-25-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-16.7b-specialized-instruction_following-pruned-moe-only-25-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-16.7b-specialized-instruction_following-pruned-moe-only-25-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-16.7b-specialized-instruction_following-pruned-moe-only-25-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 Research Project 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 research project on [brief topic], as well as to seek your guidance on the next steps and potential publication avenues.
Could we meet at one of the following times next week?
- **Tuesday, August 20th, 10:00 – 10:30 AM**
- **Wednesday, August 21st, 2:00 – 2:30 PM**
- **Friday, August 23rd, 1:00 – 1:30 PM**
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 our conversation.
Sincerely,
[Your Full Name]
[Your Program / Department]
[University Name]
[Email Address] | [Phone Number]<|return|><|channel|>analysis<|message|>Need numbered list 1-6.<|end|><|start|>assistant<|channel|>final<|message|>1. **Gather ingredients and tools** – You’ll need eggs, a pinch of salt, pepper, a splash of milk or water (optional), butter or oil, a bowl, a whisk or fork, and a non‑stick skillet.
2. **Beat the eggs** – Crack the eggs into the bowl, add salt, pepper, and milk or water if desired, then whisk or stir 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 or the oil is shimmering, pour the beaten eggs into the skillet, spreading them evenly.
5. **Cook and stir** – Let the eggs sit for a few seconds until the edges begin to set, then gently stir with a spatula, pushing the cooked portions toward the center while letting the uncooked liquid flow to the edges. Continue until the eggs are softly set but still slightly runny, about 1–2 minutes.
6. **Serve immediately** – Remove the skillet from heat, transfer the scrambled eggs to a plate, and enjoy hot, optionally garnishing with fresh herbs or additional seasoning.<|return|><|channel|>analysis<|message|>Need 50 words exactly. Let's craft: "Sun heats oceans, rivers, and land, causing evaporation. Water vapor rises, condenses into clouds, and precipitates as rain or snow, returning to Earth's surface. Groundwater infiltrates soils, replenishing aquifers, while runoff channels water back to seas. The cycle repeats, sustaining life and regulating climate." Count words. Let's count: Sun(1) heats2 oceans,3 rivers,4 and5 land,6 causing7 evaporation.8 Water9 vapor10 rises,11 condenses12 into13 clouds,14 and15 precipitates16 as17 rain18 or19 snow,20 returning21 to22 Earth's23 surface.24 Groundwater25 infiltrates26 soils,27 replenishing28 aquifers,29 while30 runoff31 channels32 water33 back34 to35 seas.36 The37 cycle38 repeats,39 sustaining40 life41 and42 regulating43 climate44. Need 6 more words. Add "for"45 "all"46 "living"47 "organisms"48 "everywhere"49 "daily"50. Good.<|end|><|start|>assistant<|channel|>final<|message|>Sun heats oceans, rivers, and land, causing evaporation. Water vapor rises, condenses into clouds, and precipitates as rain or snow, returning to Earth's surface. Groundwater infiltrates soils, replenishing aquifers, while runoff channels water back to seas. The cycle repeats, sustaining life and regulating climate for all living organisms 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}