Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~20.3B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 31 |
| 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-20.3b-specialized-science-pruned-moe-only-31-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-20.3b-specialized-science-pruned-moe-only-31-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-20.3b-specialized-science-pruned-moe-only-31-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-20.3b-specialized-science-pruned-moe-only-31-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 glucose (a sugar) and other organic molecules. It is the foundation of almost all life on Earth because it supplies the oxygen we breathe and the organic matter that fuels food webs.
---
## 1. Where It Happens
| Component | Location | Role |
|-----------|----------|------|
| **Chloroplast** | Cell organelle | Houses the machinery for photosynthesis |
| **Thylakoid membranes** | Inside chloroplast | Site of light‑dependent reactions |
| **Stroma** | Fluid surrounding thylakoids | Site of light‑independent (Calvin) cycle |
| **Chlorophyll** | Pigment in thylakoids | Captures light energy |
---
## 2. Two Main Phases
1. **Light‑Dependent Reactions (Photophosphorylation)**
2. **Light‑Independent Reactions (Calvin Cycle / Dark Reactions)**
### 2.1 Light‑Dependent Reactions
| Step | What Happens | Key Molecules |
|------|--------------|---------------|
| **1. Light absorption** | Chlorophyll and accessory pigments absorb photons. | Chlorophyll a, b, carotenoids |
| **2. Water splitting (Photolysis)** | Light energy splits H₂O into O₂, H⁺, and electrons. | H₂O → ½ O₂ + 2H⁺ + 2e⁻ |
| **3. Electron transport chain (ETC)** | Electrons move through Photosystem II → plastoquinone → cytochrome b₆f → Photosystem I → plastocyanin. | PSII, PQ, Cyt b₆f, PSI, PC |
| **4. ATP synthesis** | Proton gradient (ΔpH) drives ATP synthase. | ATP |
| **5. NADPH formation** | Electrons reduce NADP⁺ to NADPH. | NADPH |
| **6. Oxygen release** | O₂ is released as a by‑product. | O₂ |
**Net result of light‑dependent reactions:**
\[
2\,\text{H}_2\text{O} + 2\,\text{NADP}^+ + 3\,\text{ADP} +<|channel|>analysis<|message|>Need explain greenhouse effect causes, mechanism, gases, radiation, etc.<|end|><|start|>assistant<|channel|>final<|message|>**The greenhouse effect** is the natural process that keeps Earth’s surface warm enough to support life. It is caused by certain gases in the atmosphere that absorb and re‑radiate infrared (IR) radiation emitted by the planet’s surface. Below is a step‑by‑step explanation of what causes it and how it works.
---
## 1. Solar Energy Reaches Earth
| Step | What Happens | Key Points |
|------|--------------|------------|
| **1. Solar radiation** | The Sun emits a spectrum of electromagnetic radiation, from ultraviolet (UV) to visible light to infrared (IR). | About 1,361 W/m² (solar constant) reaches the top of Earth’s atmosphere. |
| **2. Atmospheric filtering** | Some UV and visible light is absorbed by the ozone layer and other gases; the rest passes through. | Roughly 70 % of incoming solar energy reaches the surface. |
| **3. Surface absorption** | The Earth’s surface (land, oceans, ice) absorbs the short‑wave radiation and warms. | Warm surface emits long‑wave (infrared) radiation. |
---
## 2. Surface Emits Infrared Radiation
- **Thermal radiation**: Warm objects emit IR radiation proportional to their temperature (Stefan–Boltzmann law: \(E = \sigma T^4\)).
- **Typical surface temperature**: ~288 K (15 °C) → emission peaks around 10 µm wavelength.
---
## 3. Greenhouse Gases Absorb IR
| Gas | Wavelengths absorbed | Typical atmospheric concentration |
|-----|----------------------|-----------------------------------|
| **Water vapor (H₂O)** | 5–8 µm, 12–20 µm | Variable, up to 4 % by volume |
| **Carbon dioxide (CO₂)** | 4.3 µm, 15 µm | ~0.04 % (400 ppm) |
| **Methane (CH₄)** | 7.7 µm | ~0.0002 % (1.8 ppm) |
| **Nitrous oxide (N₂O)** | 4.5 µm | ~0.00002 % (0.3 ppm) |
| **Ozone (O₃)** |<|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. Its structure and function can be understood in two complementary parts:
---
## 1. Structure of DNA
| Feature | Description | Significance |
|---------|-------------|--------------|
| **Double‑Helix** | Two complementary strands wound around each other like a twisted ladder. | Provides stability and a compact way to store long sequences of genetic information. |
| **Backbone** | Alternating deoxyribose sugars and phosphate groups. | Forms a sturdy, negatively charged scaffold that protects the bases and allows enzymes to read the sequence. |
| **Nitrogenous Bases** | Four types: Adenine (A), Thymine (T), Cytosine (C), Guanine (G). | Encode genetic information; base‑pairing (A‑T, C‑G) ensures accurate replication. |
| **Base‑Pairing Rules** | A pairs with T via two hydrogen bonds; C pairs with G via three hydrogen bonds. | Maintains the uniform width of the helix and allows precise copying of DNA. |
| **Antiparallel Orientation** | One strand runs 5’→3’, the other 3’→5’. | Essential for replication and transcription machinery to function correctly. |
| **Supercoiling & Chromatin** | DNA is wrapped around histone proteins forming nucleosomes, further coiled into higher‑order structures. | Enables compaction into chromosomes and regulates access to genetic information. |
---
## 2. Function of DNA
| Function | How It Works | Biological Importance |
|----------|--------------|-----------------------|
| **Genetic Information Storage** | The sequence of bases constitutes the genome. | Determines the traits and capabilities of an organism. |
| **Replication** | DNA polymerases synthesize a new complementary strand using the existing strand as a template. | Enables cell division and inheritance of genetic material. |
| **Transcription (DNA → RNA)** | RNA polymerase reads a DNA template strand and synthesizes messenger RNA (mRNA). | Transfers genetic information from the nucleus to the cytoplasm for protein synthesis. |
| **Translation (RNA → Protein)** | Ribosomes read mRNA codons and assemble amino acids into polypeptide chains. | Produces the proteins that perform cellular functions1@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}