WhoBuilt

Training an LLM from Scratch, Locally

May 4, 2026· 1 h 21 min· 58K views·Watch on YouTube

Speaker

Angelos Perivolaropoulos, research engineer and speech-to-text team lead at ElevenLabs, leads a hands-on AI Engineer workshop on training a small language model from scratch.

Set up a small local model

The workshop builds a GPT-2-style model in PyTorch without pretrained weights. Perivolaropoulos says a laptop with 16 GB of RAM can run it, while Google Colab is an option for access to a GPU. The project aims to cover most of the core work involved in building a model, leaving larger-scale optimizations aside.

Choose a tokenizer and architecture

The exercise uses character-level tokenization on Shakespeare, producing a vocabulary of about 65 characters. That small vocabulary suits the limited dataset, but character tokens are less efficient and harder to relate than common word fragments. The model uses six transformer layers, six attention heads, 384-dimensional embeddings, and a context length of 256.

Train with next-token prediction

The model learns to predict the next character by comparing its output with the sequence shifted forward by one position. Training uses AdamW, a learning-rate warm-up followed by cosine decay, and a held-out validation set to help spot overfitting. Perivolaropoulos describes a roughly 1.8-million-parameter model and says his Colab run took about 15 minutes to produce good results.

Generate text and improve the run

For generation, the workshop uses temperature and top-k sampling rather than always choosing the most likely token, which can make output less repetitive. Perivolaropoulos recommends tracking training and validation loss: rising validation loss can indicate overfitting, while a plateau may mean the model needs more data or a larger capacity. Participants can experiment with model size, context length, tokenizers, and training settings.

Extend the ideas to other modalities

In response to audience questions, Perivolaropoulos explains that reasoning is commonly taught through post-training on high-quality data, with human labeling and quality checks. He says audio models share core ideas with text models, but require audio tokenization and task-specific losses; mel spectrograms are one representation used to prepare audio. Multimodal systems can also feed encoder-produced vectors into a text transformer.

Takeaways

  • Start with a small vocabulary that matches the size and scope of your dataset.
  • Use a held-out validation set to detect when training starts to overfit.
  • Treat tokenizer choice as a trade-off between vocabulary size, data needs, and inference efficiency.
  • Track both loss curves and generated samples when judging a small model.
  • For reasoning or audio tasks, data quality and task-specific training objectives matter alongside architecture.

Mentioned in this talk

Search inside this talk

What was claimed 11

Show all 11 facts

Related talks