Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~19.7B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 30 |
| 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 |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Load the specialized model on CPU
5model = AutoModelForCausalLM.from_pretrained(
6 "AmanPriyanshu/gpt-oss-19.7b-specialized-science-pruned-moe-only-30-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-19.7b-specialized-science-pruned-moe-only-30-experts")
12
13# Generate with the model
14messages = [
15 {"role": "user", "content": "Explain the process of photosynthesis in plants."}
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-19.7b-specialized-science-pruned-moe-only-30-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-19.7b-specialized-science-pruned-moe-only-30-experts")
15
16# Generate with the model
17messages = [
18 {"role": "user", "content": "Explain the process of photosynthesis in plants."}
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 to explain photosynthesis.<|end|><|start|>assistant<|channel|>final<|message|>**Photosynthesis** is the process by which green plants, algae, and some bacteria convert light energy from the sun into chemical energy stored in organic molecules (mainly sugars). It occurs mainly in the chloroplasts of plant cells, specifically within the thylakoid membranes. The overall reaction can be summarized as:
\[
6\,\text{CO}_2 + 6\,\text{H}_2\text{O} + \text{light energy} \;\longrightarrow\; C_6H_{12}O_6 + 6\,\text{O}_2
\]
Below is a step‑by‑step breakdown of the process, highlighting the two main stages—**the light‑dependent reactions** and **the Calvin‑Benson cycle (light‑independent reactions)**—and the key molecules involved.
---
## 1. Light‑Dependent Reactions (Photophosphorylation)
| Step | What Happens | Key Components | Outcome |
|------|--------------|----------------|---------|
| **1. Photon absorption** | Light hits chlorophyll a (and accessory pigments) in Photosystem II (PSII). | PSII, chlorophyll a, carotenoids | Excitation of electrons to a high energy state. |
| **2. Water splitting (photolysis)** | Excited electrons are replaced by electrons from water. | Oxygen-evolving complex (OEC) | Produces 2 O₂ molecules, 4 H⁺, and 4 e⁻. |
| **3. Electron transport chain (ETC)** | Electrons travel from PSII → plastoquinone (PQ) → cytochrome b₆f → plastocyanin → Photosystem I (PSI). | PQ, cytochrome b₆f, plastocyanin | Generates a proton gradient across the thylakoid membrane. |
| **4. ATP synthesis** | Protons flow back through ATP synthase (CF₀/CF₁). | ATP synthase (CF₀/CF₁) | Produces ATP (chemiosmosis). |
| **5. NADPH formation** | Electrons reach PSI, are re‑excited by light, then reduce NADP⁺ to NADPH. | PSI, ferredoxin, ferredoxin‑NADP⁺ reductase (FNR) | Generates NAD<|channel|>analysis<|message|>Explain greenhouse gases, absorption, re-emission, trapping heat, radiative transfer, etc.<|end|><|start|>assistant<|channel|>final<|message|>### The Greenhouse Effect in a Nutshell
The **greenhouse effect** is the natural process that keeps Earth’s surface warm enough to support life. It works by trapping a portion of the Sun’s energy that would otherwise escape back into space. The key players are the **greenhouse gases (GHGs)** in the atmosphere—water vapor, carbon dioxide (CO₂), methane (CH₄), nitrous oxide (N₂O), and a few others. These gases absorb and re‑emit infrared (IR) radiation, effectively acting like a blanket around the planet.
---
## 1. Solar Energy Reaches Earth
| Step | What Happens | Why It Matters |
|------|--------------|----------------|
| **1. Solar radiation** | The Sun emits a spectrum of electromagnetic radiation, peaking in the visible range (~0.4–0.7 µm). | This is the primary energy source for Earth. |
| **2. Atmospheric filtering** | Short‑wave (visible/UV) radiation passes through the atmosphere largely unimpeded. | Most of the incoming solar energy reaches the surface. |
| **3. Surface absorption** | Land, oceans, ice, and vegetation absorb the radiation, warming up. | The surface temperature rises, setting the stage for IR emission. |
---
## 2. The Surface Emits Infrared Radiation
- **Thermal (black‑body) radiation**: Any object with a temperature above absolute zero emits IR radiation. The Earth’s surface, at ~288 K, emits strongly in the 8–15 µm range.
- **Wavelength dependence**: The peak wavelength of emitted radiation is inversely proportional to temperature (Wien’s Law). For Earth, the peak is around 10 µm.
---
## 3. Greenhouse Gases Absorb and Re‑emit IR
| Gas | Absorption Bands | Why It’s Important |
|-----|------------------|--------------------|
| **CO₂** | 4.3 µm (strong), 15 µm (moderate) | Most abundant anthropogenic GHG. |
| **H₂O** | Broad, continuous absorption across 3–20 µm | Most abundant GHG; highly variable. |
| **CH₄** | 7.7 µm | Strong absorber, though<|channel|>analysis<|message|>Need concise description.<|end|><|start|>assistant<|channel|>final<|message|>**DNA (Deoxyribonucleic Acid)** is the hereditary material that carries the genetic instructions used in the growth, development, functioning, and reproduction of all known living organisms and many viruses.
---
## 1. Structure
| Feature | Description |
|---------|-------------|
| **Polymers** | Long chains of nucleotides. |
| **Nucleotide composition** | 5‑prime deoxyribose sugar, a phosphate group, and one of four nitrogenous bases: adenine (A), thymine (T), cytosine (C), or guanine (G). |
| **Double helix** | Two complementary strands wound around each other. |
| **Base pairing** | A pairs with T (2 hydrogen bonds), C pairs with G (3 hydrogen bonds). |
| **Antiparallel orientation** | One strand runs 5′→3′, the other 3′→5′. |
| **Major/minor grooves** | Provide binding sites for proteins. |
| **Supercoiling** | Higher‑order winding that compacts DNA in cells. |
| **Chromatin packaging** | DNA wrapped around histone proteins forming nucleosomes, further folded into chromatin fibers. |
---
## 2. Function
| Function | How it works |
|----------|--------------|
| **Genetic information storage** | The sequence of bases encodes genes that specify proteins and regulatory RNAs. |
| **Replication** | Semi‑conservative replication: each strand serves as a template for a new complementary strand, ensuring faithful copying during cell division. |
| **Transcription** | RNA polymerase reads a DNA template strand to synthesize messenger RNA (mRNA). |
| **Translation** | Ribosomes translate mRNA codons into amino acids, building proteins. |
| **Regulation of gene expression** | DNA‑binding proteins (transcription factors, repressors, activators) modulate which genes are transcribed. |
| **Repair and maintenance** | DNA repair enzymes fix damage (e.g., base excision, nucleotide excision, mismatch repair) to preserve integrity. |
| **Evolutionary diversity** | Mutations, recombination, and horizontal gene transfer introduce variation that natural selection can act upon. |
---
### Key Takeaway
DNA’s double‑helical structure, with its specific base‑pairing rules, provides a stable yet flexible template for storing genetic information, guiding1@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}