Machine Learning & Deep Learning
Key points
- ML pipeline: collect, preprocess, engineer features, select model, train, validate, deploy, monitor — governance needed at every stage
- Supervised learning: labelled data, classification (categories) and regression (numbers); most common in commercial AI
- Unsupervised learning: finds hidden patterns without labels; clustering, dimensionality reduction, anomaly detection
- Reinforcement learning: learns through rewards/penalties; powers game AI, robotics, and RLHF for LLM alignment
- Key architectures: CNNs (images/spatial), RNNs/LSTMs (sequences), Transformers (parallel attention, powers all modern LLMs)
- Transfer learning reuses pre-trained models but inherits biases; documentation must track full model lineage
- Evaluation requires both accuracy metrics (precision, recall, F1, AUC-ROC) AND fairness metrics (demographic parity, equalized odds, calibration)
- Overfitting: model memorises training data, fails on new data; mitigate with regularisation, cross-validation, dropout
Machine Learning & Deep Learning
A solid understanding of ML and DL architectures is essential for AI governance professionals. You do not need to build models, but you must understand how they work well enough to ask the right governance questions about data quality, model selection, evaluation, and risk.
Machine Learning Fundamentals
The ML Pipeline
Every ML system follows a lifecycle that governance must address at each stage.
Data Collection: Gathering relevant data from internal databases, public datasets, third-party providers, web scraping, sensors, or user interactions. Governance concern: lawful rights to collect and use the data, representation and completeness, consent where required.
Data Preprocessing: Cleaning and preparing data by handling missing values, removing duplicates, normalising formats, and encoding categorical variables. Governance concern: decisions made during preprocessing can introduce or remove bias. Dropping records with missing data may disproportionately exclude certain populations.
Feature Engineering: Selecting, transforming, or creating the variables (features) the model will use as inputs. Governance concern: proxy variables can embed discrimination. A feature like postcode may serve as a proxy for race or socioeconomic status.
Model Selection: Choosing the algorithm or architecture best suited to the task, data, and constraints. Governance concern: more complex models may be more accurate but less interpretable. Regulated domains may require inherently explainable models.
Training: The model learns patterns from the training data by adjusting internal parameters to minimise a loss function (a measure of prediction error). Governance concern: the model learns whatever patterns exist in the data, including biased patterns. Training choices (learning rate, epochs, regularisation) affect what the model learns.
Validation: Testing the trained model on held-out data it has not seen during training to estimate real-world performance. Governance concern: validation must test not only overall accuracy but also performance across subgroups to detect bias. A model that is 95% accurate overall may be 70% accurate for a minority group.
Deployment: Putting the model into production where it processes real data and makes or informs real decisions. Governance concern: the transition from controlled testing to real-world use introduces new risks including data drift, unexpected inputs, and scale effects.
Monitoring: Continuously tracking the model's performance, fairness, and reliability in production. Governance concern: models degrade over time as the world changes. Without monitoring, a system that was fair at deployment can become discriminatory.
Supervised Learning
Supervised learning uses labelled training data where each example has a known correct answer (the "label" or "target"). The model learns to map inputs to outputs and can then predict labels for new, unseen data.
Classification predicts categorical outcomes (spam or not spam, approved or denied, malignant or benign). Common algorithms include logistic regression (interpretable, good baseline), decision trees (visual and intuitive, mimics human decision-making), random forests (ensemble of many decision trees, reduces overfitting), support vector machines (effective for high-dimensional data), and gradient boosting (XGBoost, LightGBM — high performance, widely used in competitions and industry).
Regression predicts numerical outcomes (house price, credit score, insurance premium). Common algorithms include linear regression (interpretable, coefficients show feature importance), polynomial regression (captures non-linear relationships), and ensemble methods (random forests and gradient boosting applied to regression).
Unsupervised Learning
Unsupervised learning finds patterns in data without labels. The model discovers hidden structure on its own.
Clustering groups similar data points together. K-means partitions data into k groups by minimising distance to cluster centres. Hierarchical clustering builds nested groups. DBSCAN finds clusters of varying shape and identifies outliers. Governance concern: clustering can be used for customer segmentation, which may inadvertently create discriminatory groupings.
Dimensionality Reduction reduces the number of features while preserving important information. PCA (Principal Component Analysis) finds the directions of maximum variance. t-SNE and UMAP create low-dimensional visualisations. Governance concern: reducing dimensions can obscure the role of individual features, making it harder to explain decisions.
Anomaly Detection identifies data points that differ significantly from the majority. Applications include fraud detection, cybersecurity, and manufacturing quality control.
Reinforcement Learning
Reinforcement learning trains agents to make sequences of decisions by rewarding desirable behaviour and penalising undesirable behaviour. The agent interacts with an environment, takes actions, receives feedback (rewards), and learns a policy (strategy) that maximises cumulative reward. Applications include game playing (AlphaGo, Atari games), robotics control, resource allocation, recommendation systems, and AI alignment (RLHF — Reinforcement Learning from Human Feedback, used to train LLMs to be helpful and safe). Governance concern: reward design is critical. A poorly designed reward function leads to reward hacking, where the system finds unintended ways to maximise the reward that do not align with the intended goal.
Deep Learning Architecture
Neural Network Basics
Neural networks consist of layers of interconnected nodes (neurons). Each connection has a weight (a learnable parameter). Data flows through the network: the input layer receives the data, hidden layers transform it through weighted sums and activation functions (ReLU, Sigmoid, Tanh), and the output layer produces the prediction. The network learns by backpropagation: comparing its prediction to the correct answer, calculating the error, and adjusting weights to reduce the error. Deep learning simply means neural networks with many hidden layers, which enables learning increasingly abstract features.
Convolutional Neural Networks (CNNs)
CNNs are specialised for grid-like data, particularly images. They use convolutional filters (small sliding windows) that detect spatial patterns like edges, textures, and shapes. Pooling layers reduce dimensionality while retaining important features. Applications include image classification, object detection, medical imaging (X-rays, pathology), facial recognition, and autonomous vehicle perception. Governance concerns: bias in image recognition (systems performing worse on darker skin tones), surveillance applications, and interpretability challenges.
Recurrent Neural Networks (RNNs) and LSTMs
RNNs process sequential data by maintaining a hidden state that carries information from previous time steps. LSTMs (Long Short-Term Memory) and GRUs (Gated Recurrent Units) are variants that better handle long-range dependencies. Applications include speech recognition, time series forecasting, natural language processing (largely superseded by Transformers for text), and medical event prediction. Governance concerns: data privacy in sequential health or financial data, output unpredictability for long sequences.
Transformer Architecture
Transformers have largely replaced RNNs for language tasks and are the foundation of modern LLMs. The key innovation is the attention mechanism, which allows the model to weigh the relevance of every part of the input when generating each part of the output, and to process all positions in parallel rather than sequentially. This enables training on massive datasets and scaling to billions of parameters. Transformers power GPT, Claude, BERT, Gemini, Llama, and virtually all modern LLMs.
Transfer Learning and Foundation Models
Transfer Learning
Transfer learning reuses a model trained on one task as the starting point for a different but related task. Instead of training from scratch, you take a pre-trained model (which has already learned general features from a large dataset) and fine-tune it on your specific, often smaller, dataset. Benefits include reduced training data requirements, faster development, and access to capabilities that would require enormous resources to train from scratch.
Governance implications are significant. Models inherit biases from their source training data and pre-training process. The pre-trained model may have been trained on data you cannot inspect. Fine-tuning on a small, unrepresentative dataset can introduce new biases. Documentation must track the full lineage: what was the base model, what data was it trained on, how was it fine-tuned, and what testing was performed at each stage.
Foundation Models
Foundation models are large-scale models trained on broad data that can be adapted to many downstream tasks. GPT-4, Claude, Gemini, and Llama are foundation models. They represent a shift from training task-specific models to adapting general-purpose models. Governance challenges include limited transparency into training data and processes, difficulty in predicting behaviour across diverse applications, concentration of power in a small number of organisations that can afford to train these models, and rapid capability improvement that outpaces governance frameworks.
Model Evaluation Metrics
Classification Metrics
Accuracy: The percentage of correct predictions overall. Can be misleading when classes are imbalanced (a model that always predicts "not fraud" achieves 99.9% accuracy in a dataset where only 0.1% of transactions are fraudulent).
Precision: Of all positive predictions, what percentage were actually correct? High precision means few false positives. Important when the cost of a false positive is high (e.g., wrongly flagging a legitimate transaction as fraud).
Recall (Sensitivity): Of all actual positives, what percentage were correctly identified? High recall means few false negatives. Important when the cost of missing a positive is high (e.g., failing to detect cancer).
F1 Score: The harmonic mean of precision and recall, balancing both. Useful when you need a single metric that accounts for both false positives and false negatives.
Confusion Matrix: A table showing true positives, true negatives, false positives, and false negatives. Provides the most complete picture of classification performance.
AUC-ROC: Area Under the Receiver Operating Characteristic Curve. Measures the model's ability to distinguish between classes across all possible thresholds. A value of 1.0 is perfect; 0.5 is random.
Fairness Metrics (Governance Critical)
Fairness metrics must be evaluated alongside accuracy metrics. A model cannot be considered acceptable based on accuracy alone. Key fairness metrics include demographic parity (equal positive prediction rates across groups), equalized odds (equal true positive and false positive rates across groups), calibration (predictions match reality within each group), and individual fairness (similar individuals receive similar predictions). These metrics often conflict with each other and with overall accuracy, requiring deliberate trade-off decisions.
Overfitting and Generalisation
The Overfitting Problem
Overfitting occurs when a model memorises the training data rather than learning generalisable patterns. An overfit model performs excellently on training data but poorly on new, unseen data. Signs include a large gap between training and validation performance and high complexity relative to the amount of training data.
Mitigation Techniques
Techniques to combat overfitting include regularisation (penalising model complexity), cross-validation (testing on multiple data splits), early stopping (stopping training before the model memorises noise), dropout (randomly disabling neurons during training to prevent co-dependency), and data augmentation (creating additional training examples through transformations). Governance implication: an overfit model may appear to perform well during testing but fail in production, potentially making unfair or inaccurate decisions on populations not well represented in the training data.