Instructions to use nthngdy/cplm-135M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use nthngdy/cplm-135M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="nthngdy/cplm-135M")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("nthngdy/cplm-135M", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use nthngdy/cplm-135M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "nthngdy/cplm-135M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "nthngdy/cplm-135M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/nthngdy/cplm-135M
- SGLang
How to use nthngdy/cplm-135M 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 "nthngdy/cplm-135M" \ --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": "nthngdy/cplm-135M", "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 "nthngdy/cplm-135M" \ --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": "nthngdy/cplm-135M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use nthngdy/cplm-135M with Docker Model Runner:
docker model run hf.co/nthngdy/cplm-135M
Copy-Paste Language Models — 135M
135M-parameter Copy-Paste Language Models (CPLMs) from the paper Copy-Paste Language Models (Nathan Godey & Yoav Artzi, Cornell University). Paper
A CPLM adds a lightweight Copy-Paste (CP) head next to the standard LM head. The CP head attends over past positions and copies the token found there. It is triggered by a dummy <copy> token in the LM head and can fall back to the LM head through a learnable sink. The final next-token distribution is a mixture of the two heads, trained end-to-end with the standard next-token loss only.
Vanilla baselines trained with the exact same recipe are available at nthngdy/cplm-baselines-135M. Larger models: nthngdy/cplm-360M, nthngdy/cplm-1.7B.
Checkpoints
Each model is stored on its own branch. Three backbones are available:
| Backbone | Description |
|---|---|
full |
Full attention in all 30 layers |
hybrid |
3 sliding-window (w=256) layers for every full-attention layer |
sw |
Sliding-window attention (w=256) in all layers |
These are the final checkpoints (20B tokens, step 19,000, after the LR cooldown).
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "nthngdy/cplm-135M"
tok = AutoTokenizer.from_pretrained(repo, revision="full")
model = AutoModelForCausalLM.from_pretrained(repo, revision="full", trust_remote_code=True)
ids = tok("The capital of France is", return_tensors="pt").input_ids
print(tok.decode(model.generate(ids, max_new_tokens=32)[0]))
model.config.inference_mode controls decoding: "natural" (default, mixture of both heads), "no_copy" (LM head only) or "force_copy" (CP head only).
Training
- Architecture: SmolLM3-style backbone with 30 layers, hidden size 576, 9 query / 3 key-value heads and tied embeddings, plus the CP head (+0.7M parameters). The vocabulary has 49,152 tokens plus
<copy>. - Data: 20B tokens of FineWeb-Edu, 2,048-token sequences.
- Recipe: AdamW (betas 0.9/0.95, weight decay 0.01), peak LR 3e-3, WSD schedule (500 warmup steps, 1,900 cooldown steps, 19,000 steps in total) and batch size 512.
Results
Final validation perplexity on held-out FineWeb-Edu:
| Backbone | Vanilla | CPLM |
|---|---|---|
| Full | 16.38 | 15.88 |
| Hybrid | 16.40 | 15.87 |
| SW | 16.91 | 16.06 |
Citation
@misc{godey2026copypastelanguagemodels,
title={Copy-Paste Language Models},
author={Nathan Godey and Yoav Artzi},
year={2026},
eprint={2610.19247},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2610.19247},
}