A collection of Natural Language Processing labs covering transformer models, text classification, and LLM fine-tuning.
NLP_Labs/
├── Lab2_Intro_to_maths_optimisation/
├── Lab3_Transformer_Introduction/
├── Lab4_Transformer_Classification/
├── Lab5_Clustering/
├── Lab6_Finetune_llama/
├── Lab7_Prompting_LangChain_Ollama/
└── README.md
Foundations of mathematical optimization for machine learning, covering gradient descent and optimization techniques used in neural network training.
Introduction to Hugging Face Transformers library through practical NLP tasks:
- Text Classification - Sentiment analysis with DistilBERT
- Named Entity Recognition - Identifying entities (persons, organizations, locations)
- Question Answering - Extractive QA with SQuAD-trained models
- Summarization - Abstractive summarization with DistilBART
- Translation - English to German with MarianMT
- Text Generation - Autoregressive generation with GPT-2
End-to-end pipeline for training transformers on emotion classification:
- Dataset loading and exploration with Hugging Face Datasets
- Tokenization with DistilBERT tokenizer
- Feature extraction using pre-trained transformer hidden states
- Training a classifier on extracted embeddings
- Fine-tuning with Hugging Face Trainer API
Text clustering and topic modeling on ArXiv NLP abstracts:
- Embeddings - SentenceTransformer (gte-small)
- Dimensionality Reduction - UMAP
- Clustering - HDBSCAN
- Topic Modeling - BERTopic with c-TF-IDF
- Representation Models - KeyBERT, MMR
- LLM Topic Labels - Groq API integration
Fine-tuning a large language model on a medical Q&A dataset:
- Loading Llama 3.2 with Hugging Face
- LoRA (Low-Rank Adaptation) configuration for efficient fine-tuning
- Training on medical dataset
- Model evaluation and inference
(Instructions pending)
Each lab folder contains:
lab.ipynb- Jupyter notebook with code and answersrequirements.txt- Python dependencies
To run a lab:
cd Lab<N>_<name>/
pip install -r requirements.txt
jupyter notebook lab.ipynb