AIAI study materials
AIAI study resources

AIAI cheat sheet

AIAI · Keep the key ideas within reach.

Quick reference

AI Fundamentals and Terminology

  • AI is the broad field of systems performing tasks associated with human intelligence; ML is the subset that learns patterns from data rather than following hand-coded rules.

  • Supervised learning uses labeled data (input-output pairs); unsupervised learning finds structure in unlabeled data; reinforcement learning learns from reward signals via trial and error.

  • Narrow (weak) AI targets a specific task and is what exists today; general (strong) AI would match human performance across domains and is hypothetical.

  • Inference is applying a trained model to new inputs; training is the process of fitting model parameters to data.

  • Parameters are learned weights internal to a model; hyperparameters (learning rate, batch size, tree depth) are set before training and control the learning process.

  • Overfitting = low training error but high generalization error; underfitting = high error on both training and held-out data.

  • A model's prediction can be classified as true positive, true negative, false positive, or false negative relative to the ground-truth label.

  • Turing Test operationalizes intelligence as indistinguishability from a human interlocutor; it measures behavior, not internal understanding.

Quick reference

Machine Learning Concepts and Model Lifecycle

  • Standard lifecycle: problem framing → data collection → feature engineering → training → evaluation → deployment → monitoring → retraining.

  • Train/validation/test split: train fits parameters, validation tunes hyperparameters, test gives an unbiased final estimate and is used once.

  • Precision = TP/(TP+FP); Recall = TP/(TP+FN); F1 = harmonic mean of precision and recall.

  • Accuracy is misleading on imbalanced data; prefer precision, recall, F1, or AUC-ROC when class frequencies are skewed.

  • k-fold cross-validation rotates the validation fold k times and averages scores, reducing variance of the performance estimate on small datasets.

  • Regression metrics: MAE (mean absolute error), MSE/RMSE (penalizes large errors more), R² (proportion of variance explained).

  • Regularization (L1/Lasso, L2/Ridge) penalizes large weights to reduce overfitting; L1 can drive weights to zero and perform feature selection.

  • Model drift: data drift changes input distribution, concept drift changes the input-output relationship; both require monitoring and retraining triggers.

Quick reference

Data Preparation and Data Quality

  • Data quality dimensions: accuracy, completeness, consistency, timeliness, validity, and uniqueness.

  • Missing data options: deletion (listwise/pairwise), mean/median/mode imputation, model-based imputation; deletion biases results if missingness is not random.

  • One-hot encoding creates a binary column per category; label/ordinal encoding assigns integers and implies order, so use it only for ordinal variables.

  • Normalization scales features to [0,1]; standardization rescales to mean 0 and standard deviation 1; distance-based models (k-NN, SVM, k-means) require scaling.

  • Data leakage = information from the target or test set contaminating training features; it inflates validation scores and breaks in production.

  • Outliers can be detected via z-scores (|z| > 3), IQR rule (outside Q1 − 1.5·IQR to Q3 + 1.5·IQR), or isolation forests.

  • Class imbalance remedies: resampling (over/under), class weights, and threshold tuning; resample only the training set, never validation or test.

  • Feature engineering creates derived variables (ratios, aggregations, date parts) that make relevant patterns easier for the model to learn.

Quick reference

Generative AI and Large Language Models

  • Transformer self-attention lets each token weigh all other tokens in context, enabling parallel processing and long-range dependency capture.

  • LLMs are trained in stages: pretraining (next-token prediction on large corpora) followed by instruction tuning and preference alignment (e.g., RLHF).

  • Tokenization splits text into subword units; context window is the maximum number of tokens the model can attend to at once, input plus output.

  • Temperature controls sampling randomness (low = deterministic, high = diverse); top-p/top-k truncate the probability mass considered at each step.

  • RAG (retrieval-augmented generation) retrieves relevant documents and inserts them into the prompt, grounding answers without changing model weights.

  • Embeddings map text to dense vectors where semantic similarity corresponds to vector distance (cosine similarity, dot product).

  • Hallucination is fluent but factually unsupported output; it arises because models optimize token likelihood, not truth.

  • Fine-tuning updates model weights on task data; prompt engineering and RAG change inputs only and are cheaper but do not alter learned parameters.

Quick reference

AI Ethics, Bias, and Responsible AI

  • Bias sources: historical bias in training data, sampling/selection bias, labeling bias, and proxy variables that correlate with protected attributes.

  • Fairness metrics conflict: demographic parity (equal positive rates), equal opportunity (equal TPR), and predictive parity (equal PPV) generally cannot all hold simultaneously.

  • Transparency vs. explainability: transparency discloses how a system works; explainability describes why a specific output occurred (e.g., SHAP, LIME).

  • Human-in-the-loop places a human decision-maker over consequential AI outputs; meaningful oversight requires the human to have authority and context to override.

  • Informed consent, purpose limitation, and data minimization are core privacy-ethics principles for personal data used in AI.

  • Model cards and datasheets document intended use, training data, performance across subgroups, and known limitations.

  • Accountability requires a named owner for each AI system; unclear ownership is a recurring governance failure.

  • Red-teaming probes a system adversarially for harmful outputs, bias, and safety failures before and after release.

Quick reference

AI Security, Privacy, and Governance

  • Prompt injection: malicious text in input or retrieved content overrides system instructions; mitigations include input validation, privilege separation, and output filtering.

  • Data poisoning corrupts training data to implant backdoors or degrade performance; membership inference attempts to determine whether a record was in the training set.

  • Model extraction/stealing queries a deployed model to approximate its behavior; rate limiting and query monitoring reduce exposure.

  • Adversarial examples are inputs with small perturbations that cause misclassification; adversarial training improves robustness at some accuracy cost.

  • Privacy techniques: anonymization/pseudonymization, differential privacy (calibrated noise), and federated learning (model updates shared, raw data stays local).

  • Governance controls include data classification, access control, audit logging, model inventory, and documented approval gates.

  • Regulatory frameworks to know: EU GDPR (personal data), EU AI Act (risk-tiered obligations), and NIST AI Risk Management Framework (govern/map/measure/manage).

  • Encryption in transit (TLS) and at rest, plus secrets management, are baseline controls for AI pipelines and model endpoints.

Quick reference

AI Use Cases and Business Applications

  • Use-case selection rule: start with a clearly defined business problem and measurable success metric, then choose the technique - not the reverse.

  • Good early candidates are high-volume, repetitive, data-rich tasks with tolerance for error and a clear feedback signal.

  • Common patterns: classification (fraud/spam), regression (demand forecasting), ranking/recommendation, anomaly detection, and generative assistance (summarization, drafting).

  • ROI = (benefit − total cost)/total cost; total cost includes data, compute, integration, monitoring, and human review - not just model training.

  • Build vs. buy: buy/integrate when the capability is commodity and non-differentiating; build when proprietary data or workflow creates advantage.

  • Human-in-the-loop is required where errors carry legal, financial, or safety consequences (medical triage, credit denial, content moderation).

  • Process automation candidates: document processing, customer support triage, code assistance, and quality inspection from images.

  • Pilot-to-production failure is usually organizational (workflow integration, ownership, change management) rather than model accuracy.

Quick reference

AI Solution Development and Deployment

  • MLOps = practices and tooling to version, test, deploy, and monitor models reproducibly across the lifecycle.

  • Serving patterns: batch (scheduled offline scoring), real-time online inference (low latency per request), and streaming (continuous event processing).

  • Model registry stores versioned artifacts with metadata and stage (staging/production) to enable rollback and audit.

  • Shadow deployment runs the new model alongside the old without serving its output; canary release sends a small traffic fraction to the new model first.

  • Monitoring must cover service health (latency, error rate), data quality (schema, drift), and model performance where ground truth is available.

  • CI/CD for ML adds data and model validation to the standard build-test-deploy pipeline; automated retraining triggers on drift or performance decay.

  • Containerization (e.g., Docker) plus orchestration (e.g., Kubernetes) packages the model with its dependencies for reproducible deployment.

  • Feature store centralizes feature definitions for training and serving, reducing train/serve skew.