Large Language Model for Natural Language Processing

Level: Undergraduate  ·  Duration: 13 weeks, one weekly session  ·  Approach: code-first, project-based

Lecturer: Dr. Alexander (Sasha) Apartsin  ·  Course text: llmbook.icsgen-ai.org (open access) · ebook at Amazon

Course Content
This course focuses on the implementation and application of Large Language Models (LLMs) for solving a wide range of natural language processing tasks. It covers the inner workings of LLMs and the creation of transformer-based foundation models through pretraining on large-scale datasets. Students will learn techniques for parameter-efficient fine-tuning (PEFT) to adapt these models to custom tasks using smaller, task-specific datasets. The course also explores techniques of LLM-based information retrieval, such as Retrieval-Augmented Generation (RAG), as well as models and tools for constructing agentic AI systems. Adopting a code-first approach, the course demonstrates key concepts and applications through practical coding examples using modern libraries and tools. These include the OpenAI API, LangChain, HuggingFace libraries, the DeepEval framework, and multi-agent development libraries such as LangGraph and CrewAI.

Background

Modern Natural Language Processing (NLP) is a field within artificial intelligence that focuses on enabling machines to understand, process, and generate human language in both written and spoken forms. It covers a broad range of tasks, including text classification, text summarization, text translation, question answering, and dialogue systems. With the rise of multimodal AI, which integrates language with other data types such as images, audio, and video, language has become a crucial component in tasks like text-to-image generation and image captioning.

Prerequisites

While all necessary background material, including machine and deep learning fundamentals and the PyTorch library, will be introduced during the course, students are expected to have a solid understanding of foundational machine learning concepts and proficiency in Python. Prior experience with deep learning is recommended and will be beneficial.

Expected Outcomes

Graduates of the course will acquire a broad and in-depth understanding of techniques for constructing, training, and applying large language models. Specifically, students will be able to:

Course Format

The course combines lectures with student presentations. Ten sessions are lectures on the week's theme, introducing concepts and applications through practical, code-first examples using modern libraries and tools. The remaining three sessions (Weeks 5, 9, and 13) are dedicated to student presentations of the course project: proposal, interim report, and finals. In all three, teams present and receive in-class feedback from the lecturer and peers.

Course Project

During the course, students will propose, implement, and present an innovative project that builds on the concepts covered in class. The project will focus on a task of the student's choice, involving the generation of synthetic training data and the comparison of multiple LLMs, including both off-the-shelf and fine-tuned models. Each project team will give three in-class presentations: a project proposal, an interim progress report, and a final presentation. By the end of the course, teams will submit a GitHub repository containing all project materials, including presentation slides, source code, datasets, and a detailed README file. For inspiration, a sample of past student projects supervised by the instructor is available at apartsin.com/teaching/student-projects.

Weekly Schedule

Below is an approximate weekly schedule outlining the subjects that will be covered. The actual order or content may vary depending on the class background and recent advancements in the field. Chapter numbers refer to the course text [1]; each entry links to the corresponding chapter. Presentation weeks are highlighted.

WeekTheme and readings
1 Course Introduction
Course and project requirements; project examples; basic AI concepts refresher.
2 Natural Language Processing
Typical NLP tasks; cyber, healthcare, and software engineering use cases; tokenization, term and topic vectors, topic modelling; word embeddings.
3 Introduction to Foundation LLMs
LLM libraries and APIs; text representation and generation; text decoding, prompt engineering, and model fine-tuning.
4 Synthetic Data Generation for Model Training and Evaluation
Frameworks for synthetic data generation: DataDreamer, Curator; attributed and bootstrapped data generation; weak supervision; data anonymization; model evaluation, text generation metrics, and LLM judges.
5 Student Presentations I: Project Proposal
Each team presents its project proposal and receives in-class feedback from the lecturer and peers.
6 Building and Training Transformer-Based Models
Attention, cross-attention, multi-headed attention; transformer blocks, encoder-decoder transformers; transformer pretraining; sentence embedding; instruction following; fine-tuning for human preferences; Seq2Seq models; mixture of experts; Music Transformer; explaining transformers.
7 LLM Fine-Tuning and Transfer Learning
PEFT: adapters, quantization, QLoRA; soft prompts and p-tuning; representation fine-tuning: denoising autoencoder, SimCSE; sequence and token classification fine-tuning: NER, SetFit; long texts and Longformer; model distillation and merging.
8 LLMs for Information Retrieval and Extraction
Vector stores: FAISS, product quantization, chunking; RAG: DPR, chunking, HyPE, HyDE, MMR, RAG evaluation; topic modelling and recommendation systems; knowledge graphs: information extraction and KG-assisted generation.
9 Student Presentations II: Interim Report
Each team presents its interim progress and receives in-class feedback from the lecturer and peers.
10 Agentic AI and LLM-Based Multi-Agent Systems
Tools: function calls, MCP, Toolformer; memory: MemGPT and conversational buffers; agent flows and planning: ReAct, Reflection, Agentic RAG, BabyAGI; multi-agent systems: AutoGen, CrewAI.
11 Visual Language Models
Vision Transformer; multimodal models: CLIP, BLIP-2; document models: LayoutLM; Segment Anything.
12 Advanced Topics
LLM safety: jailbreaking and watermarking; LLMs for tabular data: Text2SQL; LLMs for software engineering: requirements engineering, QA, design.
13 Student Presentations III: Project Finals
Conference-style final talks with in-class feedback. Project repositories (slides, source code, datasets, and README) are submitted at the end of the course.

Grading

DeliveryGrade
In-class project proposal presentationNo grade, for feedback and approval only
In-class project interim presentation20%
In-class final project presentation40%
Final project submission (GitHub repository)40%

AI Tools Policy

The use of AI tools for generating project code and presentation slides is highly encouraged, provided that two essential requirements are met: the project must demonstrate novelty by addressing a new and valuable task, and the team must maintain full ownership and responsibility for all submitted code and presentation materials.


References

[1] A. Apartsin and Y. Aperstein, Building Language AI: From Tokens to Agents, 16th ed., 2026. Open access online at https://llmbook.icsgen-ai.org; also available as an ebook at Amazon: https://www.amazon.com/dp/B0H1MQH23D.

Supplementary books

[2] J. Alammar and M. Grootendorst, Hands-On Large Language Models, 2024.

[3] S. Raschka, Build a Large Language Model (From Scratch), 2024.

[4] L. Tunstall, L. von Werra, and T. Wolf, Natural Language Processing with Transformers, 2022.

[5] M. Lanham, AI Agents in Action, 2025.

[6] U. Kamath, K. Keenan, G. Somers, and S. Sorenson, Large Language Models: A Deep Dive — Bridging Theory and Practice, 2024.