Text Generation
Transformers
Safetensors
llama
latent-reasoning
looped-transformer
gsm8k
lotus
conversational
text-generation-inference
Instructions to use yingfanbot/gsm-lotus-llama3b-nl with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use yingfanbot/gsm-lotus-llama3b-nl with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="yingfanbot/gsm-lotus-llama3b-nl") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("yingfanbot/gsm-lotus-llama3b-nl") model = AutoModelForCausalLM.from_pretrained("yingfanbot/gsm-lotus-llama3b-nl", device_map="auto") 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 Settings
- vLLM
How to use yingfanbot/gsm-lotus-llama3b-nl with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "yingfanbot/gsm-lotus-llama3b-nl" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "yingfanbot/gsm-lotus-llama3b-nl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/yingfanbot/gsm-lotus-llama3b-nl
- SGLang
How to use yingfanbot/gsm-lotus-llama3b-nl 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 "yingfanbot/gsm-lotus-llama3b-nl" \ --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": "yingfanbot/gsm-lotus-llama3b-nl", "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 "yingfanbot/gsm-lotus-llama3b-nl" \ --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": "yingfanbot/gsm-lotus-llama3b-nl", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use yingfanbot/gsm-lotus-llama3b-nl with Docker Model Runner:
docker model run hf.co/yingfanbot/gsm-lotus-llama3b-nl
File size: 1,660 Bytes
043d4ef 9a4fbb8 043d4ef | 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 | ---
license: mit
base_model: meta-llama/Llama-3.2-3B-Instruct
library_name: transformers
pipeline_tag: text-generation
tags: [latent-reasoning, looped-transformer, gsm8k, lotus]
---
# gsm-lotus-llama3b-nl
LOTUS trained on **natural-language chain-of-thought**, fine-tuned from `meta-llama/Llama-3.2-3B-Instruct`,
from the paper
[Bridging the Gap Between Latent and Explicit Reasoning with Looped Transformers](https://arxiv.org/abs/2606.31779).
Direct step-aligned supervision through the base LM head (no aux decoder, no CODI); the latent blocks are
supervised against natural-language reasoning steps rather than formatted math expressions.
- **GSM8K (GSM8k-Aug) test accuracy:** 68.54% (904/1319)
- **Latent config:** K = 6 blocks, **c_thought = 50** tokens/block (NL steps are ~2.7x longer than math-expr,
so c=50 covers ~98.8% of steps), n_looped_iters = 6
- **Base:** meta-llama/Llama-3.2-3B-Instruct (vocab 128256 -> 128259 for 3 latent tokens)
## Loading
`from_pretrained` loads the weights only — the looped padded architecture needs the LOTUS code
([code repo](https://github.com/yingfan-bot/lotus)).
## Reproduce the number above
Run in the pinned env (torch 2.7 / transformers 4.46.2) — note **`--c_thought 50`** for this NL model:
```bash
python scripts/eval.py \
--model_id yingfanbot/gsm-lotus-llama3b-nl \
--datasets gsm8k --n_looped_iters 6 --c_thought 50 --bf16
```
## Citation
```bibtex
@article{fan2026bridging,
title={Bridging the Gap Between Latent and Explicit Reasoning with Looped Transformers},
author={Fan, Ying and Svete, Anej and Lee, Kangwook},
journal={arXiv preprint arXiv:2606.31779},
year={2026}
}
```
|