
See what you will build in this course: your own System 1 decision model, trained by you and shared on the Hugging Face Hub.
You start with Hugging Face Transformers pipelines, then see how transformers work in PyTorch, from tokens to the output. You learn BERT encoders like ModernBERT and how a decision model decides and stays calibrated. Then you fine-tune Laya on custom banking data, build your own mini Laya from scratch, train with the Hugging Face Trainer, use LoRA and QLoRA with PEFT, and build a mini Clef from scratch with Qwen. Finally you share your model on the Hugging Face Hub.
Meet your instructor in the next lecture. If you get stuck anywhere, post your question in the Q&A section.
This course contains the use of artificial intelligence. Learn to fine-tune transformer models in Python, step by step, until you have trained a decision model of your own. In this hands-on course you use PyTorch, Hugging Face Transformers, the Trainer, datasets, evaluate, PEFT and bitsandbytes to fine-tune BERT-style encoders and small LLMs for text classification, check how far you can trust their confidence, and train with LoRA and QLoRA.
In Jev AI and Laya Fundamentals you called a decision model through an API. It read a support ticket or a bank message and answered a typed question, with a probability for every option. This course opens that kind of model up and shows you how to build, fine-tune and calibrate one yourself, on real data, with code that runs on a free GPU in Google Colab or Kaggle.
What makes this course different
You see the machine before the code. Every idea (tokens, attention, the causal mask, logits, softmax, the next-token loss, a classification head, LoRA) is first drawn as an animated scene on the real data, then typed in a notebook line by line, with the real output read out.
Text classification with three kinds of model. On 40 support tickets you compare a ready-made sentiment model, zero-shot classification and a chat model, then you learn why an encoder like ModernBERT is the model that decides.
A transformer opened step by step in PyTorch: text becomes tokens and vectors, every token attends to every other token, the scores become weights, and you watch a real Qwen model predict the next token and compute its loss.
Confidence you can check. You read the answer from the option letters in one forward pass instead of asking for JSON, measure expected calibration error, and fix over-confidence with temperature scaling.
Fine-tuning Laya on custom data. You take ten card intents from Banking77, split train, calibration and test rows, fine-tune, and measure what fine-tuning gains and what it can cost (forgetting).
Build your own Mini Laya from scratch: a pretrained ModernBERT encoder plus a new decision head, trained with a proper scoring rule that rewards honest confidence, and compared with the published Laya on the same test sets.
The Hugging Face Trainer, one argument at a time: a classification head on a decoder model, what one trainable parameter costs in memory, learning rate, epochs and batch size, train, validation and test, overfitting and early stopping.
LoRA and QLoRA with PEFT: you train a small pair of matrices beside each layer instead of every weight, then load a 4-billion-parameter Qwen in 4-bit and fine-tune it with QLoRA, and read every result on the same test set.
Build Mini Clef from scratch: a Qwen model with LoRA adapters and a decision head that scores every option, calibrated with one temperature per question type, saved, loaded back and asked a full request. Then you share your model on the Hugging Face Hub.
What you will cover
Hugging Face Transformers: the pipeline, model cards on the Hub, sentiment analysis, emotion labels and zero-shot classification.
How a transformer works: tokenizers, embeddings, self-attention with query, key and value, softmax, the causal mask, attention heads, the MLP, logits, text generation and the cross-entropy loss.
Encoders: ModernBERT, masked language modeling, contextual embeddings, one vector for a whole text, and a new classification head.
Decision models: the System One request, decision models on Ollama, chat templates, reading answers from option letters, expected calibration error and temperature scaling.
Fine-tuning: custom datasets with load_dataset, train, calibration and test splits, forgetting, and how many examples fine-tuning needs.
Training: the Trainer and TrainingArguments, datasets and evaluate, frozen and trainable weights, memory per parameter, learning rate, overfitting and early stopping.
Parameter-efficient fine-tuning: LoraConfig, get_peft_model, rank and alpha, saving and merging adapters, 4-bit quantization with BitsAndBytesConfig, and QLoRA.
Your own models: Mini Laya and Mini Clef assembled from pretrained parts, calibrated, saved as safetensors and shared on the Hugging Face Hub.
By the end, you will be able to take a labeled set of texts, pick a pretrained transformer, fine-tune it with the Trainer or with LoRA and QLoRA, check whether its confidence can be trusted, and share the model.
A little Python is enough, and no PyTorch or Hugging Face experience is needed: every new call is taken apart the first time it appears. A free Google Colab or Kaggle GPU runs every notebook.