Instructions to use zeng123/PonderLM-2-Pythia-410m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use zeng123/PonderLM-2-Pythia-410m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zeng123/PonderLM-2-Pythia-410m", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("zeng123/PonderLM-2-Pythia-410m", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("zeng123/PonderLM-2-Pythia-410m", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use zeng123/PonderLM-2-Pythia-410m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "zeng123/PonderLM-2-Pythia-410m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zeng123/PonderLM-2-Pythia-410m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/zeng123/PonderLM-2-Pythia-410m
- SGLang
How to use zeng123/PonderLM-2-Pythia-410m 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 "zeng123/PonderLM-2-Pythia-410m" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zeng123/PonderLM-2-Pythia-410m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "zeng123/PonderLM-2-Pythia-410m" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "zeng123/PonderLM-2-Pythia-410m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use zeng123/PonderLM-2-Pythia-410m with Docker Model Runner:
docker model run hf.co/zeng123/PonderLM-2-Pythia-410m
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("zeng123/PonderLM-2-Pythia-410m", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("zeng123/PonderLM-2-Pythia-410m", trust_remote_code=True)
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))PonderLM-2-Pythia-410m
Pythia-410m architecture pretrained with PonderLM-2, the method introduced in PonderLM-2: Pretraining LLM with Latent Thoughts in Continuous Space (ICML 2026 Spotlight).
TL;DR. Chain-of-Thought scales test-time compute by generating extra tokens. PonderLM-2 does the same at pretraining time, but in continuous space: before predicting each next token the model first emits a few latent thoughts β extra last-hidden-state vectors β and feeds them back into itself.
vanilla: xβ βββΊ xβ βββΊ xβ βββΊ xβ
PonderLM-2: xβ βββΊ zβ βββΊ xβ βββΊ zβ βββΊ xβ βββΊ zβ βββΊ xβ βββΊ zβ
z_i = latent thought emitted before predicting x_{i+1}
- Code: LUMIA-Group/PonderLM-2
- Paper: arXiv:2509.23184
- Sibling checkpoint:
zeng123/PonderLM-2-Pythia-1.4b
Usage
The model ships with a custom modeling_gpt_neox.py that runs the
pondering forward pass. Loading via AutoModelForCausalLM requires
trust_remote_code=True:
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
ckpt = "zeng123/PonderLM-2-Pythia-410m"
tok = AutoTokenizer.from_pretrained(ckpt)
model = AutoModelForCausalLM.from_pretrained(
ckpt,
torch_dtype=torch.bfloat16,
trust_remote_code=True,
).cuda()
prompt = "The mitochondria is "
out = model.generate(
**tok(prompt, return_tensors="pt").to(model.device),
max_new_tokens=64,
use_cache=True,
)
print(tok.decode(out[0], skip_special_tokens=True))
Model details
| Architecture | GPT-NeoX (Pythia family) |
| Parameters | 410 M |
| Hidden size | 1024 |
| Layers | 24 |
| Attention heads | 16 |
| Context length | 2048 |
| Vocabulary | 50 304 |
| Tokenizer | GPT-NeoX BPE (same as Pythia) |
| Precision | BF16 |
Citation
@article{zeng2025ponderlm,
title={Ponderlm-2: Pretraining llm with latent thoughts in continuous space},
author={Zeng, Boyi and Li, He and Song, Shixiang and Wang, Yixuan and Wang, Zitong and He, Ziwei and Wang, Xinbing and Lin, Zhouhan},
journal={arXiv preprint arXiv:2509.23184},
year={2025}
}
Acknowledgements
Built on top of the Pythia training stack and LLaMA-Factory. The PonderLM baseline implementation is adapted from LUMIA-Group/PonderingLM.
- Downloads last month
- 20
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="zeng123/PonderLM-2-Pythia-410m", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)