OCI AI Foundations cheat sheet
OCI AI Foundations · Keep the key ideas within reach.
AI and Machine Learning Fundamentals
Supervised learning trains on labeled input-output pairs; unsupervised learning finds structure in unlabeled data; reinforcement learning optimizes actions from reward signals.
Classification predicts discrete classes, regression predicts continuous numeric values, and clustering groups unlabeled records by similarity.
Precision = TP / (TP + FP); Recall = TP / (TP + FN); F1 = 2PR / (P + R), the harmonic mean of precision and recall.
A binary confusion matrix holds true positives, true negatives, false positives, and false negatives; accuracy alone misleads on imbalanced data.
High bias means the model is too simple and underfits; high variance means it is too sensitive to the training sample and overfits.
Overfitting mitigations: more training data, L1/L2 regularization, dropout, early stopping, cross-validation, and simpler model capacity.
Data is split into training, validation (hyperparameter tuning), and test sets; the test set is used only for the final unbiased estimate.
Feature preparation rules: standardize or normalize numeric features, one-hot encode categoricals, and explicitly handle missing values.
Deep Learning and Neural Networks
A neuron computes z = sum(w_i * x_i) + b and then applies a nonlinear activation; stacked nonlinear layers let a network approximate complex functions.
Activation choices: ReLU for hidden layers, sigmoid for binary output, and softmax for multi-class output probabilities.
Backpropagation applies the chain rule to compute gradients; gradient descent updates w := w - learning_rate * dL/dw.
CNN building blocks: convolution (local feature detection with weight sharing), pooling (downsampling), and a fully connected head for classification.
RNNs, LSTMs, and GRUs model sequences step by step; transformers replace recurrence with self-attention and process sequence positions in parallel.
One epoch is one full pass over the training set; batch size is the number of samples per weight update; too high a learning rate diverges, too low converges slowly.
Dropout randomly disables neurons during training to regularize the network and is switched off at inference time.
Transfer learning reuses weights pretrained on a large dataset and fine-tunes them on a smaller target dataset, cutting data and compute needs.
Generative AI, Large Language Models, and Prompt Engineering
An LLM is a transformer trained to predict the next token; it generates output one token at a time conditioned on the prompt.
Context window = maximum tokens for prompt plus response; content beyond it must be truncated, summarized, or retrieved externally.
Temperature and top-p control sampling randomness: temperature 0 is greedy and near-deterministic, while higher temperature increases output diversity.
Prompt patterns: zero-shot (instruction only), few-shot (worked examples), chain-of-thought (step-by-step reasoning), and system/role prompts that constrain behavior.
Few-shot examples embedded in the prompt generally improve format adherence and task accuracy compared with instructions alone.
RAG (retrieval-augmented generation) embeds a query, retrieves relevant chunks from a vector store, and inserts them into the prompt to ground the answer.
Embeddings are dense vectors; cosine similarity ranks semantic closeness and drives search, clustering, and RAG retrieval.
Hallucination is fluent but unsupported output; grounding with retrieval, lower temperature, and required citations reduce it.
Fine-tuning updates model weights on domain data; it is heavier than prompt engineering or RAG and is chosen for style, format, or behavior adaptation.
OCI Generative AI exposes chat, text generation, summarization, and embedding models via API, with dedicated AI clusters for fine-tuning workloads.
OCI AI Services (Language, Vision, Speech, Document Understanding, Anomaly Detection, Forecasting)
OCI Language: language detection, sentiment analysis, key phrase extraction, named entity recognition, text classification, translation, and PII detection.
OCI Vision: image classification and object detection on images, plus document AI for OCR text, key-value extraction, and table extraction.
OCI Speech: batch and real-time speech-to-text transcription, with custom vocabulary support, speaker diarization, and profanity filtering options.
OCI Document Understanding: OCR, key-value extraction, table extraction, and document classification, extendable from pretrained models to custom-trained models.
OCI Anomaly Detection is unsupervised: train on data representing normal behavior, then score new records for outlier likelihood without labeled anomalies.
OCI Forecasting produces time-series forecasts with confidence intervals and requires historical data at least twice as long as the forecast horizon.
All OCI AI services are pretrained and serverless, consumable from the OCI Console, REST API, OCI CLI, and SDKs without managing infrastructure.
Service selection rule: text to Language, images to Vision, audio to Speech, scanned documents to Document Understanding, time-series outliers to Anomaly Detection, future values to Forecasting.
Services compose into pipelines, for example Speech transcription feeding Language sentiment analysis, or Document Understanding extraction feeding Language entity extraction.
OCI Data Science and AI Infrastructure
OCI Data Science provides managed JupyterLab notebooks, compute sessions, conda environments, jobs, pipelines, a model catalog, and model deployment.
ADS (Accelerated Data Science) is Oracle's Python SDK for data exploration, feature handling, training, evaluation, and deployment, with OCI CLI and REST equivalents.
A Data Science job runs a script or notebook on managed compute without an interactive session, suited to scheduled or long-running training.
Model deployment publishes a trained artifact as an HTTP endpoint with optional autoscaling; artifacts live in Object Storage or the model catalog.
OCI compute shapes include GPU shapes with NVIDIA A100/H100 accelerators for training and smaller CPU shapes for notebooks and inference.
OCI Superclusters and RDMA cluster networking provide low-latency, high-bandwidth interconnect for large-scale distributed training.
Data lake pattern: Object Storage for raw data, Data Catalog for metadata, Data Flow (managed Apache Spark) for processing, Autonomous Database for structured serving.
Custom model versus AI service rule: use OCI AI Services for standard pretrained tasks, and OCI Data Science when training on proprietary data or custom architectures.
Responsible AI, Ethics, and Security
Core responsible AI principles: fairness, explainability, transparency, privacy, security, robustness, and accountability.
Bias enters through unrepresentative training data, labeler bias, and proxy features; outcomes must be measured across subgroups before deployment.
Explainability techniques: global feature importance, SHAP and LIME for local explanations, and inherently interpretable models for high-stakes use cases.
Least privilege means scoping IAM policies to specific compartments and resources and isolating workloads with compartments and dynamic groups.
Data is encrypted in transit with TLS and at rest by default; OCI Vault manages customer-managed encryption keys.
OCI Audit records API activity, while logging and drift monitoring detect anomalous model or data behavior after deployment.
PII handling: detect and redact personal data before sending text to models; OCI Language offers PII detection for this purpose.
Human-in-the-loop review is required for high-stakes decisions, with exposed confidence scores and an override path for reviewers.
Data governance controls include keeping data in-region, restricting prompt and log retention, and documenting model provenance and intended use.