shika-10m: An ultra-lightweight character-level Llama-based language model
2 min readupdated
shika-10m by deerfieldgreen is an experimental 9.5M-parameter language model trained from scratch as part of the MiniLLM Lab project. Instead of standard subwords, it operates at the individual character level (character-level tokenization — each text character is treated as a separate token) and continues English text, generating coherent words and short sentences. Built on the standard Llama architecture, the model runs via transformers without any custom code. It is well-suited for researchers, students, and developers interested in exploring LLM mechanics and running quick tests on modest hardware or a CPU.
Key features
- Llama architecture: 6 layers, hidden size of 384, GQA (Grouped-Query Attention with 6 query heads and 2 key-value heads), SwiGLU, RMSNorm, and RoPE positional encoding.
- Character-level vocabulary: Includes 158 unique characters without beginning-of-sequence (BOS) or end-of-sequence (EOS) special tokens.
- Diverse training corpus: Trained on 102 MB of English texts, incorporating Tiny Shakespeare, WikiText-2, TinyStories, Simple English Wikipedia, Python code, and documentation.
- Trained on a laptop: The entire training run took 10,000 steps on an Apple M3 Pro chip (MPS).
What you can do
- Use it as a clear educational reference for examining the
LlamaForCausalLMarchitecture and character-level generation. - Run fast local experiments with sampling parameters (temperature,
top_k) without a dedicated graphics card or heavy memory requirements. - Use it as a compact base for further fine-tuning on specific short-string generation tasks.
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("deerfieldgreen/shika-10m")
model = AutoModelForCausalLM.from_pretrained("deerfieldgreen/shika-10m")
inputs = tok("Once upon a time", return_tensors="pt")
out = model.generate(**inputs, max_new_tokens=200, do_sample=True, temperature=0.8, top_k=50)
print(tok.decode(out[0]))Read more
DetailsValidation metrics: loss of 0.901 nats/char, perplexity of 2.46.
Context window limit: the combined length of the prompt and response must not exceed 256 characters.
Training: 10,000 steps (about 82 million characters, ~1 epoch), AdamW optimizer.
Limitations: due to its small size, the model loses coherence over full paragraphs and has not undergone instruction or safety tuning.










Comments