Instructions to use McGill-NLP/TLM-230M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use McGill-NLP/TLM-230M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="McGill-NLP/TLM-230M")# Load model directly from transformers import AutoTokenizer, GPTNeoForCausalLMTiered tokenizer = AutoTokenizer.from_pretrained("McGill-NLP/TLM-230M") model = GPTNeoForCausalLMTiered.from_pretrained("McGill-NLP/TLM-230M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use McGill-NLP/TLM-230M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "McGill-NLP/TLM-230M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "McGill-NLP/TLM-230M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/McGill-NLP/TLM-230M
- SGLang
How to use McGill-NLP/TLM-230M 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 "McGill-NLP/TLM-230M" \ --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": "McGill-NLP/TLM-230M", "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 "McGill-NLP/TLM-230M" \ --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": "McGill-NLP/TLM-230M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use McGill-NLP/TLM-230M with Docker Model Runner:
docker model run hf.co/McGill-NLP/TLM-230M
TLM-230M
A Tiered Language Model (TLM) pretrained with Tiered Alignment: one set of weights that exposes two behavioral tiers, toggled by a secret permutation key.
- Public tier (C1) — what you get by loading the weights normally. Open to everyone.
- Keyed tier (C2) — reached by applying
key_5pct.json, which permutes 5% of the attention heads and MLP columns. The permutation is self-inverse, so applying it toggles between the two tiers over the same underlying parameters.
TLM-230M is the 240m rung of a scaling ladder. Its non-keyed counterpart
(identical architecture and token budget, trained without a key) is the baseline used for
all public-tier comparisons.
Files
| File | What it is |
|---|---|
model.safetensors |
Weights in the C1 (public) configuration |
key_5pct.json |
The secret permutation key — swaps over attn_heads and mlp_cols |
config.json, tokenizer.json |
GPT-Neo config; GPT-2 BPE tokenizer (vocab 50257) |
Optimizer state is not included; these checkpoints are for inference and evaluation.
Usage
The weights require GPTNeoForCausalLMTiered, not stock GPTNeoForCausalLM:
this architecture defines lm_head with bias=True, and loading through
AutoModelForCausalLM silently drops that trained bias.
from tiered.model import GPTNeoForCausalLMTiered
from tiered.permutation import load_key, apply_permutation, unapply_permutation
model = GPTNeoForCausalLMTiered.from_pretrained("McGill-NLP/TLM-230M")
key = load_key("key_5pct.json") # downloaded from this repo
# C1 (public) — the state the weights ship in
logits_public = model(input_ids).logits
apply_permutation(model, key) # -> C2 (keyed)
logits_keyed = model(input_ids).logits
unapply_permutation(model, key) # back to C1, bit-exactly
Model details
| Total parameters | 229,137,745 |
| Layers / hidden / heads | 16 / 768 / 12 |
| MLP ratio / context | 8 / 2048 |
| Training tokens | 22.91B (100x total params) |
| Steps / global batch | 49,948 / 224 seqs |
| Peak LR / warmup | 3.9e-4 / 1000 steps |
| Data | FineWeb (retain split) |
| Key coverage | 5% |
Architecture follows the DataDecide ladder (arXiv:2504.11393): interpolated between the 150M and 300M rungs (log-linear in total params, fraction 0.3033).
A note on the ladder's names
Repository names here are total parameter counts, rounded. The underlying DataDecide rung labels are not parameter counts, so the two orderings differ — the "90M" rung has 117M total parameters, more than the "100M" rung's 99M. Ordered by actual size, the ladder runs:
TLM-20M, TLM-40M, TLM-70M, TLM-100M, TLM-120M, TLM-180M, TLM-230M, TLM-650M
TLM-180M predates this ladder and uses 12 layers rather than 16, so it is not architecturally
part of it; treat it separately when fitting scaling curves.
Citation
- Downloads last month
- -