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|
+
pipeline_tag: text-generation
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
<div align="center">
|
| 15 |
+
<img src="logo.png" alt="Gladios logo" width="180"/>
|
| 16 |
+
|
| 17 |
+
# Gladios 0.3B ENG — Prototype
|
| 18 |
+
|
| 19 |
+
**A from-scratch GPT-style chat model (~300M parameters), trained on English conversational data.**
|
| 20 |
+
</div>
|
| 21 |
+
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
## Model Description
|
| 25 |
+
|
| 26 |
+
Gladios is a small conversational language model, **built entirely from scratch** — no
|
| 27 |
+
pretrained base, no fine-tuning of an existing LLM. Both the byte-level BPE tokenizer and the
|
| 28 |
+
transformer weights were trained from random initialization on the datasets listed below.
|
| 29 |
+
|
| 30 |
+
This is a genuine **hobbyist prototype/test project**, built by a single passionate individual
|
| 31 |
+
with the help of AI tools during development — not a team, not a company, not a
|
| 32 |
+
production-ready assistant. At ~300M parameters trained on a modest dataset, expect coherent but
|
| 33 |
+
simple answers — not GPT-4-level reasoning.
|
| 34 |
+
|
| 35 |
+
Full training code and documentation: [GitHub — Plimb-ai/gladios-0.3b-eng-prototype](https://github.com/Plimb-ai/gladios-0.3b-eng-prototype)
|
| 36 |
+
|
| 37 |
+
## Architecture
|
| 38 |
+
|
| 39 |
+
A decoder-only transformer, implemented from scratch in PyTorch — no
|
| 40 |
+
`transformers.GPT2Model` or similar off-the-shelf model class, only `nn.Linear`, `nn.LayerNorm`,
|
| 41 |
+
`nn.Embedding` and PyTorch's `scaled_dot_product_attention`.
|
| 42 |
+
|
| 43 |
+
| Component | Detail |
|
| 44 |
+
|---|---|
|
| 45 |
+
| Parameters | ~300M |
|
| 46 |
+
| Layers | 24 |
|
| 47 |
+
| Attention heads | 16 |
|
| 48 |
+
| Embedding dim | 1024 |
|
| 49 |
+
| Context length | 256 tokens |
|
| 50 |
+
| Vocabulary | 8,000 tokens (custom-trained byte-level BPE) |
|
| 51 |
+
| Positional encoding | Learned absolute position embeddings |
|
| 52 |
+
|
| 53 |
+
## Files in this repository
|
| 54 |
+
|
| 55 |
+
| File | Description |
|
| 56 |
+
|---|---|
|
| 57 |
+
| `gladios-0.3b-eng-prototype.pt` | Model weights (lightweight export — no optimizer state), ~1.25 GB |
|
| 58 |
+
| `vocab.json` | BPE tokenizer vocabulary |
|
| 59 |
+
| `merges.txt` | BPE tokenizer merge rules |
|
| 60 |
+
|
| 61 |
+
## Training Data
|
| 62 |
+
|
| 63 |
+
Trained on a combination of public English conversational/instruction datasets:
|
| 64 |
+
|
| 65 |
+
- [OpenAssistant/oasst1](https://huggingface.co/datasets/OpenAssistant/oasst1)
|
| 66 |
+
- [OpenAssistant/oasst2](https://huggingface.co/datasets/OpenAssistant/oasst2)
|
| 67 |
+
- [tatsu-lab/alpaca](https://huggingface.co/datasets/tatsu-lab/alpaca)
|
| 68 |
+
- [databricks/databricks-dolly-15k](https://huggingface.co/datasets/databricks/databricks-dolly-15k)
|
| 69 |
+
- [HuggingFaceH4/ultrachat_200k](https://huggingface.co/datasets/HuggingFaceH4/ultrachat_200k) (20k-example subsample)
|
| 70 |
+
|
| 71 |
+
Each example is formatted as `<|user|> question <|bot|> answer <|endoftext|>`.
|
| 72 |
+
|
| 73 |
+
## How to Use
|
| 74 |
+
|
| 75 |
+
### 1. Install dependencies
|
| 76 |
+
|
| 77 |
+
```bash
|
| 78 |
+
pip install torch tokenizers huggingface_hub
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
### 2. Download the weights and tokenizer
|
| 82 |
+
|
| 83 |
+
```python
|
| 84 |
+
from huggingface_hub import snapshot_download
|
| 85 |
+
|
| 86 |
+
local_dir = snapshot_download(repo_id="plimb/gladios-0.3b-eng-prototype")
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
### 3. Rebuild the model class
|
| 90 |
+
|
| 91 |
+
The `GPT` model class isn't packaged as a pip-installable library — copy it from the snippet
|
| 92 |
+
below (same code used to train this model):
|
| 93 |
+
|
| 94 |
+
```python
|
| 95 |
+
import math
|
| 96 |
+
import torch
|
| 97 |
+
import torch.nn as nn
|
| 98 |
+
import torch.nn.functional as F
|
| 99 |
+
|
| 100 |
+
class CausalSelfAttention(nn.Module):
|
| 101 |
+
def __init__(self, n_embd, n_head, block_size, dropout=0.1):
|
| 102 |
+
super().__init__()
|
| 103 |
+
assert n_embd % n_head == 0
|
| 104 |
+
self.n_head = n_head
|
| 105 |
+
self.n_embd = n_embd
|
| 106 |
+
self.head_dim = n_embd // n_head
|
| 107 |
+
self.qkv = nn.Linear(n_embd, 3 * n_embd, bias=False)
|
| 108 |
+
self.proj = nn.Linear(n_embd, n_embd, bias=False)
|
| 109 |
+
self.attn_dropout = nn.Dropout(dropout)
|
| 110 |
+
self.resid_dropout = nn.Dropout(dropout)
|
| 111 |
+
self.dropout = dropout
|
| 112 |
+
self.register_buffer(
|
| 113 |
+
"mask",
|
| 114 |
+
torch.tril(torch.ones(block_size, block_size)).view(1, 1, block_size, block_size),
|
| 115 |
+
)
|
| 116 |
+
self.flash = hasattr(F, "scaled_dot_product_attention")
|
| 117 |
+
|
| 118 |
+
def forward(self, x):
|
| 119 |
+
B, T, C = x.shape
|
| 120 |
+
qkv = self.qkv(x)
|
| 121 |
+
q, k, v = qkv.split(self.n_embd, dim=2)
|
| 122 |
+
q = q.view(B, T, self.n_head, self.head_dim).transpose(1, 2)
|
| 123 |
+
k = k.view(B, T, self.n_head, self.head_dim).transpose(1, 2)
|
| 124 |
+
v = v.view(B, T, self.n_head, self.head_dim).transpose(1, 2)
|
| 125 |
+
if self.flash:
|
| 126 |
+
y = F.scaled_dot_product_attention(
|
| 127 |
+
q, k, v, attn_mask=None,
|
| 128 |
+
dropout_p=self.dropout if self.training else 0.0,
|
| 129 |
+
is_causal=True,
|
| 130 |
+
)
|
| 131 |
+
else:
|
| 132 |
+
att = (q @ k.transpose(-2, -1)) * (1.0 / math.sqrt(self.head_dim))
|
| 133 |
+
att = att.masked_fill(self.mask[:, :, :T, :T] == 0, float("-inf"))
|
| 134 |
+
att = F.softmax(att, dim=-1)
|
| 135 |
+
att = self.attn_dropout(att)
|
| 136 |
+
y = att @ v
|
| 137 |
+
y = y.transpose(1, 2).contiguous().view(B, T, C)
|
| 138 |
+
y = self.resid_dropout(self.proj(y))
|
| 139 |
+
return y
|
| 140 |
+
|
| 141 |
+
|
| 142 |
+
class MLP(nn.Module):
|
| 143 |
+
def __init__(self, n_embd, dropout=0.1):
|
| 144 |
+
super().__init__()
|
| 145 |
+
self.fc1 = nn.Linear(n_embd, 4 * n_embd, bias=False)
|
| 146 |
+
self.gelu = nn.GELU()
|
| 147 |
+
self.fc2 = nn.Linear(4 * n_embd, n_embd, bias=False)
|
| 148 |
+
self.dropout = nn.Dropout(dropout)
|
| 149 |
+
|
| 150 |
+
def forward(self, x):
|
| 151 |
+
return self.dropout(self.fc2(self.gelu(self.fc1(x))))
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
class Block(nn.Module):
|
| 155 |
+
def __init__(self, n_embd, n_head, block_size, dropout=0.1):
|
| 156 |
+
super().__init__()
|
| 157 |
+
self.ln1 = nn.LayerNorm(n_embd)
|
| 158 |
+
self.attn = CausalSelfAttention(n_embd, n_head, block_size, dropout)
|
| 159 |
+
self.ln2 = nn.LayerNorm(n_embd)
|
| 160 |
+
self.mlp = MLP(n_embd, dropout)
|
| 161 |
+
|
| 162 |
+
def forward(self, x):
|
| 163 |
+
x = x + self.attn(self.ln1(x))
|
| 164 |
+
x = x + self.mlp(self.ln2(x))
|
| 165 |
+
return x
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
class GPT(nn.Module):
|
| 169 |
+
def __init__(self, vocab_size, block_size, n_layer=24, n_head=16, n_embd=1024, dropout=0.0):
|
| 170 |
+
super().__init__()
|
| 171 |
+
self.block_size = block_size
|
| 172 |
+
self.tok_emb = nn.Embedding(vocab_size, n_embd)
|
| 173 |
+
self.pos_emb = nn.Embedding(block_size, n_embd)
|
| 174 |
+
self.drop = nn.Dropout(dropout)
|
| 175 |
+
self.blocks = nn.ModuleList([
|
| 176 |
+
Block(n_embd, n_head, block_size, dropout) for _ in range(n_layer)
|
| 177 |
+
])
|
| 178 |
+
self.ln_f = nn.LayerNorm(n_embd)
|
| 179 |
+
self.head = nn.Linear(n_embd, vocab_size, bias=False)
|
| 180 |
+
self.tok_emb.weight = self.head.weight
|
| 181 |
+
|
| 182 |
+
def forward(self, idx, targets=None):
|
| 183 |
+
B, T = idx.shape
|
| 184 |
+
pos = torch.arange(0, T, dtype=torch.long, device=idx.device)
|
| 185 |
+
x = self.tok_emb(idx) + self.pos_emb(pos)
|
| 186 |
+
x = self.drop(x)
|
| 187 |
+
for block in self.blocks:
|
| 188 |
+
x = block(x)
|
| 189 |
+
x = self.ln_f(x)
|
| 190 |
+
logits = self.head(x)
|
| 191 |
+
loss = None
|
| 192 |
+
if targets is not None:
|
| 193 |
+
loss = F.cross_entropy(logits.view(-1, logits.size(-1)), targets.view(-1), ignore_index=-1)
|
| 194 |
+
return logits, loss
|
| 195 |
+
|
| 196 |
+
@torch.no_grad()
|
| 197 |
+
def generate(self, idx, max_new_tokens, temperature=1.0, top_k=None, stop_token=None):
|
| 198 |
+
self.eval()
|
| 199 |
+
for _ in range(max_new_tokens):
|
| 200 |
+
idx_cond = idx if idx.size(1) <= self.block_size else idx[:, -self.block_size:]
|
| 201 |
+
logits, _ = self(idx_cond)
|
| 202 |
+
logits = logits[:, -1, :] / max(temperature, 1e-6)
|
| 203 |
+
if top_k is not None:
|
| 204 |
+
v, _ = torch.topk(logits, min(top_k, logits.size(-1)))
|
| 205 |
+
logits[logits < v[:, [-1]]] = -float("inf")
|
| 206 |
+
probs = F.softmax(logits, dim=-1)
|
| 207 |
+
next_id = torch.multinomial(probs, num_samples=1)
|
| 208 |
+
idx = torch.cat((idx, next_id), dim=1)
|
| 209 |
+
if stop_token is not None and next_id.item() == stop_token:
|
| 210 |
+
break
|
| 211 |
+
self.train()
|
| 212 |
+
return idx
|
| 213 |
+
```
|
| 214 |
+
|
| 215 |
+
### 4. Load the weights and tokenizer
|
| 216 |
+
|
| 217 |
+
```python
|
| 218 |
+
import os
|
| 219 |
+
import torch
|
| 220 |
+
from tokenizers import ByteLevelBPETokenizer
|
| 221 |
+
|
| 222 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 223 |
+
|
| 224 |
+
ckpt = torch.load(os.path.join(local_dir, "gladios-0.3b-eng-prototype.pt"), map_location=device)
|
| 225 |
+
cfg = ckpt["config"]
|
| 226 |
+
|
| 227 |
+
model = GPT(
|
| 228 |
+
vocab_size=cfg["vocab_size"],
|
| 229 |
+
block_size=cfg["block_size"],
|
| 230 |
+
n_layer=cfg["n_layer"],
|
| 231 |
+
n_head=cfg["n_head"],
|
| 232 |
+
n_embd=cfg["n_embd"],
|
| 233 |
+
dropout=0.0,
|
| 234 |
+
).to(device)
|
| 235 |
+
model.load_state_dict(ckpt["model"])
|
| 236 |
+
model.eval()
|
| 237 |
+
|
| 238 |
+
tokenizer = ByteLevelBPETokenizer(
|
| 239 |
+
os.path.join(local_dir, "vocab.json"),
|
| 240 |
+
os.path.join(local_dir, "merges.txt"),
|
| 241 |
+
)
|
| 242 |
+
eot_id = tokenizer.token_to_id("<|endoftext|>")
|
| 243 |
+
user_id = tokenizer.token_to_id("<|user|>")
|
| 244 |
+
bot_id = tokenizer.token_to_id("<|bot|>")
|
| 245 |
+
```
|
| 246 |
+
|
| 247 |
+
### 5. Chat
|
| 248 |
+
|
| 249 |
+
```python
|
| 250 |
+
def chat(message, max_new_tokens=100, temperature=0.8, top_k=40):
|
| 251 |
+
ids = [user_id] + tokenizer.encode(message).ids + [bot_id]
|
| 252 |
+
x = torch.tensor([ids], dtype=torch.long, device=device)
|
| 253 |
+
out = model.generate(
|
| 254 |
+
x, max_new_tokens=max_new_tokens, temperature=temperature, top_k=top_k,
|
| 255 |
+
stop_token=eot_id,
|
| 256 |
+
)
|
| 257 |
+
response_ids = out[0, len(ids):].tolist()
|
| 258 |
+
if response_ids and response_ids[-1] == eot_id:
|
| 259 |
+
response_ids = response_ids[:-1]
|
| 260 |
+
return tokenizer.decode(response_ids).strip()
|
| 261 |
+
|
| 262 |
+
print(chat("What is the capital of France?"))
|
| 263 |
+
```
|
| 264 |
+
|
| 265 |
+
## Training Details
|
| 266 |
+
|
| 267 |
+
- **Optimizer:** AdamW, cosine learning rate schedule with warmup
|
| 268 |
+
- **Precision:** bfloat16 autocast + gradient scaling on GPU
|
| 269 |
+
- **Regularization:** dropout 0.2, weight decay 0.15
|
| 270 |
+
- **Hardware:** single Colab GPU (T4 / A100 depending on availability)
|
| 271 |
+
- **Checkpointing:** evaluated every 200 iterations, keeping the best validation loss
|
| 272 |
+
|
| 273 |
+
## Limitations
|
| 274 |
+
|
| 275 |
+
- **English only** — no meaningful multilingual capability; prompting in other languages
|
| 276 |
+
produces incoherent output.
|
| 277 |
+
- **Overfitting risk** — with ~300M parameters trained on a comparatively small combined
|
| 278 |
+
corpus, validation loss plateaus after a certain point even with regularization
|
| 279 |
+
(dropout, weight decay) applied. Treat outputs as a learning-project result, not a
|
| 280 |
+
benchmark-grade model.
|
| 281 |
+
- **No safety alignment** — no RLHF, no content filtering, no moderation layer. This is a
|
| 282 |
+
from-scratch research/learning prototype.
|
| 283 |
+
- **Short context window** (256 tokens) — long conversations lose earlier context quickly.
|
| 284 |
+
|
| 285 |
+
## License
|
| 286 |
+
|
| 287 |
+
MIT. Note that the training datasets each carry their own license — check each dataset's card
|
| 288 |
+
before redistribution.
|
| 289 |
+
|
| 290 |
+
## Citation
|
| 291 |
+
|
| 292 |
+
If you reference this project, please link back to the
|
| 293 |
+
[GitHub repository](https://github.com/Plimb-ai/gladios-0.3b-eng-prototype).
|
ckpt.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:67df34ceba2eb2584101c225859d822165654a41046354ccfe3d668fa742fb68
|
| 3 |
+
size 3733031077
|
gladios-0.3b-eng-prototype.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ac9b6e07a54851846070a4f21d6449fd3b4e0f8237d2fe8717020889ffe6114c
|
| 3 |
+
size 1248553879
|
logo.png
ADDED
|
upload_to_hf.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Upload script for Plimb-ai/gladios-0.2b-eng-prototype on Hugging Face.
|
| 3 |
+
|
| 4 |
+
Usage:
|
| 5 |
+
1. pip install huggingface_hub
|
| 6 |
+
2. huggingface-cli login (or set HF_TOKEN env var)
|
| 7 |
+
3. Adjust the paths below to point to your actual local files
|
| 8 |
+
(gladios-0.3b-eng-prototype.pt, vocab.json, merges.txt — from your Colab WORK_DIR)
|
| 9 |
+
4. python upload_to_hf.py
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from huggingface_hub import HfApi, create_repo
|
| 13 |
+
|
| 14 |
+
REPO_ID = "Plimb-ai/gladios-0.2b-eng-prototype"
|
| 15 |
+
|
| 16 |
+
# --- Adjust these paths to match your local files ---
|
| 17 |
+
WEIGHTS_PATH = "gladios-0.3b-eng-prototype.pt" # from your Colab WORK_DIR
|
| 18 |
+
VOCAB_PATH = "vocab.json" # from WORK_DIR/tokenizer/
|
| 19 |
+
MERGES_PATH = "merges.txt" # from WORK_DIR/tokenizer/
|
| 20 |
+
LOGO_PATH = "logo.png"
|
| 21 |
+
README_PATH = "README.md"
|
| 22 |
+
# ------------------------------------------------------
|
| 23 |
+
|
| 24 |
+
api = HfApi()
|
| 25 |
+
|
| 26 |
+
# Creates the repo if it doesn't exist yet (no-op if it already does)
|
| 27 |
+
create_repo(repo_id=REPO_ID, repo_type="model", exist_ok=True)
|
| 28 |
+
|
| 29 |
+
files_to_upload = [
|
| 30 |
+
(WEIGHTS_PATH, "gladios-0.3b-eng-prototype.pt"),
|
| 31 |
+
(VOCAB_PATH, "vocab.json"),
|
| 32 |
+
(MERGES_PATH, "merges.txt"),
|
| 33 |
+
(LOGO_PATH, "logo.png"),
|
| 34 |
+
(README_PATH, "README.md"),
|
| 35 |
+
]
|
| 36 |
+
|
| 37 |
+
for local_path, repo_path in files_to_upload:
|
| 38 |
+
print(f"Uploading {local_path} -> {repo_path} ...")
|
| 39 |
+
api.upload_file(
|
| 40 |
+
path_or_fileobj=local_path,
|
| 41 |
+
path_in_repo=repo_path,
|
| 42 |
+
repo_id=REPO_ID,
|
| 43 |
+
repo_type="model",
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
print(f"\n✅ Done. Model available at: https://huggingface.co/{REPO_ID}")
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|