Hoglet-33 commited on
Commit
83a6dea
·
verified ·
1 Parent(s): 0f18680

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +144 -0
README.md CHANGED
@@ -1,3 +1,147 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: text-generation
6
+ tags:
7
+ - pebble
8
+ - language-model
9
+ - small-language-model
10
+ - pytorch
11
+ - safetensors
12
+ - custom-code
13
+ - mamba2
14
+ - hybrid
15
+ - chat
16
+ - sft
17
+ base_model:
18
+ - basically-ai/Pebble-10M
19
  ---
20
+
21
+ # Pebble-10M-Chat
22
+ ![Banner](banner.png)
23
+
24
+ Pebble-10M-Chat is a compact, hybrid autoregressive chat language model. It combines the efficiency of state-space models with the proven performance of attention layers, optimized using a custom Muon + AdamW optimizer split.
25
+
26
+ ## Model Details
27
+
28
+ - **Architecture:** Hybrid Mamba2 / Transformer
29
+ - **Block Pattern:** 3 Mamba2 blocks : 1 Attention block (repeating)
30
+ - **Parameters:** \~10,000,000 (10M)
31
+ - **Hidden Dimension:** 384
32
+ - **Layers:** 8 (6 Mamba2, 2 Attention)
33
+ - **Vocab Size:** 2,048 (Custom Byte-Level BPE)
34
+ - **Context Length:** 512
35
+ - **Pretraining Tokens:** \~25,000,000,000 (\~25 Billion)
36
+ - **Optimizer:** Muon (for 2D hidden weights) + AdamW (for embeddings, norms, and scalars)
37
+ - **Precision:** fp32 master weights with bf16 autocast
38
+
39
+ ## Dataset Sources
40
+
41
+ The base model was pretrained on a 25B token subset of the following datasets:
42
+
43
+ | Dataset | Token Allocation | Share |
44
+ |---------------|------------------|-------|
45
+ | FineWeb-Edu | 7.50 billion | 30% |
46
+ | DCLM | 5.00 billion | 20% |
47
+ | Cosmopedia-v2 | 3.75 billion | 15% |
48
+ | FineMath-4+ | 3.75 billion | 15% |
49
+ | FinePhrase | 3.00 billion | 12% |
50
+ | NPset | 2.00 billion | 8% |
51
+
52
+ ## Benchmarks
53
+
54
+ Pebble-10M-Chat was evaluated on several commonsense and arithmetic benchmarks.
55
+
56
+ | Benchmark | Accuracy | Random Baseline |
57
+ |-----------------|----------|-----------------|
58
+ | PIQA | 58.43% | 50.00% |
59
+ | ARC-Easy | 37.29% | 25.00% |
60
+ | ARC-Challenge | 18.60% | 25.00% |
61
+ | HellaSwag | 26.81% | 25.00% |
62
+ | ArithMark-2.0 | 27.64% | 25.00% |
63
+ | ArithMark-3.0 | 32.80% | 25.00% |
64
+
65
+ ### Evaluation Notes
66
+
67
+ - PIQA, ARC-Easy, ARC-Challenge, and HellaSwag were evaluated on their respective test splits.
68
+ - ArithMark-2.0 was evaluated on its train split due to the lack of a suitable test split.
69
+ - ArithMark-3.0 was evaluated on its train split due to the lack of a suitable test split.
70
+ - Results were obtained using zero-shot multiple-choice evaluation.
71
+ - The model was additionally fine-tuned using supervised fine-tuning (SFT).
72
+
73
+ ## SFT Attribution
74
+
75
+ The 250,000,000 SFT tokens used for Pebble-10M-Chat were provided by **Smol-SmolTalk**.
76
+
77
+ ## Usage
78
+
79
+ To run the model for text generation, you will need to install the required dependencies. The included Mamba2 implementation relies on CUDA/Triton kernels and is intended to run on a CUDA-enabled GPU. Ampere-class GPUs or newer are recommended.
80
+
81
+ > **Note:** The model uses custom architecture code, so you must pass \`trust_remote_code=True\` when loading both the tokenizer and the model.
82
+
83
+ ```bash
84
+ pip install transformers huggingface_hub torch
85
+ pip install causal-conv1d mamba-ssm
86
+ ```
87
+
88
+ Here is a simple Python script to load the model and generate text interactively:
89
+
90
+ ```python
91
+ import torch
92
+ from transformers import AutoModelForCausalLM, AutoTokenizer
93
+
94
+ MODEL_ID = "basically-ai/Pebble-10M-Chat"
95
+
96
+ def main():
97
+ print("Loading Pebble-10M-Chat...")
98
+ tokenizer = AutoTokenizer.from_pretrained(
99
+ MODEL_ID,
100
+ trust_remote_code=True,
101
+ )
102
+ model = AutoModelForCausalLM.from_pretrained(
103
+ MODEL_ID,
104
+ trust_remote_code=True,
105
+ dtype=torch.float32,
106
+ ).to("cuda")
107
+ model.eval()
108
+
109
+ print(f"Model loaded successfully! VRAM usage: {torch.cuda.memory_allocated() / 1e9:.2f} GB")
110
+ print("Type 'quit' or 'exit' to stop.\n")
111
+
112
+ while True:
113
+ prompt = input("You: ")
114
+ if prompt.lower() in ["quit", "exit"]:
115
+ break
116
+
117
+ # Tokenize the prompt
118
+ inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
119
+
120
+ # Generate text
121
+ print("Pebble: ", end="", flush=True)
122
+ with torch.inference_mode():
123
+ outputs = model.generate(
124
+ **inputs,
125
+ max_new_tokens=100, # How many tokens to generate
126
+ do_sample=True, # Use sampling (more creative)
127
+ temperature=0.7, # Controls randomness
128
+ top_k=50, # Consider top 50 tokens
129
+ top_p=0.95, # Nucleus sampling
130
+ repetition_penalty=1.2, # Prevent repeating words
131
+ )
132
+
133
+ # Decode and print (skip the prompt part)
134
+ generated_text = tokenizer.decode(
135
+ outputs[0][inputs["input_ids"].shape[1]:],
136
+ skip_special_tokens=True,
137
+ )
138
+ print(generated_text)
139
+ print()
140
+
141
+ if __name__ == "__main__":
142
+ main()
143
+ ```
144
+
145
+ ## License
146
+
147
+ Apache 2.0