AI Fundamentals: A Practical Guide for Engineers and Interviews

Everything important about modern AI in one calm pass — concepts, vocabulary, and interview-ready intuition without the noise.

Page content

This guide is for software engineers who want a solid mental model of artificial intelligence — whether you are refreshing for interviews, joining an AI feature team, or reading production LLM code with less confusion.

Read it top to bottom once (~20–30 minutes). Use the table of contents later as a cheat sheet.

The map in one minute

TermPlain meaning
AIBroad umbrella: machines performing tasks that usually need human intelligence
Machine learning (ML)Systems that learn patterns from data instead of only hard-coded rules
Deep learning (DL)ML using multi-layer neural networks
Generative AIModels that produce new content (text, code, images, audio)
LLMLarge language model — a generative model specialized for language/tokens

Interview one-liner: AI ⊃ ML ⊃ DL; modern GenAI/LLMs sit mostly inside deep learning.

What problems does ML solve?

Almost every ML problem is one of these:

TypeGoalExamples
ClassificationPredict a labelSpam / not spam, fraud detection
RegressionPredict a numberDemand forecast, house price
Ranking / recommendationOrder candidatesFeed ranking, “similar items”
ClusteringGroup without labelsCustomer segments
GenerationCreate contentChat answers, code completion
Anomaly detectionFind rare eventsIntrusion, sensor faults

If you can name the input, output, and success metric, you are already framing the problem correctly.

How learning works (core loop)

  1. Collect data (features + optional labels)
  2. Train a model to minimize error on training data
  3. Validate on held-out data so you catch overfitting
  4. Ship and monitor live performance

Train / validation / test

  • Train: model fits here
  • Validation: tune hyperparameters / choose among models
  • Test: final honest estimate (touch once)

Overfitting vs underfitting

  • Underfit: too simple — poor on train and test
  • Overfit: memorizes train — great on train, weak on new data

Fixes for overfitting (say these in interviews): more data, regularization, simpler model, dropout (neural nets), early stopping, better validation.

Supervised, unsupervised, reinforcement

ParadigmSignalTypical use
SupervisedLabeled examples (x → y)Most classical industry ML
UnsupervisedNo labelsClustering, compression, anomaly cues
Self-supervisedLabels invented from data itselfLanguage masking, next-token prediction
ReinforcementRewards from actionsGames, some alignment/RLHF flavors

LLMs are mainly pretrained with self-supervised next-token prediction, then often improved with supervised fine-tuning and preference/reward methods.

Classical ML you should still know

Even in an LLM world, these ideas show up constantly:

  • Features: numeric/categorical inputs the model sees
  • Baseline: always compare to a simple model or heuristic
  • Linear / logistic regression: strong, explainable baselines
  • Trees / forests / gradient boosting: tabular data workhorses
  • k-NN, SVM: know what they optimize for, not every proof

Metrics cheat sheet

ProblemCommon metrics
Binary classificationPrecision, recall, F1, ROC-AUC, PR-AUC
MulticlassMacro/micro F1, confusion matrix
RegressionMAE, MSE/RMSE, MAPE
RankingNDCG, MAP, recall@k
GenerationTask-specific eval + human prefs (BLEU alone is rarely enough)

Interview tip: Prefer the metric that matches business cost (false positives vs false negatives), not the one that looks nicest on a slide.

Neural networks (just enough)

A neural net is stacked functions:

input → linear transform → non-linearity → … → output

  • Weights are learned by gradient descent (backpropagation)
  • Activation functions (ReLU, etc.) make the network non-linear
  • Loss measures error (cross-entropy, MSE, …)
  • Batching, learning rate, optimizers (SGD, Adam) control training dynamics

Important architectures (names to recognize)

ArchitectureGood at
MLP / feed-forwardTabular-ish learned functions, classifier heads
CNNGrid-like data (images; also some text/history uses)
RNN / LSTMSequences (mostly overshadowed by transformers for NLP)
TransformerSequences with attention — foundation of modern LLMs
Diffusion / other generative netsImages and some multimodal generation

Transformers and LLMs

Tokens

Models do not “read English.” Text is split into tokens (subwords/bytes). Context limits are usually in tokens, not characters.

Attention (intuition)

Attention lets each token look at other tokens and decide what matters for the next prediction. That is why transformers handle long-range dependencies better than older RNNs for many language tasks.

What an LLM is doing

At its core, a typical LLM learns:

Given previous tokens, predict the probability distribution of the next token.

Chat behavior emerges after further training (instruction tuning, preference optimization) and product scaffolding (system prompts, tools, retrieval).

Useful LLM vocabulary

TermMeaning
Context windowHow much prior token context the model can see
TemperatureHigher → more random sampling; lower → more deterministic
Top-p / top-kLimits sampling to likely tokens
HallucinationFluent but false or unsupported output
EmbeddingsVector representations of text for search/similarity
Tool callingModel asks your system to run functions (search, SQL, APIs)

Adapting models: prompt, RAG, fine-tune

Pick the lightest approach that works:

ApproachWhen to useTradeoff
PromptingFast iteration, general reasoningLimited private knowledge
RAGNeed current/company documentsRetrieval quality becomes the bottleneck
Fine-tuningStable style/format or specialized behaviorCostly; can go stale; needs good data
Agents / toolsMulti-step tasks with external systemsHarder reliability and evaluation

RAG in one picture

  1. Chunk and embed your documents
  2. On each query, retrieve relevant chunks
  3. Put them into the prompt as evidence
  4. Generate an answer grounded in that evidence

Interview line: RAG updates knowledge without retraining; fine-tuning changes behavior/style more deeply but is heavier.

Evaluation, safety, and production reality

Shipping AI is more than calling an API.

Evaluate like an engineer

  • Offline metrics + curated golden sets
  • Human review for nuanced quality
  • Online A/B tests / shadow traffic when stakes are high
  • Track latency, cost per request, cache hit rate, toxicity/PII leaks

Failure modes worth naming

  • Hallucinations and overconfidence
  • Prompt injection / untrusted tool output
  • Data leakage (training or logs)
  • Bias and uneven performance across groups
  • Distribution shift (production data drifts from training)

Minimal production checklist

  1. Clear user job-to-be-done and non-goals
  2. Grounding strategy (RAG/tools) if facts matter
  3. Guardrails (input/output filters, authz around tools)
  4. Observability (prompts, retrieval hits, latency, cost)
  5. Fallback path when the model is wrong or down

AI system design (interview framing)

When asked to “design an AI feature,” structure the answer:

  1. Problem & users — what decision/output improves?
  2. Constraints — latency, cost, privacy, language, offline needs
  3. Data — sources, labels, refresh cadence, access control
  4. Model choice — API LLM vs open model vs classical ML
  5. Architecture — prompt service, retriever, vector DB, cache, tools
  6. Eval plan — offline + online metrics, red-team cases
  7. Risks — abuse, compliance, blast radius

That outline alone often scores well even before deep ML theory.

Quick interview Q&A

ML vs deep learning?
DL is ML with deep neural nets; strong for unstructured data (text, images, audio), usually needs more data/compute.

Why not always fine-tune?
Cost, ops complexity, and risk of overfitting to narrow examples. Try prompting/RAG first.

Precision vs recall?
Precision: of predicted positives, how many are right. Recall: of real positives, how many you caught. High-stakes misses → prioritize recall; noisy false alarms → prioritize precision.

What is an embedding?
A vector that places similar meaning nearby in space — used for semantic search, clustering, and RAG retrieval.

Why do LLMs hallucinate?
They optimize for likely next tokens, not guaranteed truth. Without grounding/verification, fluent guessing fills gaps.

Batch vs real-time inference?
Batch for offline scoring/reports; real-time for user-facing apps with latency budgets.

One-page mental checklist

  • Define the task type and metric
  • Separate data, model, and product scaffolding
  • Prefer simple baselines before complex models
  • For LLMs: prompt → RAG/tools → fine-tune in that order
  • Design for failure: monitoring, evals, guardrails, fallbacks

If you remember only that checklist, you already sound like someone who can ship AI carefully — which is what most technical interviews are probing for.