Text Generation
Transformers
Safetensors
English
gpt2
memorization
capacity
random-data
text-generation-inference
Instructions to use evalstate/tiny-gpt-memorization-8m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use evalstate/tiny-gpt-memorization-8m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="evalstate/tiny-gpt-memorization-8m")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("evalstate/tiny-gpt-memorization-8m") model = AutoModelForCausalLM.from_pretrained("evalstate/tiny-gpt-memorization-8m", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use evalstate/tiny-gpt-memorization-8m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "evalstate/tiny-gpt-memorization-8m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "evalstate/tiny-gpt-memorization-8m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/evalstate/tiny-gpt-memorization-8m
- SGLang
How to use evalstate/tiny-gpt-memorization-8m 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 "evalstate/tiny-gpt-memorization-8m" \ --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": "evalstate/tiny-gpt-memorization-8m", "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 "evalstate/tiny-gpt-memorization-8m" \ --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": "evalstate/tiny-gpt-memorization-8m", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use evalstate/tiny-gpt-memorization-8m with Docker Model Runner:
docker model run hf.co/evalstate/tiny-gpt-memorization-8m
upload 8m near-capacity checkpoint
Browse files- README.md +37 -0
- config.json +33 -0
- generation_config.json +6 -0
- model.safetensors +3 -0
README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
library_name: transformers
|
| 4 |
+
tags:
|
| 5 |
+
- memorization
|
| 6 |
+
- capacity
|
| 7 |
+
- gpt2
|
| 8 |
+
- random-data
|
| 9 |
+
license: mit
|
| 10 |
+
---
|
| 11 |
+
# Tiny GPT memorization checkpoint (8m, near-capacity / saturation boundary)
|
| 12 |
+
|
| 13 |
+
From an exploratory tiny-scale replication of
|
| 14 |
+
[How much do language models memorize?](https://huggingface.co/papers/2505.24832).
|
| 15 |
+
|
| 16 |
+
- Architecture: GPT-2 (transformers), trained from scratch.
|
| 17 |
+
- Parameters: 7,916,160 (non-embedding 7,098,624).
|
| 18 |
+
- Vocab: 2048 data tokens (uniform random) + BOS = 2049 model vocab.
|
| 19 |
+
- Sequence length: 64 (paper S=64).
|
| 20 |
+
- Dataset: 44000 sequences, 2,816,000 data tokens,
|
| 21 |
+
dataset entropy 30,976,000 bits (30.976 Mbits).
|
| 22 |
+
- Trained 15698 steps, AdamW, bfloat16, lr 0.002, batch 512.
|
| 23 |
+
- Result: train loss 5.8075 bits/tok, held loss 16.6023,
|
| 24 |
+
memorized 14,622,163 bits = **1.847 bits/parameter**.
|
| 25 |
+
|
| 26 |
+
This is the **near-capacity (saturation-boundary)** run for this model size.
|
| 27 |
+
Below- and above-capacity checkpoints for the same architecture are published as
|
| 28 |
+
`state.pt` files in the results dataset `evalstate/tiny-memorization-results`.
|
| 29 |
+
|
| 30 |
+
Load with:
|
| 31 |
+
```python
|
| 32 |
+
from transformers import GPT2LMHeadModel
|
| 33 |
+
model = GPT2LMHeadModel.from_pretrained("evalstate/tiny-gpt-memorization-8m")
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
Findings are scoped as an exploratory tiny-scale check (three architectures),
|
| 37 |
+
NOT a universal scaling law.
|
config.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_function": "gelu",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"GPT2LMHeadModel"
|
| 5 |
+
],
|
| 6 |
+
"attn_pdrop": 0.0,
|
| 7 |
+
"bos_token_id": 2048,
|
| 8 |
+
"embd_pdrop": 0.0,
|
| 9 |
+
"eos_token_id": 2048,
|
| 10 |
+
"initializer_range": 0.02,
|
| 11 |
+
"layer_norm_epsilon": 1e-05,
|
| 12 |
+
"model_type": "gpt2",
|
| 13 |
+
"n_ctx": 80,
|
| 14 |
+
"n_embd": 384,
|
| 15 |
+
"n_head": 8,
|
| 16 |
+
"n_inner": null,
|
| 17 |
+
"n_layer": 4,
|
| 18 |
+
"n_positions": 80,
|
| 19 |
+
"reorder_and_upcast_attn": false,
|
| 20 |
+
"resid_pdrop": 0.0,
|
| 21 |
+
"scale_attn_by_inverse_layer_idx": false,
|
| 22 |
+
"scale_attn_weights": true,
|
| 23 |
+
"summary_activation": null,
|
| 24 |
+
"summary_first_dropout": 0.1,
|
| 25 |
+
"summary_first_pdrop": 0.0,
|
| 26 |
+
"summary_proj_to_labels": true,
|
| 27 |
+
"summary_type": "cls_index",
|
| 28 |
+
"summary_use_proj": true,
|
| 29 |
+
"torch_dtype": "bfloat16",
|
| 30 |
+
"transformers_version": "4.46.3",
|
| 31 |
+
"use_cache": true,
|
| 32 |
+
"vocab_size": 2049
|
| 33 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2048,
|
| 4 |
+
"eos_token_id": 2048,
|
| 5 |
+
"transformers_version": "4.46.3"
|
| 6 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:300cb2f0b3a6f33d13b66ca438c800a3bb5482e40402b072cf45783dceca265b
|
| 3 |
+
size 15837488
|