explaingit

lordog/dive-into-llms

Analysis updated 2026-06-20

35,948Jupyter NotebookAudience · researcherComplexity · 4/5Setup · hard

TLDR

A hands-on Jupyter Notebook tutorial series that teaches how large language models work in practice, covering fine-tuning, prompt engineering, safety alignment, and multimodal AI through runnable code you can step through yourself.

Mindmap

mindmap
  root((dive-into-llms))
    What it does
      LLM tutorials
      Hands-on notebooks
      Runnable code
    Topics
      Fine-tuning models
      Prompt engineering
      Safety alignment
      Multimodal AI
    Tech Stack
      Python
      Jupyter Notebooks
    Audience
      CS students
      AI researchers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Fine-tune a pre-trained language model on a custom dataset and evaluate its performance on a specific task

USE CASE 2

Learn to write effective prompts using chain-of-thought reasoning to improve a model's step-by-step problem solving

USE CASE 3

Study LLM safety techniques like RLHF to understand how models are trained to follow instructions and avoid harmful outputs

USE CASE 4

Experiment with watermarking or steganography in AI-generated text to understand how hidden signals are embedded

What is it built with?

PythonJupyter Notebook

How does it compare?

lordog/dive-into-llmsanthropics/prompt-eng-interactive-tutorialmicrosoft/data-science-for-beginners
Stars35,94835,37635,267
LanguageJupyter NotebookJupyter NotebookJupyter Notebook
Setup difficultyhardmoderateeasy
Complexity4/52/51/5
Audienceresearcherdeveloperdata

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires Python, deep learning libraries, and GPU access for most chapters.

In plain English

dive-into-llms is a hands-on programming tutorial series for learning how large language models (LLMs) work in practice. Large language models are the AI systems behind tools like ChatGPT, they are trained on vast amounts of text and can generate, understand, and reason about language. The project bridges the gap between abstract theory and real implementation, targeting students and researchers who want to move from reading about AI to actually building with it. The tutorials are organized as Jupyter Notebooks, interactive documents that mix explanatory text with runnable code, which you can step through cell by cell. Each chapter covers a distinct topic: fine-tuning a pre-trained model on a specific task, writing effective prompts and using chain-of-thought reasoning, editing what a model "knows", teaching a model to do mathematical reasoning, embedding invisible watermarks into generated text, understanding jailbreak attacks that trick models into ignoring safety guidelines, multimodal models that handle both text and images, GUI agents that control software interfaces on your behalf, safety alignment using reinforcement learning from human feedback (RLHF), and steganography (hiding secret messages inside generated text). The project originated from university courses at Shanghai Jiao Tong University and is free and non-commercial. A companion curriculum co-developed with Huawei's Ascend platform covers the full LLM development pipeline in greater depth. A computer science student, AI researcher, or developer wanting practical experience working with language models would use this repository. The tech stack is Python running in Jupyter Notebooks, using standard deep learning libraries typical of the field.

Copy-paste prompts

Prompt 1
Using the dive-into-llms fine-tuning notebook, show me how to load a pre-trained model, prepare a small custom dataset, and run a basic fine-tuning loop in Python
Prompt 2
Walk me through the chain-of-thought prompting chapter, give me 3 example prompts that improve a model's math reasoning step by step
Prompt 3
Based on the dive-into-llms RLHF chapter, explain in plain English how reinforcement learning from human feedback trains a model to be more helpful and less harmful
Prompt 4
Show me how the watermarking chapter embeds invisible tokens into generated text and then detects them, give me the Python code for both embedding and detection

Frequently asked questions

What is dive-into-llms?

A hands-on Jupyter Notebook tutorial series that teaches how large language models work in practice, covering fine-tuning, prompt engineering, safety alignment, and multimodal AI through runnable code you can step through yourself.

What language is dive-into-llms written in?

Mainly Jupyter Notebook. The stack also includes Python, Jupyter Notebook.

How hard is dive-into-llms to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is dive-into-llms for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub lordog on gitmyhub

Verify against the repo before relying on details.