Stentor-12M is a highly compact, efficient language model built on the Llama architecture. Designed for speed and low-resource environments, this 12M 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: 12M parameters = minimal 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):
Max new tokens: 10–80 (highly recommended)
Temperature: 0.9–1.4
Top-p: 0.4–0.65
Real interactions (sampling is non-deterministic; your outputs may vary):
text
1Max New Tokens: 30
2Temp: 1.2
3Top p: 0.55
4User:
5Hello my name is kai. Who are you?
6Generated Text:
7Hello my name is kai. Who are you? Is the case, that you have heard of? You may not do something about it, and what they do you know. So what is this?
text
1Max New Tokens: 40
2Temp: 1.1
3Top p: 0.45
4User:
5The story of my life is
6Generated text:
7The story of my life is a very important step to our understanding of the world, we have a deeper understanding of the world, and how to make a sense of what we are doing. This is an opportunity to explore and create
text
1Max New Tokens: 30
2Temp: 1
3Top p: 0.55
4User:
5Phycology is the understanding of
6Text Generated:
7Phycology is the understanding of the physical sciences, the evolution of the language and the brain. The evolution of the human body, the evolution of the human brain, and the nature
🚀 Quick Start
Get up and running in 3 simple steps:
1. Install
pip install transformers torch
2. Load & Generate
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor-12M")4tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor-12M")56prompt ="The future of AI is"7inputs = tokenizer(prompt, return_tensors="pt")8outputs = model.generate(9**inputs,10 max_new_tokens=50,# always set this; the model may not stop on its own11 do_sample=True,12 temperature=1.1,13 top_p=0.55,14)1516print(tokenizer.decode(outputs[0], skip_special_tokens=True))
3. Explore!
Try different prompts
Adjust max_new_tokens, temperature, and top_p
Model Details
Model Description
Stentor-12M is a lightweight LlamaForCausalLM model designed to bring the architectural benefits of Llama to a fraction of the size. With a hidden size of 192 and a tiny 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.
Developed by: Kai Izumoto (StentorLabs)
Funded by: Self-funded
Shared by: StentorLabs
Model type: LlamaForCausalLM (Auto-regressive Language Model)
Language(s): English
License: Apache-2.0
Finetuned from model: None (Base model trained from scratch)
Uses
Direct Use
Low-Latency Text Generation: Due to its small size (approx. 12M parameters), Stentor-12M is suitable for real-time applications on CPU or mobile devices.
Instruction-Style Prompting (Limited): You can format prompts using tags like [INST], but the model is not instruction-tuned and will often fail to follow the request.
Tool-Call Formatting Tokens (Limited): The tokenizer may include tool-related tokens, but the model is not trained to reliably emit valid tool calls/JSON or to "use tools".
Edge Deployment: Ideal for resource-constrained environments including mobile devices, IoT, and embedded systems.
Downstream Use
Speculative Decoding (Experimental): Stentor-12M can be used as a fast draft model for larger Llama-based models, but speedups depend on how often the larger model accepts the draft tokens (quality limits may reduce gains).
Educational/Research: A perfect "petri dish" model for studying attention mechanics (3 attention heads) and training dynamics without requiring massive compute.
Prototyping: Quick, low-cost experiments focused on latency, sampling behavior, and failure modes before scaling up.
Out-of-Scope Use
Complex Reasoning: As a 12M parameter model, users should not expect high-level reasoning or deep knowledge retrieval comparable to multi-billion parameter models.
Instruction-Following Chatbots: This is a base model and is not reliably conversational or on-task.
Long Context: The model is optimized for short-context tasks with a maximum position embedding of 512 tokens.
Production-Critical Applications: This is a research/proof-of-concept model and should not be used for mission-critical applications without thorough testing.
Bias, Risks, and Limitations
Context Window: The model has a hard limit of 512 tokens for context length.
Prompt Relevance: Outputs are often generic or unrelated to the prompt, even when they sound fluent.
Knowledge Base: Limited parameter count restricts the amount of world knowledge the model can store.
Training Data Bias: The model inherits any biases present in the FineWeb-Edu and Cosmopedia v2 datasets.
Hallucinations: Like all language models, Stentor-12M may generate plausible-sounding but factually incorrect information.
No Safety Tuning: This is a base model without safety alignment or RLHF.
Recommendations
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.
How to Get Started with the Model
Basic Usage
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23model_id ="StentorLabs/Stentor-12M"45tokenizer = AutoTokenizer.from_pretrained(model_id)6model = AutoModelForCausalLM.from_pretrained(model_id)78# The repo may provide a chat template, but this is still a base model.9# Do not expect reliable instruction following just because you use chat formatting.10messages =[11{"role":"user","content":"Hello, what are you?"}12]1314inputs = tokenizer.apply_chat_template(15 messages,16 return_tensors="pt",17 add_generation_prompt=True18)19outputs = model.generate(inputs, max_new_tokens=50)20print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Advanced Usage with Tool-Call Formatting (Educational)
python
1# The tokenizer may include tokens that resemble tool/function calling formats.2# The base model is not trained to reliably emit valid tool calls or structured JSON.3messages =[4{"role":"system","content":"You are a tiny base language model. You do not have tool access."},5{"role":"user","content":"What's the weather like?"}6]78inputs = tokenizer.apply_chat_template(messages, return_tensors="pt")9outputs = model.generate(inputs, max_new_tokens=100)
Detailed Use Cases
1. Speculative Decoding with Llama 3
Potentially speed up larger model inference by using Stentor-12M as a draft model (results vary):
python
1from transformers import AutoModelForCausalLM, AutoTokenizer
23# Load draft model (Stentor-12M)4draft_model = AutoModelForCausalLM.from_pretrained("StentorLabs/Stentor-12M")5draft_tokenizer = AutoTokenizer.from_pretrained("StentorLabs/Stentor-12M")67# Load target model8target_model = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-3.2-1B")9target_tokenizer = AutoTokenizer.from_pretrained("meta-llama/Llama-3.2-1B")1011# Use speculative decoding (requires a recent Transformers version that supports `assistant_model`)12prompt ="Explain machine learning"13inputs = target_tokenizer(prompt, return_tensors="pt")1415outputs = target_model.generate(16**inputs,17 assistant_model=draft_model,# Stentor-12M as draft18 do_sample=True,19 max_new_tokens=10020)2122print(target_tokenizer.decode(outputs[0], skip_special_tokens=True))
1# These "tasks" are intentionally broad: this tiny base model will often fail.2# The point is to observe latency, failure modes, and sampling behavior.3from transformers import pipeline
45generator = pipeline("text-generation", model="StentorLabs/Stentor-12M")67test_prompts =[8"Summarize this: [long text]",9"Translate to French: Hello",10"Answer: What is 2+2?"11]1213for prompt in test_prompts:14 result = generator(prompt, max_new_tokens=30)[0]['generated_text']15print(f"Prompt: {prompt}\nResult: {result}\n")
Quantization Options
Reduce memory footprint even further with quantization:
The model was trained using a custom script in a Kaggle Jupyter environment, demonstrating the accessibility of training efficient models on free-tier compute.
Preprocessing
The training pipeline utilized lightweight but effective preprocessing steps:
Cleaning: Unicode normalization (NFKC) and whitespace stripping/normalization.
Formatting: Optional wrapping for chat formats or <think> tokens.
Packing: Sequence packing into fixed block_size chunks to maximize training efficiency.
Tokenization: Standard Llama tokenization with EOS tokens appended.
Training Hyperparameters
Click to view full training configuration
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
1,526
Evaluation Steps
100
Gradient Accumulation
Enabled
Speeds, Sizes, Times
Training Time: 4,698.6 seconds (~1.3 hours)
Hardware: 2x Tesla T4 GPUs (Kaggle)
Vocab Size: 32,768 (padded to multiple of 128)
Sequence Length: 512 tokens
Tokens per Second (avg): ~43,000 TPS
Total Parameters: 12,047,040
Embedding Parameters: 6,291,456 (52.2% of total)
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
Testing Data, Factors & Metrics
Testing Data
Evaluation was performed on a held-out validation split of the mixed FineWeb-Edu and Cosmopedia dataset.
Metrics
Validation Loss: Measures how well the model predicts the next token (lower is better).
Perplexity (PPL): The exponential of the loss, indicating how "surprised" the model is by new text (lower is better).
Results
Training Loss Curve
Metric
Value
Validation Loss
4.4887
Perplexity
89.01
Training Progress
The model showed steady improvement throughout training:
Initial loss (step 25): 8.8138
Mid-training loss (step 750): 4.2778
Final loss (step 1526): 4.4887
Total improvement: 34.8%
Note: As a 12M parameter base model trained for < 2 hours, these metrics represent a functional proof-of-concept baseline. The model does not run external benchmarks like MMLU or GSM8K.
Technical Specifications
Model Architecture and Objective
Click to view full architecture specifications
Stentor-12M utilizes the Llama architecture with the following specific configuration:
Component
Value
Hidden Size
192
Intermediate Size
576
Num Hidden Layers
9
Attention Heads
3
Key/Value Heads
3
Hidden Activation
SiLU
RoPE Theta
10000.0
Max Position Embeddings
512
Vocab Size
32,768
Tie Word Embeddings
True
Architecture Note: The number of layers was reduced from the initially planned 12 to 9 to maintain parameter count within the target range while accommodating the large vocabulary size.
Compute Infrastructure
The model was trained using standard cloud infrastructure available to researchers and students.
Hardware
GPUs: 2x NVIDIA Tesla T4 (16GB each)
Platform: Kaggle Notebooks (free tier)
Compute Type: Cloud-based
Software
Transformers Version: 4.57.1
PyTorch Version: Latest stable
Torch Compile: False (disabled for notebook stability)
Accelerate: Enabled for multi-GPU training
Environmental Impact
Hardware Type: 2x NVIDIA Tesla T4
Hours used: ~1.3 hours
Cloud Provider: Kaggle
Compute Region: Unknown
Carbon Emitted: Minimal due to short training time
Training on free-tier cloud GPUs demonstrates the accessibility of small language model research to students and independent researchers.
Related Resources
Official Resources
📊 Training Logs - Detailed training metrics and loss curves
1@misc{izumoto2024stentor12m,
2 title={Stentor-12M: A Compact Llama-based Language Model},
3 author={Kai Izumoto},
4 year={2026},
5 publisher={StentorLabs},
6 howpublished={\url{https://huggingface.co/StentorLabs/Stentor-12M}}
7}
Glossary
NLP (Natural Language Processing): The field of AI focused on the interaction between computers and human language.
PPL (Perplexity): A measurement of how well a probability model predicts a sample. Lower is generally better.
Speculative Decoding: A technique where a small "draft" model (like Stentor-12M) quickly generates tokens that are then verified by a larger model, speeding up the overall process.
SLM (Small Language Model): Language models with parameters typically under 1B, designed for efficiency and specific tasks.
RoPE (Rotary Position Embedding): A method for encoding position information in transformer models.
Edge Deployment: Running models on resource-constrained devices like mobile phones or IoT devices.