Se00n00/TinyLM2-50M-Base
TinyLM2-50M
TinyLM2-50M is a compact decoder-only Transformer language model designed for efficient instruction following and conversational AI. The model has approximately 50M parameters and has been pre-trained on 4 billion tokens using the ALiBi decoder-only architecture, providing a lightweight platform for researching and understanding language-model behavior while remaining suitable for local inference and resource-constrained environments.
Evaluation
All evaluations are zero-shot unless stated otherwise, and i used lmeval to run them <img src="losschart.png">
Model Architecture & Hyperparameters
TinyLM2-50M is built on a custom ALiBi Decoder-Only Transformer architecture with pre-normalization and gated feedforward networks:
## Tokenizer & Chat Template
The model uses a custom Byte-Level BPE Tokenizer equipped with special tokens and a pre-configured Jinja2 chat_template for multi-turn conversations.
## Training Configuration
## Inference
# pip install torch transformers
import torch
from transformers import pipeline
pipe = pipeline(
"text-generation",
model="Se00n00/TinyLM2-50M",
trust_remote_code = True
)
messages = [
{"role": "system", "content": "You are a helpful AI assistant."},
{"role": "user", "content": "Explain artificial intelligence in simple terms."}
]
prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
result = pipe(
prompt,
max_new_tokens=120,
do_sample=True,
temperature=0.5,
top_k=40,
top_p=0.9
)
print(result[0]['generated_text']) ──────
Sample Outputs
Raw next-token continuation (no chat template, temperature 0.8, top-p 0.9):
Prompt: Photosynthesis is the process by which
Plants take up oxygen and use it to make energy. Plant leaves, flowers, and even fruit can also convert carbon dioxide (CO2) into sugars. As you grow, plants are able to store the carbon dioxide from their leaves and convert it to sugars and carbohydrates. This is known as photosynthesis, and it is a process that converts the carbon dioxide into a form of energy. …
