cero-micro-es
Educational Spanish Language Model Built From Scratch
2 min read
This 5.8-million-parameter language technology model was trained on Spanish children's stories to teach the core mechanics of language models rather than act as a daily assistant. Created as part of the "Crear un LLM desde cero" learning initiative, it includes a base checkpoint for text continuation and a supervised fine-tuned (SFT) version for chat. The project demonstrates transformer architecture in a PyTorch environment and comes with a comprehensive educational course.
Key features
- Compact size: just 5.76 million parameters, with training completed in 3 minutes on a mobile RTX 4070 graphics card
- Modern architecture: features RoPE, pre-sublayer RMSNorm, SwiGLU, and tied input-output weights
- Trained on the TinyStories corpus in Spanish translation (approximately 10.1 million tokens)
- Includes two versions: a base model for text autocomplete and a chat version for conversation
What you can do
- Study the inner workings of LLMs in the project's GitHub source code
- Run a local chat session with the model to generate short stories
- Integrate the model into custom Python scripts using the PyTorch library and the
ceropackage - Test text generation and evaluate perplexity metrics
Example
import json
from huggingface_hub import snapshot_download
from safetensors.torch import load_model
from cero.chat import respuesta, u
from cero.config import ConfigModelo
from cero.modelo import GPT
from cero.tokenizador import TokenizadorBPE
carpeta = snapshot_download("Jhonic/cero-micro-es") + "/chat"
config = json.load(open(f"{carpeta}/config.json", encoding="utf-8"))
modelo = GPT(ConfigModelo.desde_dict(config["config_modelo"]))
load_model(modelo, f"{carpeta}/model.safetensors")
modelo.eval()
tok = TokenizadorBPE.cargar(f"{carpeta}/tokenizador.json")
print(respuesta(modelo, tok, [u("Cuéntame un cuento sobre un perro.")], temperatura=0))Read more
DetailsArchitecture: 6 layers, 4 attention heads, hidden dimension 256, 256-token context window
Tokenizer: Byte-level BPE with a 4,096-token vocabulary
Limitations: restricted to the narrow domain of children's stories, cannot perform real math calculations, and does not replace production assistants










Comments