BASIC Supervised Learning
Predicts continuous output using a line: y = mx + b. Loss = MSE.
Binary classification via sigmoid: σ(z) = 1/(1+e⁻ᶻ).
Splits data by feature thresholds. Prone to overfit without pruning.
ADVANCED Ensemble Methods
Gradient boosting with regularization (L1/L2), tree pruning, column subsampling.
Histogram-based splits, leaf-wise growth — faster than XGBoost on large data.
Bagging of decision trees; reduces variance via averaging.
ADVANCED Neural Networks
Convolutional layers extract spatial features. Used in image/time-series tasks.
Sequential memory via gates: input, forget, output. Handles time-series.
Attention-based parallelism. Backbone of modern LLMs.
BASIC EDA Steps
- Shape / dtypes / .describe()
- Missing value analysis: df.isnull().sum()
- Distribution plots: histplot, boxplot
- Correlation heatmap (seaborn)
- Outlier detection: IQR / Z-score
DEV Bias-Variance Tradeoff
High bias → underfitting (model too simple). High variance → overfitting (model memorizes). Solution: regularization (L1/L2), dropout, more data, cross-validation.
DEV Imbalanced Classes
Techniques: SMOTE oversampling, class_weight='balanced', use PR-AUC/F1 instead of accuracy, threshold tuning, ensemble methods.
DEV Gradient Descent Variants
BGD: full batch, stable but slow. SGD: noisy but fast. Mini-batch: best of both. Adam: adaptive LR — default choice for deep learning.
DEV Hyperparameter Tuning
GridSearchCV (exhaustive), RandomizedSearchCV (fast), Optuna (Bayesian optimization), Ray Tune (distributed). Always use k-fold CV to evaluate.
Scenario 1: Fraud Detection System
You have 1M transactions, 0.1% are fraud. Your XGBoost model has 99% accuracy but catches only 20% of fraud cases. What do you do?
▶ Show AnswerScenario 2: Model Degradation in Production
Your credit scoring model was 92% accurate at launch. After 6 months accuracy dropped to 78%. No code changed. Why?
▶ Show AnswerBASIC Transformer Architecture
Computes relevance of each token to every other token via Q, K, V matrices.
Sine/cosine waves injected to give tokens position awareness.
Two linear layers with non-linearity applied per token independently.
ADVANCED LLM Variants
Multimodal, 128k context, RLHF + RLAIF trained.
Encoder-only. Masked LM pretraining. Best for NLU tasks.
Open-weight. Group Query Attention, RoPE embeddings, SwiGLU.
1M token context, mixture-of-experts, native multimodal.
ADVANCED Fine-Tuning Techniques
All weights updated. Expensive, needs lots of GPU RAM.
Low-Rank Adaptation: adds small trainable matrices A, B. ΔW = BA.
LoRA on 4-bit quantized model. Fits 70B on single A100.
Reward model from human preferences → PPO policy update.
Techniques
- Zero-shot No examples, direct instruction
- Few-shot 2-5 input→output examples
- CoT "Let's think step by step"
- ReAct Reason + Act in alternation
- Tree of Thought Explore multiple paths
- Self-Consistency Sample N paths, majority vote
Scenario: LLM Hallucinating in Customer Support Bot
Your LLM-powered support bot is confidently giving wrong answers about product pricing and policies. It's in production. How do you fix this?
▶ Show Answer(Feast/Tecton)
(managed ML platform)
(MLflow/W&B)
(GitHub Actions)
(FastAPI/Triton)
(Evidently/Grafana)
(PDF/Web/DB)
(RecursiveTextSplitter)
(text-embedding-3)
(managed vector DB)
(Top-K chunks)
→ Answer
ADVANCED Agent Architectures
Thought → Action → Observation loop. Uses tools and reasons over results.
Planner LLM creates steps → Executor LLM runs each step.
Supervisor routes to specialist agents (coder, researcher, analyst).
Prompt Injection
Attacker embeds instructions in user input to override system prompt. Defense: Input sanitization, instruction hierarchy, NeMo Guardrails, separate system/user contexts.
Data Leakage
LLMs may memorize training data. Defense: PII detection before RAG ingestion (Presidio), output filtering, differential privacy in fine-tuning.
OWASP LLM Top 10
- Prompt Injection
- Insecure Output Handling
- Training Data Poisoning
- Model Denial of Service
- Supply Chain Vulnerabilities
DEV GIL — Global Interpreter Lock
Python's GIL allows only one thread to execute at a time. For CPU-bound tasks, use multiprocessing. For I/O-bound, use asyncio or threading. GIL doesn't affect multi-process ML training.
DEV Memory Optimization
Use generators instead of lists. Downcast dtypes: df.astype({'col': 'float32'}). Use __slots__ in classes. Dask for out-of-memory DataFrames. Polars for fast columnar ops.
DEV Context Managers
DEV List vs Generator Performance
List: O(n) memory, instantiated upfront. Generator: O(1) memory, lazy evaluation. For ML pipelines processing millions of records, generators are essential to avoid OOM errors.
ADVANCED Circuit Breaker
Resilience4j: CLOSED → OPEN (after N failures) → HALF_OPEN (probe). Prevents cascade failures between services.
ADVANCED Saga Pattern
Distributed transactions without 2PC. Choreography (events) or Orchestration (central coordinator). Each step publishes success/failure events.
ADVANCED Event Sourcing + CQRS
Store all state changes as immutable events. CQRS: separate read/write models. Enables replay, audit trail, temporal queries.
DEV Java 17+ Stream API
DEV Spring Security JWT
BASIC ETL vs ELT
Extract → Transform (on server) → Load. Traditional, good for sensitive data.
Extract → Load (raw) → Transform (in DWH). Modern cloud approach with cloud data warehouses.
BASIC Data Formats
- Parquet Columnar, great compression, fast analytics
- Avro Row-based, schema evolution, streaming
- Delta Lake ACID on data lake, time travel
- Iceberg Table format for massive tables
ADVANCED Medallion Architecture
Raw ingested data. No transformation. Append-only.
Cleaned, validated, joined. Business rules applied.
Aggregated, business-ready. Serving layer for BI/ML.
Scenario: Late-Arriving Data Problem
Your daily Spark job calculates revenue per merchant. Occasionally, transactions arrive 2-3 days late. Your reports show wrong numbers. How to fix?
▶ Show Answer(Events/Logs/DB)
Spark / Hadoop
(Recomputed daily)
Kafka + Flink/Spark
(Last hours only)
Merges Batch + Speed views
Lambda Architecture
- Two paths: batch + streaming
- Complex but handles reprocessing
- Batch ensures correctness
- Good for: fraud detection, reporting
- Tools: Spark + Kafka + HBase
Kappa Architecture
- Single streaming path only
- Simpler, lower latency
- Reprocess by replaying Kafka
- Good for: real-time analytics
- Tools: Kafka + Flink + Cassandra
(jobs)
(Train)
Endpoint
(Streaming)
(Trigger)
(API)
+ CDN
Object storage commands
Managed ML CLI
Scenario: Design a Real-Time Fraud Detection System on a Public Cloud
You need to score 10,000 transactions/second for fraud with <50ms latency. Model is an XGBoost + LLM explanation. Design the cloud architecture.
▶ Show AnswerBASIC Key BFS Concepts
Anti-Money Laundering. Detect structuring, layering, smurfing patterns in transaction graphs.
Know Your Customer. Identity verification, document validation, risk scoring at onboarding.
EU regulation mandating banks expose APIs. Enables TPP access to account data.
ADVANCED Fraud Detection Patterns
Online fraud. Behavioral biometrics + device fingerprinting + velocity checks.
Stolen credentials. Anomaly detection on login location, device, time.
Fake identities using real SSNs. Graph analysis to detect identity clusters.
ADVANCED Credit Risk Models
Probability of Default. Logistic regression with bureau + behavioral features.
Loss Given Default. Recovery rates by collateral type.
Current Expected Credit Loss. IFRS 9 / FASB standard for lifetime loss provisioning.
DEV Real-Time Velocity Check
+ WAF
Microservices
Event Bus
(Streams)
(Feature Extract)
(ML Scoring)
(Explanation)
Delta tables
DWH
Registry
Vector DB
Pipeline
+ Evidently
Pipelines
Classifier
(NeMo)
Agent
(managed API)
(Hallucination Check)
+ Audit Log
Human-in-the-Loop
Route low-confidence predictions (<0.7) to human review. Collect labels → continuous retraining. Feedback loop closes the model-data gap.
Shadow Deployment
Run new model in parallel with production. Compare outputs without affecting users. Graduate to A/B then full cutover. Zero risk rollout.
Canary Release
Route 5% traffic to new model → monitor metrics → gradually increase. Rollback instantly if KPIs degrade. Blue-green variant for atomic switch.