Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~19.1B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 29 |
| 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 | All |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Load the specialized model on CPU
5model = AutoModelForCausalLM.from_pretrained(
6 "AmanPriyanshu/gpt-oss-19.1b-specialized-all-pruned-moe-only-29-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-19.1b-specialized-all-pruned-moe-only-29-experts")
12
13# Generate with the model
14messages = [
15 {"role": "user", "content": "What is artificial intelligence and how does it work?"}
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.1b-specialized-all-pruned-moe-only-29-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.1b-specialized-all-pruned-moe-only-29-experts")
15
16# Generate with the model
17messages = [
18 {"role": "user", "content": "What is artificial intelligence and how does it work?"}
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 explain AI, types, how works.<|end|><|start|>assistant<|channel|>final<|message|>## What Is Artificial Intelligence?
Artificial Intelligence (AI) is the field of computer science that builds systems capable of performing tasks that normally require human intelligence. These tasks include:
| Human Skill | AI Equivalent |
|-------------|---------------|
| Perceiving (seeing, hearing) | Computer vision, speech recognition |
| Reasoning (solving problems, planning) | Algorithms, decision trees, logic programming |
| Learning (adapting from experience) | Machine learning, deep learning |
| Understanding language | Natural language processing (NLP) |
| Acting (moving, manipulating objects) | Robotics, autonomous vehicles |
In short, AI is about **making machines that can think, learn, and act**—often in ways that mimic or even surpass human abilities.
---
## How Does AI Work? (A High‑Level View)
1. **Data Collection & Representation**
- AI systems learn from data. This can be images, text, sensor readings, or any structured/unstructured information.
- Data is cleaned, labeled, and transformed into a format the algorithm can use (e.g., pixel arrays, word embeddings).
2. **Model Selection**
- Choose a computational model that can capture patterns in the data. Common families:
- **Statistical models** (e.g., linear regression, logistic regression)
- **Symbolic AI** (rule‑based systems, knowledge graphs)
- **Neural networks** (deep learning, CNNs, RNNs, transformers)
- **Hybrid models** (combining symbolic and neural approaches)
3. **Training (Learning)**
- The model is exposed to data and adjusts its internal parameters to minimize a **loss function** (a measure of error).
- **Gradient descent** and its variants (Adam, RMSProp) are the most common optimization algorithms.
- Training can be supervised (labels provided), unsupervised (discover structure), or reinforcement (learn from rewards).
4. **Evaluation & Validation**
- Split data into training, validation, and test sets.
- Use metrics (accuracy, precision, recall, F1, BLEU, etc.) to gauge performance.
- Perform hyper‑parameter tuning, cross‑validation, and regularization to avoid overfitting.
5. **Deployment & Inference**
- Once trained, the model is deployed to a target environment (cloud, edge device, mobile app).
- During<|channel|>analysis<|message|>Need simple explanation.<|end|><|start|>assistant<|channel|>final<|message|>**Einstein’s theory of relativity** is really two ideas that changed how we think about space, time, and gravity. Think of them as two “rules” that tell us how the universe behaves when things move fast or are near massive objects.
---
## 1. Special Relativity (1905)
### The two postulates
1. **The laws of physics are the same for everyone who is moving at a constant speed** (no “preferred” reference frame).
2. **The speed of light in a vacuum is always the same (≈ 299 792 km/s)**, no matter how fast you’re moving or where you are.
### What that means in everyday language
| Concept | Everyday picture | What actually happens |
|---------|------------------|-----------------------|
| **Time slows down** | A clock on a fast‑moving train ticks slower than a clock on the platform. | Time is relative; the faster you move, the more your own time dilates (slows). |
| **Length shrinks** | A moving car looks shorter in the direction of motion. | Objects contract along the direction of motion, but only noticeable at speeds close to light. |
| **Mass increases** | A car feels heavier as it speeds up. | As you approach light speed, your relativistic mass grows, making it harder to accelerate further. |
| **Energy–mass equivalence** | “Energy is just another form of mass.” | \(E = mc^2\): a tiny amount of mass can be converted into a huge amount of energy. |
**Bottom line:** If you could travel near light speed, you would age slower than people who stayed on Earth, and distances would appear shorter in the direction you’re moving.
---
## 2. General Relativity (1915)
### The core idea
Gravity is not a “force” pulling objects together; it’s the **curvature of spacetime** caused by mass and energy.
### Visualizing it
- Imagine a heavy ball (the Sun) placed on a stretched rubber sheet (spacetime).
- The ball creates a dip in the sheet.
- A smaller marble (Earth) rolls around the dip, following a curved path—not because a force pulls it, but because the sheet itself is curved.
### Consequences
| Effect | Everyday analogy | Real‑world observation |
|--------|------------------|------------------------|
| **Light<|channel|>analysis<|message|>Need to explain democratic functioning.<|end|><|start|>assistant<|channel|>final<|message|>### 1. What “democracy” means today
Modern democracies are usually **constitutional republics** that combine:
| Core Feature | What it looks like in practice | Why it matters |
|--------------|--------------------------------|----------------|
| **Rule of law** | A written constitution, independent courts, and clear statutes | Prevents arbitrary power |
| **Separation of powers** | Executive, legislature, judiciary operate independently | Checks and balances |
| **Free and fair elections** | Regular, competitive, secret‑ballot voting | Legitimacy of the government |
| **Political pluralism** | Multiple parties, interest groups, and civil society | Representation of diverse views |
| **Civil liberties** | Freedom of speech, press, assembly, religion | Enables dissent and accountability |
| **Accountability mechanisms** | Audits, ombudsmen, media scrutiny | Holds officials responsible |
### 2. How the system works in practice
| Stage | Typical Process | Key Institutions | Common Variations |
|-------|-----------------|-------------------|-------------------|
| **Electoral cycle** | 1. Parties nominate candidates 2. Campaigning 3. Voting 4. Counting 5. Certification | Electoral commissions, political parties, media | Some use proportional representation, others first‑past‑the‑post |
| **Legislative function** | Bills drafted → committee review → floor debate → vote → executive assent | Parliament/ congress, committees, opposition | Bicameral vs unicameral, filibuster rules |
| **Executive function** | President/prime minister sets policy agenda, appoints ministers, signs laws | Head of state, cabinet, civil service | Presidential vs parliamentary systems |
| **Judicial function** | Interprets laws, adjudicates disputes, reviews constitutionality | Supreme court, lower courts | Judicial review powers vary |
| **Oversight & checks** | Auditors, ombudsmen, investigative committees, media | Comptroller‑auditor general, parliamentary oversight committees | Some countries have stronger anti‑corruption agencies |
### 3. The “daily” mechanics
1. **Policy debate** – Legislators discuss bills; public hearings allow citizen input.
2. **Voting** – Majority rules, but minority rights are protected (e.g., veto overrides, filibusters).
3. **Implementation** – Civil servants execute laws; agencies monitor compliance.
4. **Feedback** –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}