Upload Tiny GPT-2 (4.6M) for TR147 portability validation
Browse files- README.md +94 -0
- config.json +31 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
tags:
|
| 5 |
+
- gpt2
|
| 6 |
+
- scaling-study
|
| 7 |
+
- benchmarking
|
| 8 |
+
- banterhearts
|
| 9 |
+
pipeline_tag: text-generation
|
| 10 |
+
library_name: transformers
|
| 11 |
+
license: mit
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# Tiny GPT-2 (4.6M)
|
| 15 |
+
|
| 16 |
+
Custom-trained GPT-2 checkpoint with deliberate depth-width configuration for inference benchmarking research.
|
| 17 |
+
|
| 18 |
+
Created as part of the [Banterhearts research program](https://github.com/Sahil170595/Banterhearts) investigating benchmarking integrity for local LLM inference.
|
| 19 |
+
|
| 20 |
+
| | |
|
| 21 |
+
|---|---|
|
| 22 |
+
| **Architecture** | GPT2LMHeadModel (MHA) |
|
| 23 |
+
| **Parameters** | 4.6M |
|
| 24 |
+
| **Config** | n_embd=2, n_head=2, n_layer=2 |
|
| 25 |
+
| **Context length** | 1,024 tokens |
|
| 26 |
+
| **Precision** | FP32 |
|
| 27 |
+
| **Model size** | 2.4 MB |
|
| 28 |
+
| **Vocab size** | 50,257 |
|
| 29 |
+
|
| 30 |
+
## Purpose
|
| 31 |
+
|
| 32 |
+
Environment validation and weight parity checks.
|
| 33 |
+
|
| 34 |
+
These checkpoints are not general-purpose language models. They are deliberately sized scaling-study artifacts designed to isolate the effect of model depth vs width on GPU inference latency. The key finding: in the small-model GPU regime, **layer depth** (not parameter count) dominates latency, producing inversions where a 5M-parameter model can be 3.6x slower than a 25M-parameter model.
|
| 35 |
+
|
| 36 |
+
## Source Technical Reports
|
| 37 |
+
|
| 38 |
+
Used in: TR126, TR147
|
| 39 |
+
|
| 40 |
+
| TR | Role |
|
| 41 |
+
|---|---|
|
| 42 |
+
| TR117 | Original cross-backend benchmark matrix (7 backends, 4 model groups) |
|
| 43 |
+
| TR126 | Linux/Triton compiler validation with phase-separated measurement |
|
| 44 |
+
| TR147 | Second-regime portability validation on RTX 6000 Ada |
|
| 45 |
+
|
| 46 |
+
## Design Rationale
|
| 47 |
+
|
| 48 |
+
The GPT-2 family (25M, 50M, 100M) uses a 2x3 factorial design:
|
| 49 |
+
|
| 50 |
+
| Model | n_embd | n_layer | n_inner | Params | Design role |
|
| 51 |
+
|---|---|---|---|---|---|
|
| 52 |
+
| gpt2-25m | 384 | 3 | 1,536 | 25M | Shallow, narrow |
|
| 53 |
+
| gpt2-50m | 512 | 8 | 2,048 | 50M | Deep, medium width |
|
| 54 |
+
| gpt2-100m | 768 | 8 | 3,072 | 100M | Deep, wide |
|
| 55 |
+
|
| 56 |
+
All models use **2 attention heads** (MHA, not GQA) to isolate architecture effects from attention-group structure. Dropout is set to 0.0 for deterministic inference measurement.
|
| 57 |
+
|
| 58 |
+
## Usage
|
| 59 |
+
|
| 60 |
+
```python
|
| 61 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 62 |
+
|
| 63 |
+
model = AutoModelForCausalLM.from_pretrained("Crusadersk/tiny-gpt2")
|
| 64 |
+
tokenizer = AutoTokenizer.from_pretrained("Crusadersk/tiny-gpt2")
|
| 65 |
+
|
| 66 |
+
inputs = tokenizer("Hello", return_tensors="pt")
|
| 67 |
+
outputs = model.generate(**inputs, max_new_tokens=32, do_sample=False)
|
| 68 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Compatibility
|
| 72 |
+
|
| 73 |
+
| Framework | Supported |
|
| 74 |
+
|---|---|
|
| 75 |
+
| Transformers | Yes |
|
| 76 |
+
| torch.compile (Inductor) | Yes |
|
| 77 |
+
| Ollama | No (not GGUF format) |
|
| 78 |
+
| vLLM | Yes |
|
| 79 |
+
|
| 80 |
+
## Citation
|
| 81 |
+
|
| 82 |
+
```bibtex
|
| 83 |
+
@misc{banterhearts2026tinygpt2,
|
| 84 |
+
title = {Custom GPT-2 Scaling Checkpoint (4.6M) for Inference Benchmarking Research},
|
| 85 |
+
author = {Kadadekar, Sahil},
|
| 86 |
+
year = {2026},
|
| 87 |
+
url = {https://huggingface.co/Crusadersk/tiny-gpt2},
|
| 88 |
+
note = {Part of the Banterhearts research program. NeurIPS 2026 submission.}
|
| 89 |
+
}
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
## Acknowledgments
|
| 93 |
+
|
| 94 |
+
This work is part of a 40-TR research program on consumer LLM deployment safety, conducted independently as pre-doctoral research. Full program details at [github.com/Sahil170595/Banterhearts](https://github.com/Sahil170595/Banterhearts).
|
config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu_new",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GPT2LMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attn_pdrop": 0.1,
|
| 7 |
+
"bos_token_id": 50256,
|
| 8 |
+
"embd_pdrop": 0.1,
|
| 9 |
+
"eos_token_id": 50256,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"layer_norm_epsilon": 1e-05,
|
| 12 |
+
"model_type": "gpt2",
|
| 13 |
+
"n_ctx": 1024,
|
| 14 |
+
"n_embd": 2,
|
| 15 |
+
"n_head": 2,
|
| 16 |
+
"n_layer": 2,
|
| 17 |
+
"n_positions": 1024,
|
| 18 |
+
"resid_pdrop": 0.1,
|
| 19 |
+
"summary_activation": null,
|
| 20 |
+
"summary_first_dropout": 0.1,
|
| 21 |
+
"summary_proj_to_labels": true,
|
| 22 |
+
"summary_type": "cls_index",
|
| 23 |
+
"summary_use_proj": true,
|
| 24 |
+
"task_specific_params": {
|
| 25 |
+
"text-generation": {
|
| 26 |
+
"do_sample": true,
|
| 27 |
+
"max_length": 50
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
"vocab_size": 50257
|
| 31 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b706b24034032bdfe765ded5ab6403d201d295a995b790cb24c74becca5c04e6
|
| 3 |
+
size 2514146
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": "<|endoftext|>", "eos_token": "<|endoftext|>", "unk_token": "<|endoftext|>"}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"model_max_length": 1024}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|