Views
No views yet
| Metric | Value |
|---|---|
| Base Model | openai/gpt-oss-20b |
| Architecture | Mixture-of-Experts Transformer |
| Total Parameters | ~6.0B (pruned from 21B) |
| Original Experts per Layer | 32 |
| Pruned Experts per Layer | 7 |
| 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 | Law |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Load the specialized model on CPU
5model = AutoModelForCausalLM.from_pretrained(
6 "AmanPriyanshu/gpt-oss-6.0b-specialized-law-pruned-moe-only-7-experts",
7 torch_dtype=torch.bfloat16,
8 device_map="cpu",
9 trust_remote_code=True
10)
11tokenizer = AutoTokenizer.from_pretrained("AmanPriyanshu/gpt-oss-6.0b-specialized-law-pruned-moe-only-7-experts")
12
13# Generate with the model
14messages = [
15 {"role": "user", "content": "What is the difference between civil and criminal law?"}
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-6.0b-specialized-law-pruned-moe-only-7-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-6.0b-specialized-law-pruned-moe-only-7-experts")
15
16# Generate with the model
17messages = [
18 {"role": "user", "content": "What is the difference between civil and criminal law?"}
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|>User asks: difference between civil and criminal law. Provide explanation.<|end|><|start|>assistant<|channel|>final<|message|>### Civil vs. Criminal Law
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |<|channel|>analysis<|message|>Need to explain due process concept.<|end|><|start|>assistant<|channel|>final<|message|>### What is “Due Process” (or “Due‑Process” in short)
In the legal system, **“due process”** is a principle that every person, whether a defendant, a victim, or a witness, is entitled to a fair, lawful, and just treatment under the law. It is not a single rule, but a set of norms that must be respected in every legal procedure. In short, it is the **“right to a fair hearing”**.
### Core Elements
1. **Notice of the Charge** – the person must be informed of the allegations or the charges they face.
2. **Right to Counsel** – the person has the right to hire an attorney or to have one appointed if they cannot afford one.
3. **Right to a Public Hearing** – the case must be heard in a public court or a hearing that is open to the public.
4. **Right to a Fair Jury** – the jury must be impartial, and the person must have a chance to challenge the evidence or the witnesses.
5. **Right to a Fair Sentive** – the person has the right to a fair sentencing, and the sentence must be proportionally appropriate.
6. **Right to a Fair Appeal** – the person has the right to appeal the decision or to have a review.
7. **Right to a Fair Release** – the person has the right to be released from custody or to be released from the prison.
8. **Right to a Fair Compensation** – the person has the right to compensation for any wrong or for any harm.
### Why It Matters
- **Fairness** – it ensures that the legal system is not arbitrary or that it is not biased.
- **Rule of Law** – it ensures that the law is applied consistently.
- **Human Rights** – it protects the human dignity and the human life.
### How It Is Implemented
- **Stat laws** – many statutes in the U.S. and other countries codize the right to due process.
- **Court rules** – judges and attorneys must follow the due process.
- **Judices** – the courts interpret the due process in a variety of cases.
### Examples
- **Mir‑Case** – the Supreme Court’s decision that a defendant has a right to a fair hearing.
- **Habe‑Case** – the case where<|channel|>analysis<|message|>User asks: "What are the basic rights protected by the First Amendment?" They want answer. Provide explanation.<|end|><|start|>assistant<|channel|>final<|message|>The First Amendment, as outlined in the U‑C‑Con (the U‑C‑Con is a constitution that is a constitution of the United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United United1@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}