Instructions to use Lapisbird/Llama-adaLR-model-no_cot_sft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lapisbird/Llama-adaLR-model-no_cot_sft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lapisbird/Llama-adaLR-model-no_cot_sft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Lapisbird/Llama-adaLR-model-no_cot_sft") model = AutoModelForCausalLM.from_pretrained("Lapisbird/Llama-adaLR-model-no_cot_sft", 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 Lapisbird/Llama-adaLR-model-no_cot_sft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lapisbird/Llama-adaLR-model-no_cot_sft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lapisbird/Llama-adaLR-model-no_cot_sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Lapisbird/Llama-adaLR-model-no_cot_sft
- SGLang
How to use Lapisbird/Llama-adaLR-model-no_cot_sft 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 "Lapisbird/Llama-adaLR-model-no_cot_sft" \ --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": "Lapisbird/Llama-adaLR-model-no_cot_sft", "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 "Lapisbird/Llama-adaLR-model-no_cot_sft" \ --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": "Lapisbird/Llama-adaLR-model-no_cot_sft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Lapisbird/Llama-adaLR-model-no_cot_sft with Docker Model Runner:
docker model run hf.co/Lapisbird/Llama-adaLR-model-no_cot_sft
Improve model card with paper, code, pipeline tag, and usage
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,10 +1,31 @@
|
|
| 1 |
---
|
| 2 |
-
library_name: transformers
|
| 3 |
-
license: llama3.2
|
| 4 |
base_model: meta-llama/Llama-3.2-1B-Instruct
|
| 5 |
datasets:
|
| 6 |
- whynlp/gsm8k-aug
|
|
|
|
|
|
|
|
|
|
| 7 |
tags: []
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
| 2 |
base_model: meta-llama/Llama-3.2-1B-Instruct
|
| 3 |
datasets:
|
| 4 |
- whynlp/gsm8k-aug
|
| 5 |
+
library_name: transformers
|
| 6 |
+
license: llama3.2
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
tags: []
|
| 9 |
---
|
| 10 |
|
| 11 |
+
# Learning When to Stop: Adaptive Latent Reasoning via Reinforcement Learning
|
| 12 |
+
|
| 13 |
+
This repository contains the model weights associated with the paper [Learning When to Stop: Adaptive Latent Reasoning via Reinforcement Learning](https://huggingface.co/papers/2511.21581).
|
| 14 |
+
|
| 15 |
+
Latent reasoning represents a new development in Transformer language models that has shown potential in compressing reasoning lengths compared to chain-of-thought reasoning. This work introduces adaptive-length latent reasoning models and a post-SFT reinforcement-learning methodology to optimize latent reasoning length by minimizing it while maintaining accuracy. This approach further reduces compute usage and raises the bar on the compressive capabilities of latent reasoning models. Experiments on the Llama 3.2 1B model and the GSM8K-Aug dataset demonstrated a 52% drop in total reasoning length with no penalty to accuracy.
|
| 16 |
+
|
| 17 |
+
For more details and the full code, please refer to the [GitHub repository](https://github.com/apning/adaptive-latent-reasoning).
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
|
| 21 |
+
You can load these models using the `transformers` library with a custom function provided in the project's `src.model_creation`. An example is provided below:
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
from transformers import AutoTokenizer
|
| 25 |
+
from src.model_creation import automodelforcausallm_from_pretrained_latent
|
| 26 |
+
|
| 27 |
+
repo_id = "Lapisbird/Llama-adaLR-model-latent-6" # Replace with the specific model you want to load from the paper's collection
|
| 28 |
+
|
| 29 |
+
model = automodelforcausallm_from_pretrained_latent(repo_id)
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained(repo_id)
|
| 31 |
+
```
|