Practical Tutorials for the Machine Learning for Natural Language Processing 1 Lecture at the University of Zurich for the Fall Semester 2026.
Note: The materials in this repository are being updated for the Fall Semester 2026 progressively, week by week. Until a tutorial or exercise has been updated, the version you see is the one from 2025. Materials from previous years are kept in their respective folders for reference.
In this repository, you will find the notebooks for the tutorials and exercises for the course. The tutorials are designed to help you understand and put into practice the theoretical concepts discussed in the lecture. Tutorials are designed to be interactive, and you are encouraged to experiment with the code and try different variations to understand the concepts better.
-
exercises: Contains the given code samples for completing the exercises.
-
tutorials_notebooks_in_class_2026: Contains the given code samples presented within the tutorials. Notebooks from previous years are available in the 2025, 2024 and 2023 folders.
-
lectures_supplementary_code_samples: Contains the code samples presented or given within the lecture.
-
tutorials_supplementary_code_samples: Contains supplementary code samples provided as part of the tutorials.
- Week 02: Tutorial logistics and FAQ — W02_Tutorial_Logistics_and_FAQ_2026.pdf; Machine Learning basics with
sklearn(feature representation, data leakage, pipelines) — W02_Intro_to_sklearn.ipynb - Week 03: Introduction to
sklearnPipelines — W03_tutorial_pipeline.ipynb - Week 04: Neural networks with
skorchand model interpretability with SHAP — W04_tutorial_skorch.ipynb, W04_tutorial_shap.ipynb - Week 05: A quick introduction to PyTorch — W05_intro_to_PyTorch.ipynb
- Week 06: Word similarity and analogy with pretrained word vectors — W06_similarity_analogy.ipynb
- Week 07: LSTM computation graph exercise — W07_lstm_computation_graph_exercise_2025.pdf
- Week 08: Introduction to HuggingFace
transformersanddatasets— W08_intro_to_hugging_face_transformers_datasets.ipynb - Week 09: Introduction to GLiNER and NuExtract — W09_introduction_to_gliner_nuextract.ipynb
- Week 10: Introduction to prompt engineering — W10_introduction_to_prompt_engineering_2025.pdf
- Week 11: picoGPT: next-token prediction and loss computation step by step — W11_picoGPT.ipynb
- Week 13: Vector search with Qdrant — W13_Qdrant_demo.ipynb
- Week 14: Exam preparation — W14 ML4NLP1-2025 - Exam Prep.pdf
Files with 2025 in their name are still the versions from last year and will be replaced with the 2026 versions as the semester progresses.
From linear to deep learning models for text classification. In this exercise, you will implement a simple linear model for text classification using the sklearn library. You will then extend the model to a deep learning model using the skorch library.
See the exercise sheet for more details: Exercise 01
Building word embeddings with PyTorch. In this exercise, you will implement a Continuous Bag of Words Model using the torch library. See the exercise sheet for more details: Exercise 02
Also known as Exercise AB. Handled through Simon Clematide. Please see OLAT Course for details.
Named Entity Recognition using Transformer Encoders. In this exercise, you will fine-tune a BERT model using the HuggingFace library. Additionally, you will experiment with GliNER to perform anonymization of texts. See the exercise sheet for more details: Exercise 04
LLM Prompting, Prompt Engineering and small LLM fine-tuning using Unsloth AI. See the exercise sheet for more details: Exercise 05
Topic Modeling using LDA and CTM. See the exercise sheet for more details: Exercise 06