Stentor-30M is a highly compact, efficient language model built on the Llama architecture. Designed for speed and low-resource environments, this ~30.4M parameter checkpoint utilizes a mixed-precision training pipeline and is best treated as a base next-token predictor (not a chat assistant). It does not "understand" text in a human sense and is not trained to reliably follow instructions. While the tokenizer may include special tokens/templates that resemble instruction or tool formats, the model itself is not instruction-tuned and will often generate plausible but off-topic text. It serves as an accessible entry point for researching attention mechanisms and testing training pipelines on consumer hardware.
⚠️ Important Limitations
- Context Window: Maximum 512 tokens (very short)
- Not Instruction-Tuned: May ignore prompts or respond off-topic
- Stopping / EOS: Sometimes stops on its own, but it's rare; always set
max_new_tokens- Tokenizer ≠ Capability: "tool/function" tokens do not imply real tool use
- No Safety Tuning: Base model without RLHF or safety alignment
- Limited Knowledge: 30M parameters = limited world knowledge
- Proof-of-Concept: Not suitable for production without fine-tuning
- Educational Focus: Trained on synthetic textbooks, not diverse real-world data
Recommended generation settings (based on manual testing):
Real interactions (sampling is non-deterministic; your outputs may vary):
Max New Tokens: 30
Temp: 1.2
Top p: 0.55
User:
The story of my life is
Generated text:
The story of my life is a tale of the story of the man who has been born in Germany. He was the first to learn about his family, and his story of the
Max New Tokens: 30
Temp: 1.2
Top p: 0.7
User:
Biology is the understanding of
Generated text:
Biology is the understanding of nature and animals, not only as a model for biological research but also as a tool for understanding human behavior and conservation. Biological research is about understanding
Max New Tokens: 30
Temp: 1.2
Top p: 0.7
User:
Everyone is dead
Text Generated:
Everyone is dead: 50 percent of our people will be killed in the coming days of our nation. 60 percent of us will live and go in
Get up and running in 3 simple steps:
pip install transformers torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor-30M")
tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor-30M")
prompt = "The future of AI is"
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(
**inputs,
max_new_tokens=50, # always set this; the model may not stop on its own
do_sample=True,
temperature=1.1,
top_p=0.55,
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
max_new_tokens, temperature, and top_pPre-quantized versions of Stentor-30M are available for use with llama.cpp, LM Studio, Ollama, and other compatible runtimes — no conversion needed.
| Format | Provider | Link |
|---|---|---|
| GGUF (multiple quants) | mradermacher | mradermacher/Stentor-30M-GGUF |
Just download your preferred quantization (e.g. Q4_K_M for a good size/quality balance) and run it directly with llama.cpp or load it in LM Studio.
Stentor-30M is a lightweight LlamaForCausalLM model designed to bring the architectural benefits of Llama to a fraction of the size. With a hidden size of 256 and a compact parameter budget, this model is optimized for rapid inference and edge-deployment scenarios where memory is at a premium.
The tokenizer configuration may include control tokens commonly used in instruction/tool-call formatting (for experimentation), but these tokens do not make the base model instruction-following or tool-using. If you need reliable instruction following or structured tool calls, you will need additional fine-tuning / alignment.
[INST], but the model is not instruction-tuned and will often fail to follow the request.Users (both direct and downstream) should be made aware of the risks, biases, and limitations of the model. This model is best used for specific, narrow tasks or as a component in a larger system (e.g., speculative decoding) rather than a general-purpose assistant.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "StentorLabs/Stentor-30M"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
# The repo may provide a chat template, but this is still a base model.
# Do not expect reliable instruction following just because you use chat formatting.
messages = [
{"role": "user", "content": "Hello, what are you?"}
]
inputs = tokenizer.apply_chat_template(
messages,
return_tensors="pt",
add_generation_prompt=True
)
outputs = model.generate(inputs, max_new_tokens=50)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
# The tokenizer may include tokens that resemble tool/function calling formats.
# The base model is not trained to reliably emit valid tool calls or structured JSON.
messages = [
{"role": "system", "content": "You are a tiny base language model. You do not have tool access."},
{"role": "user", "content": "What's the weather like?"}
]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")
outputs = model.generate(inputs, max_new_tokens=100)
Potentially speed up larger model inference by using Stentor-30M as a draft model (results vary):
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load draft model (Stentor-30M)
draft_model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor-30M")
draft_tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor-30M")
# Load target model
target_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B")
target_tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")
# Use speculative decoding (requires a recent Transformers version that supports `assistant_model`)
prompt = "Explain machine learning"
inputs = target_tokenizer(prompt, return_tensors="pt")
outputs = target_model.generate(
**inputs,
assistant_model=draft_model, # Stentor-30M as draft
do_sample=True,
max_new_tokens=100
)
print(target_tokenizer.decode(outputs[0], skip_special_tokens=True))
Pre-quantized GGUF files are available at mradermacher/Stentor-30M-GGUF — no conversion required.
# Download a quantized GGUF (e.g. Q4_K_M) from the link above, then run with llama.cpp:
./llama-cli -m stentor-30m-Q4_K_M.gguf -p "Hello world" -n 50
Or simply load the .gguf file directly in LM Studio or Ollama for a GUI/API experience.
Convert to ONNX for mobile/edge deployment:
# Install dependencies
pip install optimum[exporters]
# Export to ONNX
optimum-cli export onnx \
--model StentorLabs/Stentor-30M \
--task text-generation-with-past \
stentor-30m-onnx/
# Use with ONNX Runtime
from optimum.onnxruntime import ORTModelForCausalLM
from transformers import AutoTokenizer
model = ORTModelForCausalLM.from_pretrained("stentor-30m-onnx")
tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor-30M")
inputs = tokenizer("Hello world", return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=20)
print(tokenizer.decode(outputs[0]))
Quick experimentation before scaling:
# These "tasks" are intentionally broad: this tiny base model will often fail.
# The point is to observe latency, failure modes, and sampling behavior.
from transformers import pipeline
generator = pipeline("text-generation", model="StentorLabs/Stentor-30M")
test_prompts = [
"Summarize this: [long text]",
"Translate to French: Hello",
"Answer: What is 2+2?"
]
for prompt in test_prompts:
result = generator(prompt, max_new_tokens=30)[0]['generated_text']
print(f"Prompt: {prompt}\nResult: {result}\n")
If you want to produce your own quantized versions rather than using the pre-built GGUFs:
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
quantization_config = BitsAndBytesConfig(load_in_8bit=True)
model = AutoModelForCausalLM.from_pretrained(
"StentorLabs/Stentor-30M",
quantization_config=quantization_config,
device_map="auto"
)
# Memory: ~30 MB (~50% reduction from fp16 weights)
quantization_config = BitsAndBytesConfig(load_in_4bit=True)
model = AutoModelForCausalLM.from_pretrained(
"StentorLabs/Stentor-30M",
quantization_config=quantization_config,
device_map="auto"
)
# Memory: ~15 MB (~75% reduction from fp16 weights)
Note: Requires bitsandbytes library: pip install bitsandbytes
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
# Install dependencies
pip install -r requirements.txt
# Download model
huggingface-cli download StentorLabs/Stentor-30M --local-dir stentor-30m
# Convert to GGUF
python convert_hf_to_gguf.py stentor-30m/ \
--outfile stentor-30m.gguf \
--outtype f16
# Quantize (optional)
./llama-quantize stentor-30m.gguf stentor-30m-q4_0.gguf q4_0
# Install dependencies
pip install tensorflow tf2onnx
# First convert to ONNX (see above)
# Then convert ONNX to TFLite
python -m tf2onnx.convert \
--onnx stentor-30m-onnx/model.onnx \
--output stentor-30m.tflite \
--opset 13
Format summary:
The model was trained on a high-quality mixed dataset focused on educational content and synthetic textbook data:
Total tokens processed: 600,000,512 tokens
The model was trained using a custom script in a Kaggle Jupyter environment, demonstrating the accessibility of training efficient models on free-tier compute.
The training pipeline utilized lightweight but effective preprocessing steps:
<think> tokens.| Hyperparameter | Value |
|---|---|
| Precision | fp16 mixed precision |
| Optimizer | AdamW |
| Scheduler | Cosine |
| Learning Rate | 0.0008 |
| Weight Decay | 0.01 |
| Warmup Ratio | 0.02 |
| Stable Ratio | 0.8 |
| Total Batch Size | 256 |
| Max Train Steps | 4,578 |
| Evaluation Steps | 100 |
| Gradient Accumulation | 64 |
num_processes: 1)Note: A significant portion of parameters are allocated to embeddings due to the 32K vocabulary size. For future iterations, a smaller vocabulary (8K-16K) could free up capacity for additional model layers.
Evaluation was performed on a held-out validation split of the mixed FineWeb-Edu and Cosmopedia dataset.
| Metric | Value |
|---|---|
| Validation Loss | 3.4971 (best @ step 4500) |
| Perplexity | 33.02 |
The model showed steady improvement throughout training:
Note: As a 30M parameter base model, this checkpoint should be treated as a functional proof-of-concept baseline. The model does not run external benchmarks like MMLU or GSM8K.
Stentor-30M utilizes the Llama architecture with the following specific configuration:
| Component | Value |
|---|---|
| Hidden Size | 256 |
| Intermediate Size | 1024 |
| Num Hidden Layers | 21 |
| Attention Heads | 4 |
| Key/Value Heads | 4 |
| Hidden Activation | SiLU |
| RoPE Theta | 10000.0 |
| Max Position Embeddings | 512 |
| Vocab Size | 32,768 |
| Tie Word Embeddings | True |
Architecture Note: This configuration is set to 21 layers to keep total parameters in the 30M-31M target range with a 32,768-token vocabulary.
The model was trained using standard cloud infrastructure available to researchers and students.
Training on free-tier cloud GPUs demonstrates the accessibility of small language model research to students and independent researchers.
results/best_model (config + tokenizer + weights + metadata)@misc{izumoto2026stentor30m,
title={Stentor-30M: A Compact Llama-based Language Model},
author={Kai Izumoto},
year={2026},
publisher={StentorLabs},
howpublished={\url{https://huggingface.co/StentorLabs/Stentor-30M}}
}
For questions, please contact StentorLabs@gmail.com or open an issue on the model repository.
Special thanks to:
Made with ❤️ by StentorLabs
Democratizing AI through accessible, efficient models