Instructions to use 4lph4v3rs3/lightweightl-LLM-135M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use 4lph4v3rs3/lightweightl-LLM-135M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="4lph4v3rs3/lightweightl-LLM-135M")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("4lph4v3rs3/lightweightl-LLM-135M") model = AutoModelForCausalLM.from_pretrained("4lph4v3rs3/lightweightl-LLM-135M") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use 4lph4v3rs3/lightweightl-LLM-135M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "4lph4v3rs3/lightweightl-LLM-135M" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "4lph4v3rs3/lightweightl-LLM-135M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/4lph4v3rs3/lightweightl-LLM-135M
- SGLang
How to use 4lph4v3rs3/lightweightl-LLM-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 "4lph4v3rs3/lightweightl-LLM-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": "4lph4v3rs3/lightweightl-LLM-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 "4lph4v3rs3/lightweightl-LLM-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": "4lph4v3rs3/lightweightl-LLM-135M", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use 4lph4v3rs3/lightweightl-LLM-135M with Docker Model Runner:
docker model run hf.co/4lph4v3rs3/lightweightl-LLM-135M
LightweightLLM-135M
Table of Contents
Model Summary
LightweightLLM-135M is a compact, efficient language model designed for on-device usage and low-resource environments. It is derived from the SmolLM2 family, providing strong instruction-following and reasoning capabilities in a lightweight format.
- Parameters: 135M
- Use Cases: Text generation, summarization, rewriting, basic reasoning
- Language: English
How to Use
Installation
pip install transformers
Example Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
checkpoint = "4lph4v3rs3/lightweightl-LLM-135M"
device = "cuda" # or "cpu"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(checkpoint).to(device)
inputs = tokenizer.encode("Gravity is", return_tensors="pt").to(device)
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Using bfloat16
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
checkpoint = "4lph4v3rs3/lightweightl-LLM-135M"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)
model = AutoModelForCausalLM.from_pretrained(
checkpoint,
device_map="auto",
torch_dtype=torch.bfloat16
)
inputs = tokenizer.encode("Gravity is", return_tensors="pt").to("cuda")
outputs = model.generate(inputs)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Evaluation
LightweightLLM-135M has been benchmarked on common NLP tasks using zero-shot evaluation, showing strong performance for a 135M-parameter model in instruction following, commonsense reasoning, and text generation.
Limitations
- Only supports English
- May produce incorrect or biased content
- Not suitable as a definitive knowledge source
Use outputs as an assistive tool and verify important information independently.
Training
- Architecture: Transformer decoder
- Pretraining tokens: Large-scale text and code datasets
- Precision: bfloat16
- Framework: Hugging Face Nanotron
License
Citation
@misc{allal2025smollm2smolgoesbig,
title={SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model},
author={Loubna Ben Allal et al.},
year={2025},
eprint={2502.02737},
archivePrefix={arXiv},
primaryClass={cs.CL}
}
- Downloads last month
- 6
