Text Generation
Transformers
Safetensors
PyTorch
English
llama
causal-lm
from-scratch
pretraining
gqa
swiglu
rope
rmsnorm
text-generation-inference
Instructions to use bgraudt/mythos with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bgraudt/mythos with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="bgraudt/mythos")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("bgraudt/mythos") model = AutoModelForCausalLM.from_pretrained("bgraudt/mythos") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use bgraudt/mythos with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bgraudt/mythos" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bgraudt/mythos", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/bgraudt/mythos
- SGLang
How to use bgraudt/mythos with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "bgraudt/mythos" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bgraudt/mythos", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "bgraudt/mythos" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bgraudt/mythos", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use bgraudt/mythos with Docker Model Runner:
docker model run hf.co/bgraudt/mythos
File size: 4,808 Bytes
ea1cd4b 9368ba4 db824da ea1cd4b db824da 9368ba4 ea1cd4b 9368ba4 db824da dead189 db824da 9368ba4 db824da dead189 db824da 9368ba4 db824da 9368ba4 db824da ea1cd4b dead189 9368ba4 db824da 9368ba4 db824da 9368ba4 ea1cd4b db824da 9368ba4 db824da 9368ba4 ea1cd4b db824da dead189 9368ba4 db824da 9368ba4 db824da 9368ba4 dead189 db824da 9368ba4 db824da 9368ba4 ea1cd4b 9368ba4 db824da 9368ba4 db824da 9368ba4 ea1cd4b 9368ba4 ea1cd4b 9368ba4 ea1cd4b 9368ba4 ea1cd4b db824da ea1cd4b dead189 9368ba4 ea1cd4b db824da 9368ba4 dead189 db824da 9368ba4 dead189 db824da 9368ba4 dead189 9368ba4 ea1cd4b db824da ea1cd4b db824da 9368ba4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | ---
language:
- en
license: mit
library_name: transformers
pipeline_tag: text-generation
tags:
- pytorch
- causal-lm
- llama
- from-scratch
- pretraining
- gqa
- swiglu
- rope
- rmsnorm
model-index:
- name: Mythos-194M
results: []
widget:
- text: "The history of artificial intelligence begins with"
example_title: "History"
- text: "A transformer is a neural network that"
example_title: "Architecture"
inference:
parameters:
temperature: 0.8
top_p: 0.9
max_new_tokens: 128
---
<div align="center">
# Mythos-194M
**A decoder-only language model built from scratch — LLaMA-compatible weights.**
[](https://github.com/borisgraudt/mythos)
[](https://github.com/borisgraudt/mythos/blob/main/LICENSE)
[](https://pytorch.org)
[](https://github.com/huggingface/transformers)
</div>
---
> **Production release.** Full pre-training run.
## Model Summary
Mythos is a LLaMA-style autoregressive transformer implemented **from first principles**
in pure PyTorch — no `transformers` inheritance, no `nn.TransformerBlock`, no shortcuts.
Every component (attention, rotary embeddings, SwiGLU, RMSNorm, the training loop, the
BPE tokenizer, the data pipeline, the KV-cache inference engine) is hand-written in the
reference repository.
This release packages the weights in the **`LlamaForCausalLM`** format so that the model
is natively usable via the standard `transformers`, `vLLM`, `TGI`, and `llama.cpp`
toolchains — no custom code or `trust_remote_code` required.
| | |
|---|---|
| **Developed by** | Boris Graudt |
| **Model type** | Decoder-only causal transformer |
| **Language** | English |
| **License** | MIT |
| **Compatible with** | 🤗 `transformers`, vLLM, TGI, llama.cpp, Ollama |
| **Reference implementation** | [github.com/borisgraudt/mythos](https://github.com/borisgraudt/mythos) |
## Architecture
| Component | Choice | Value |
|---|---|---:|
| Parameters | — | **194 M** |
| Hidden layers | Pre-norm decoder blocks | 24 |
| Hidden size | `d_model` | 768 |
| Intermediate size | SwiGLU hidden | 2048 |
| Attention heads | Multi-head | 12 |
| Key / value heads | **Grouped-Query Attention** | 4 |
| Head dim | `d_model / n_heads` | 64 |
| Positional encoding | **Rotary (RoPE)** | θ = 10,000 |
| Normalization | **RMSNorm** (pre-norm) | ε = 1e-05 |
| Activation | **SwiGLU** | — |
| Tied embeddings | Embedding ↔ LM head | ✅ |
| Vocabulary | ByteLevel BPE | 31,021 |
| Context length | Max sequence | 2,048 |
## Quickstart
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "bgraudt/mythos"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype="auto", device_map="auto")
inputs = tokenizer("The history of artificial intelligence begins with", return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=128, temperature=0.8, top_p=0.9, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
### Serving with vLLM
```bash
pip install vllm
python -m vllm.entrypoints.openai.api_server --model bgraudt/mythos
```
### Serving with llama.cpp
```bash
# Convert to GGUF (one-time)
python llama.cpp/convert_hf_to_gguf.py mythos
./llama-cli -m ggml-model-f16.gguf -p "Hello"
```
## Training
### Data
- **Corpus:** mixed web + code (details in the GitHub repo)
- **Tokenizer:** ByteLevel BPE trained from scratch, vocab size **31,021**
- **Training context:** 512 tokens
### Hyperparameters
| | |
|---|---:|
| Steps | 16,000 |
| Optimizer | AdamW (β₁=0.9, β₂=0.95, wd=0.1) |
| LR schedule | Cosine decay, 2 000-step warmup |
| Peak learning rate | 3 × 10⁻⁴ |
| Precision | bfloat16 mixed |
| Hardware | A100 40 GB |
## Limitations and Intended Use
- **Base model only** — no instruction tuning, no RLHF, no safety alignment.
- English-only; non-English performance is poor.
- May reproduce biases and factual errors from the training distribution.
- Not suitable for medical, legal, financial, or other high-stakes applications.
## Citation
```bibtex
@software{graudt2026mythos,
author = {Graudt, Boris},
title = {Mythos: A Decoder-Only Language Model Built From Scratch},
year = {2026},
url = {https://github.com/borisgraudt/mythos},
license = {MIT}
}
```
## Acknowledgements
Architecture inspired by **LLaMA** (Touvron et al., 2023) and **Mistral 7B**
(Jiang et al., 2023). Data pipeline follows the **FineWeb** methodology
(Penedo et al., 2024).
|