Text Generation
Transformers
PyTorch
English
gpt2
scaling-study
benchmarking
banterhearts
text-generation-inference
Instructions to use Crusadersk/tiny-gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Crusadersk/tiny-gpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Crusadersk/tiny-gpt2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Crusadersk/tiny-gpt2") model = AutoModelForCausalLM.from_pretrained("Crusadersk/tiny-gpt2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Crusadersk/tiny-gpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Crusadersk/tiny-gpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Crusadersk/tiny-gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Crusadersk/tiny-gpt2
- SGLang
How to use Crusadersk/tiny-gpt2 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Crusadersk/tiny-gpt2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Crusadersk/tiny-gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Crusadersk/tiny-gpt2" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Crusadersk/tiny-gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Crusadersk/tiny-gpt2 with Docker Model Runner:
docker model run hf.co/Crusadersk/tiny-gpt2
File size: 3,374 Bytes
015daac c674b8c 015daac | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | ---
language:
- en
tags:
- gpt2
- scaling-study
- benchmarking
- banterhearts
pipeline_tag: text-generation
library_name: transformers
license: mit
---
# Tiny GPT-2 (4.6M)
Custom-trained GPT-2 checkpoint with deliberate depth-width configuration for inference benchmarking research.
Created as part of the [Banterhearts research program](https://github.com/Sahil170595/Banterhearts) investigating benchmarking integrity for local LLM inference.
| | |
|---|---|
| **Architecture** | GPT2LMHeadModel (MHA) |
| **Parameters** | 4.6M |
| **Config** | n_embd=2, n_head=2, n_layer=2 |
| **Context length** | 1,024 tokens |
| **Precision** | FP32 |
| **Model size** | 2.4 MB |
| **Vocab size** | 50,257 |
## Purpose
Environment validation and weight parity checks.
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.
## Source Technical Reports
Used in: TR126, TR147
| TR | Role |
|---|---|
| TR117 | Original cross-backend benchmark matrix (7 backends, 4 model groups) |
| TR126 | Linux/Triton compiler validation with phase-separated measurement |
| TR147 | Second-regime portability validation on RTX 6000 Ada |
## Design Rationale
The GPT-2 family (25M, 50M, 100M) uses a 2x3 factorial design:
| Model | n_embd | n_layer | n_inner | Params | Design role |
|---|---|---|---|---|---|
| gpt2-25m | 384 | 3 | 1,536 | 25M | Shallow, narrow |
| gpt2-50m | 512 | 8 | 2,048 | 50M | Deep, medium width |
| gpt2-100m | 768 | 8 | 3,072 | 100M | Deep, wide |
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.
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Crusadersk/tiny-gpt2")
tokenizer = AutoTokenizer.from_pretrained("Crusadersk/tiny-gpt2")
inputs = tokenizer("Hello", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=32, do_sample=False)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
## Compatibility
| Framework | Supported |
|---|---|
| Transformers | Yes |
| torch.compile (Inductor) | Yes |
| Ollama | No (not GGUF format) |
| vLLM | Yes |
## Citation
```bibtex
@misc{banterhearts2026tinygpt2,
title = {Custom GPT-2 Scaling Checkpoint (4.6M) for Inference Benchmarking Research},
author = {Kadadekar, Sahil},
year = {2026},
url = {https://huggingface.co/Crusadersk/tiny-gpt2},
note = {Part of the Banterhearts research program. NeurIPS 2026 submission.}
}
```
## Acknowledgments
This work is part of the Chimera/Banterhearts technical-report program on deployment-time LLM behavior, quantization, refusal robustness, batching effects, and inference-stack reliability. Canonical public archive: [Chimeraforge Reports](https://chimeraforge.vercel.app/reports); source context: [github.com/Sahil170595/Banterhearts](https://github.com/Sahil170595/Banterhearts).
|