teaching_llm_applications

Week 12 — Applications and Final Project

Lecture Overview

In this final week we survey the state of the art in LLM applications across several important domains — healthcare, science, education, and software engineering — and set expectations for the final project. Students present their preliminary project demos.


1. LLMs in Healthcare

Healthcare is one of the most high-stakes and consequential application domains.

1.1 Clinical NLP Tasks

Task Example models / approaches
Clinical note summarisation BART, FLAN-T5, GPT-4 with RAG
ICD coding Fine-tuned BERT variants
De-identification NER models + LLM post-processing
Radiology report generation Multimodal LLMs (CheXagent, GPT-4V)
Drug-drug interaction Fine-tuned biomedical LLMs
Patient-facing chatbots RAG over clinical guidelines

1.2 Challenges

1.3 Notable Models

1.4 Patient and Public Involvement (PPIE)

Deploying healthcare AI without involving patients is unethical and often counterproductive. PPIE ensures:


2. LLMs for Science

2.1 Literature Review and Synthesis

RAG-based systems over corpora of scientific papers:

2.2 Mathematical Reasoning

2.3 Code for Science

2.4 Hypothesis Generation

Systems like BACON and BioDiscoveryAgent use LLMs to:


3. LLMs for Education

Risks


4. LLMs for Software Engineering

SWE-bench shows current models can resolve ~12–50% of real GitHub issues autonomously (depending on model and scaffolding).


5. Multimodal LLMs

Modern frontier models process multiple modalities:

Modality Example tasks
Text + Image VQA, document parsing, chart understanding
Text + Audio Transcription, speech-to-text, voice assistants
Text + Video Video summarisation, action recognition
Text + Code Code execution, data analysis

Models: GPT-4o, Claude 3.5, Gemini 1.5, LLaVA (open source).


6. Building Production LLM Applications

6.1 Architecture

User → Frontend (Streamlit / React)
           │
           ▼
       Orchestration layer (LangChain / custom)
           │
    ┌──────┴──────┐
    │             │
  LLM API     Vector Store
  (OpenAI /   (FAISS / Chroma)
   Anthropic /
   local)
           │
           ▼
       Output + Logging

6.2 Key Engineering Decisions

6.3 Local vs API Models

Factor Local (Ollama, llama.cpp) API (OpenAI, Anthropic)
Privacy High Lower
Cost Hardware upfront Per token
Capability Smaller models Frontier models
Latency Variable Consistent
Setup Complex Simple

7. Final Project Guidelines

7.1 Scope

Build a working LLM-powered application. It should:

7.2 Deliverables

Item Details
Code Clean, documented Python; hosted on GitHub
Report 8–10 pages: problem, approach, evaluation, limitations
Demo 10-minute live demonstration
Poster A3 poster for the showcase session

7.3 Project Ideas

7.4 Assessment Rubric

Criterion Weight Description
Technical depth 30% Quality of LLM integration, prompt design, architecture
Evaluation 25% Rigorous, appropriate metrics; honest analysis of failure modes
Novelty 15% Original idea or non-trivial combination of techniques
Code quality 15% Readable, documented, reproducible
Presentation 15% Clear demo; well-written report

8. Practical This Week

See practicals/week12_practical.py:


9. Course Summary

Over 12 weeks we have covered:

  1. History and intuition of LLMs
  2. Tokenisation (BPE, WordPiece, SentencePiece)
  3. Embeddings, similarity, positional encodings
  4. Attention mechanism (Q/K/V, multi-head, causal)
  5. Transformer architecture (encoder-only, decoder-only, encoder-decoder)
  6. Pre-training and scaling laws (Chinchilla, emergent abilities)
  7. Fine-tuning and RLHF (SFT, LoRA, QLoRA, DPO)
  8. Prompting and context engineering (CoT, few-shot, self-consistency)
  9. Retrieval-Augmented Generation (chunking, vector stores, evaluation)
  10. Agents and tool use (ReAct, function calling, multi-agent)
  11. Evaluation, safety, and ethics (benchmarks, hallucination, bias)
  12. Applications and project (healthcare, science, production systems)

10. Further Reading


Discussion Questions

  1. You are building an LLM application for clinical triage in an NHS hospital. List five ethical and practical requirements it must satisfy before deployment.
  2. Compare local model deployment (e.g. Ollama + LLaMA-3) with API-based deployment (e.g. GPT-4o) for a healthcare application. What are the key trade-offs?
  3. Reflect on the course: which technique do you think will have the most impact in your own research domain, and why?