Blog · 142 lessons
AI engineering, explained with tested code.
LLMs, RAG, agents, MCP, evals and mobile systems, plus a practical guide to AI-era interviews. Written for my free learning portal, AI Engineer.
Critical basics12
Essentials to read, memorise and practise.
- Read →Break down a vague problemCanva lists this among the skills it scores, and AI can't do it for you until you know what you want.
- Read →Write a prompt that works first timeVague requests get filled in with plausible guesses. In a live round, a bad prompt costs you minutes.
- Read →Review code fastWhen AI writes the code, reading it is your main job. It's scored directly in AI-allowed rounds.
- Read →Prove it worksVerification is reported as a scored skill, and skipping it is a common way to fail.
- Read →Debug in a straight lineDebugging AI-generated code is reported as a scored skill, and it's where calm people stand out.
- Read →Think out loudInterviewers can only score what they can hear. Silence and constant chatter are both reported as weak signs.
- Read →Know your complexity numbersAI can write the code, but you still get asked what it costs. These should come instantly.
- Read →LLM fundamentalsEvery AI interview assumes these, and a first screen often tests them directly.
- Read →Cost and latency sumsWorking out a feature's cost on the spot is a quick way to show you've shipped something real.
- Read →RAG basicsReported as one of the most common AI design prompts.
- Read →Agent basicsAgent questions test whether you'd trust a model with real actions, and how you'd limit it.
- Read →Eval basicsReported as a major difference between candidates who've shipped AI and those who've only demoed it.
AI interview hacks6
The most useful ideas people share, tested and turned into drills: hint ladders, planted bugs, recorded mocks, and more. Plus where the line sits.
- Read →Never ask AI for the answerHow do you get unstuck with AI and still learn the problem?
- Read →Make AI plant bugs in good codeHow do you get faster at spotting mistakes in code you didn't write?
- Read →Measure how you soundHow do you know whether you explain things well under pressure?
- Read →Reverse the job post, then cross-examine your resumeHow do you find out what they'll ask, and whether your own stories hold up?
- Read →Turn every miss into a cardHow do you stop making the same mistake in every mock?
- Read →The hacks that get you rejectedWhich uses of AI are fair, and how do you find out for your interview?
AI interview rounds8
Every round you may meet now, from coding beside an assistant to RAG, agents, evals and a customer role-play. What each tests, with code you can run.
- Read →The new interview mapWhat rounds will you actually face now, and who says so?
- Read →The AI-enabled coding roundHow do you use an assistant in a live round so that it counts in your favour?
- Read →The code comprehension roundHow do you find what's wrong in code you've never seen, in under an hour?
- Read →The LLM fundamentals screenWhat do you need to know about models to pass a first technical screen?
- Read →The RAG design roundHow do you design a system that answers questions from your own documents?
- Read →The agent design roundHow do you design an agent that can act without doing damage?
- Read →The evals roundHow do you prove an AI feature works, and that the next change didn't break it?
- Read →The customer conversation roundA customer says your bot feels dumb. What do you do in the next ten minutes?
Crack it with AI, the best way3
A plan that works from any starting point: an honest baseline, a daily loop, and a final stretch with AI off to prove the skill is yours.
Build your own AI interviewer4
Our pick. Build a mock interviewer that you'll really use, and walk away with a true project story, with real measurements behind it.
- Read →Build your coach: the interview loopHow do you build an AI interviewer that behaves like an interviewer?
- Read →Build your coach: the prompt and the model callWhat should the model see, and what must it never see?
- Read →Build your coach: scoring you can trustHow do you get reliable structured output from a model?
- Read →Build your coach: evals, cost and your storyHow do you prove it works, and how do you talk about it in an interview?
Deep dives12
- Read →Front-end architecture for offline, real-time and AI appsFront ends in data-heavy apps own far more than pixels: what the user sees, each screen's state machine, perceived speed, offline behaviour…
- Read →The sync engineSync engines move local changes to the server and server changes into the local database. No UI, and no business logic beyond merging. The …
- Read →The transfer managerTransfer managers move large files between phone and object storage. They hash, split and send parts that succeed or fail alone, record pro…
- Read →The background-work layerBackground layers adapt your app to the OS scheduler. They turn many triggers (app open, network back, push, timers, user actions) into a f…
- Read →The server sync serviceServer sync completes the protocol. It accepts pushes idempotently, applies merge rules, gives every change a sequence number in a per-tena…
- Read →How an LLM works insideLLMs map a token sequence to a probability for every possible next token. Generation repeats that function, appending one token at a time. …
- Read →Making inference fast and cheapInference limits come in three kinds: GPU compute during prefill, memory bandwidth during decode, and memory capacity for weights and KV ca…
- Read →Embeddings and vector searchEmbedding models turn text, images or audio into vectors, so similar meanings land close together. Approximate indexes find the nearest vec…
- Read →Prompting, RAG or fine-tuning?Three levers fit a general model to your product: better prompts, retrieval at query time, and new weights. Prompts and retrieval change wh…
- Read →Tool use, agents and MCPTool use lets a model call your functions: it outputs a structured request, your code runs it, and the result returns to the conversation. …
- Read →Integrating LLMs into productsLLM features behave like ordinary software with one unreliable, slow, expensive dependency. The patterns from payments or search apply: a g…
- Read →Using AI to accelerate engineering teamsAI adoption questions test principal engineers: how AI changes the way teams build, and how you roll it out responsibly. Cover tools, workf…
AI systems modules48
- Read →vLLM High-Throughput Engine ArchitecturePagedAttention treats the KV cache like virtual memory, so one GPU holds 2–4× more concurrent requests.
- Read →Block-Allocated PagedAttention Triton KernelBuild the block table and the kernel that reads it, so multi-tenant batches never fragment GPU memory.
- Read →Continuous Batching & Iteration-Level SchedulingIteration-level scheduling ends the wait for a batch's longest request; prefill stalls become the next bottleneck.
- Read →Tensor Parallelism & Ring-AllReduce CommunicationEvery transformer layer pays for two collectives on NVLink, which explains why tensor parallelism stays inside one server.
- Read →Speculative Decoding Target-Draft Pair VerifierModified rejection sampling accepts draft tokens without changing the target model's distribution.
- Read →vLLM Automatic Prefix Caching ArchitectureChained block hashes skip prefill for shared system prompts, and salts keep tenants apart.
- Read →Fused Flash-Softmax Triton KernelFusing softmax into one kernel cuts memory reads from 4n to n and writes from 2n to n.
- Read →Hierarchical Navigable Small World (HNSW) GraphsLayered small-world graphs answer nearest-neighbour queries in milliseconds, trading exact recall and memory for speed.
- Read →Reciprocal Rank Fusion (RRF) Hybrid SearchMerges BM25 and vector rankings without normalising scores that live on different scales.
- Read →Parent-Child Hierarchical Context RetrievalEmbed small chunks for precise matching, and send large parents to the model for enough context.
- Read →Entity-Relation Graph Mining & GraphRAG PipelineEntity graphs and community summaries answer corpus-wide questions that chunk retrieval cannot.
- Read →Redis Vector Semantic Response CachingAnswers repeat questions from a vector cache, cutting LLM cost, as long as false hits stay rare.
- Read →Inverted Indexing & BM25 Scoring EngineInverted indexes and BM25 still win on exact terms: product codes, names and error strings.
- Read →BGE-Reranker Multi-Stage Retrieval PipelineRetrieve 100 with fast search, rerank to 5 with a cross-encoder, and degrade safely on timeout.
- Read →Selective Context Window Token CompressionSpend the token budget on evidence: prune sentences and summarise history before they reach the model.
- Read →Low-Rank Adaptation (LoRA) Weight DecompositionTrains two thin matrices instead of every weight, so fine-tuning fits one GPU and merges with no added inference latency.
- Read →PyTorch LoRA Linear Layer ImplementationWrites a drop-in replacement for nn.Linear with trainable low-rank adapters and dropout.
- Read →QLoRA NormalFloat4 & Double QuantizationNF4 and double quantisation shrink a 7B base to about 3.4 GiB, so training fits a small GPU.
- Read →Direct Preference Optimization (DPO) Loss FunctionTrains on preference pairs directly, with no separate reward model or PPO loop.
- Read →DeepSpeed ZeRO-3 Memory PartitioningShards optimiser state, gradients and weights across GPUs, trading extra communication for models that otherwise cannot fit.
- Read →PyTorch Fully Sharded Data Parallel (FSDP)PyTorch's native sharding: wrap per block, and each block gathers its weights only while it runs.
- Read →Merging LoRA Adapters into Base Model WeightsBakes an adapter into the weights for faster serving, and shows when merging is the wrong call.
- Read →Unsloth Gradient Calculation AccelerationUnsloth claims faster, lighter fine-tuning through patched model code. Verify its numbers on your own hardware.
- Read →LLM-as-a-Judge Evaluation & Calibration ArchitectureLLM judges scale evaluation, but only once you correct position, verbosity and self-enhancement bias.
- Read →Llama-Guard Jailbreak & Safety ClassifierModerates input and output with a dedicated classifier, and fails closed whenever actions are at stake.
- Read →Faithfulness, Answer Relevance & Context Recall MetricsSeparates retrieval failures from generation failures, so you fix the right half of a RAG system.
- Read →Guardrails AI Structured Pydantic Output ValidationNever passes unvalidated model output downstream: validate against a schema and re-ask with the exact errors.
- Read →Evaluating Multimodal LLMs on Visual ReasoningMany vision benchmark items can be answered without the image. Control for that before trusting a score.
- Read →Automated Adversarial Red-Teaming SuitesTurns one-off safety testing into a regression suite that gates every release.
- Read →SLURM GPU Cluster Job Scheduling & Failure RecoveryRequeues multi-node training on failure, and resumes from the last checkpoint with no one watching.
- Read →Async Zero-Redundancy Optimizer CheckpointingSaves sharded state in the background, so checkpoints stop stalling GPUs.
- Read →Triton Compiler JIT Codegen PipelineFollows one Python function down to GPU binary, which explains caching, specialisation and autotuning.
- Read →NCCL Inter-Node Transport Protocols & InfinibandReads an NCCL debug log and finds the moment training silently falls back to TCP.
- Read →Ray Serve Distributed Actor DeploymentRuns LLM replicas as autoscaled actors, with health checks and per-replica request limits.
- Read →Prompt Patterns: Chain of Thought, Few-Shot, Structured OutputFour patterns cover most prompts. Test each against an eval set rather than trusting folklore.
- Read →CLIP and ViT Multimodal EmbeddingsCLIP places images and text in one vector space, which enables image search with no labels.
- Read →App Startup: Cold Start From Tap to First FrameStartup is the first performance number users feel, and most of it is work you chose to do too early.
- Read →Mobile Observability: Crashes, ANRs, Traces and Rollout GatesYou cannot roll back a phone, so telemetry has to catch a bad release while only 1% of users have it.
- Read →Mobile Security: Tokens, Keystore, Pinning and TamperingAssume the phone can be lost, rooted or reverse-engineered, then decide what an attacker still cannot do.
- Read →Live Location Tracking for a Driver AppA location stream combines every mobile constraint at once: battery, background limits, bad networks and scale.
- Read →Push Notification Platform at ScalePush looks like one API call until you need priority, retries, per-user limits and delivery you can measure.
- Read →Feature Flag and Experimentation SDKFlags are how mobile teams change behaviour without a store release, and bad assignment logic silently ruins experiments.
- Read →React Native New Architecture: JSI, Fabric, TurboModules and ThreadsMost older React Native advice is about the bridge. Knowing what replaced it shows which advice still holds.
- Read →React Native State: Server Cache, Client Store and Render StormsPutting every kind of state in one global store makes one change redraw half the screen.
- Read →Modular React Native for Many Apps: The Modularity LadderCodebases rarely fail from network speed. They fail from merge conflicts and features that can't be removed.
- Read →Memory Leaks in React Native: Three Heaps, One StaircaseA leak can hide in the JavaScript heap, the native heap or the boundary between them, and each needs a different tool.
- Read →Offline Sync in React Native: What to Persist and WhereA queue held in memory loses unsent changes when the OS kills the app. Persist the mutations, and keep them atomic with the local write.
- Read →The 95/5 Rule and Performance Budgets in CIMost code can stay in React Native. A few pieces belong in native code, and CI should stop performance from slipping.
System design rounds11
- Read →Offline-first inspection app with huge uploadsWe’re building an app for 200,000 field technicians who inspect pipelines. They work underground for hours with no signal, capture 30 to 60…
- Read →Real-time chat with offline deliveryDesign the messaging feature for a service marketplace: customers and providers chat one-to-one and in small groups of up to 50. Messages m…
- Read →Infinite feed with images and videoDesign the home feed for a social shopping app: an endless scroll of posts with photos and short videos. It must open instantly, scroll at …
- Read →Checkout and payments that never double-chargeDesign checkout for a mobile commerce app processing 50,000 orders an hour at peak sales. Cards, UPI and wallets. Networks are flaky, users…
- Read →Healthcare appointment booking without double-bookingDesign a booking platform for 3,000 clinics: patients book slots in a mobile app, practitioners manage availability in a partner app, and a…
- Read →Mobile platform for 150 engineers: builds, releases, flagsYou join as principal engineer. The company has one Android and one iOS app built by 150 engineers in 20 teams. Builds take 40 minutes, rel…
- Read →An AI assistant inside a mobile appOur wellness booking app has 2 million daily users. Product wants an in-app assistant that answers questions about services, recommends pra…
- Read →On-device AI versus cloud: a hybrid designWe want three AI features in our app: smart replies in chat, summarising long service descriptions, and identifying products in photos. Lea…
- Read →Retrieval-augmented answers over company documentsOur support and sales teams want an assistant that answers questions from 5 million internal documents: policies, product manuals, tickets …
- Read →Serving an open LLM on your own GPU fleetFor cost and data-residency reasons we will self-host a 70-billion-parameter open model for our assistant and internal tools. Expected load…
- Read →Shipping LLM features safely: evals, guardrails, monitoringThree teams are shipping LLM features: a support assistant, ticket summarisation, and marketing copy generation. Each has had embarrassing …
Protocols14
- Read →DHCP · Dynamic Host Configuration ProtocolHow a device with nothing gets an address.
- Read →IP · Internet Protocol (IPv4)Addresses and hops: how a packet finds its way.
- Read →ICMP · Internet Control Message ProtocolThe network’s way of telling you what went wrong.
- Read →UDP · User Datagram ProtocolFast, simple, no promises.
- Read →DNS · Domain Name SystemThe internet’s phone book.
- Read →TCP · Transmission Control ProtocolA reliable, ordered byte stream over an unreliable network.
- Read →TLS · Transport Layer SecurityPrivacy, integrity and identity for any connection.
- Read →HTTP · Hypertext Transfer ProtocolThe request and response language of the web.
- Read →HTTPS · HTTP over TLSHTTP inside a TLS tunnel.
- Read →SMTP · Simple Mail Transfer ProtocolHow email is sent and relayed.
- Read →POP3 · Post Office Protocol v3Download the mail, then it’s yours.
- Read →IMAP · Internet Message Access ProtocolMail that stays on the server and syncs everywhere.
- Read →FTP · File Transfer ProtocolThe classic file transfer protocol with two connections.
- Read →SSH · Secure ShellAn encrypted tunnel for logins, commands and files.
Coding patterns15
- Read →Two pointers patternWalk inwards from both ends of a sorted sequence.
- Read →Sliding window patternGrow the right edge, shrink the left edge while invalid.
- Read →Fast and slow pointers patternOne pointer moves twice as fast; they meet in a cycle.
- Read →Binary search patternHalve the search space, including the answer space.
- Read →Prefix sums and hashing patternRemember what you have seen to answer in O(1).
- Read →Monotonic stack patternKeep a stack in sorted order to find the next greater or smaller.
- Read →Heap / top-K patternKeep the best K so far in a size-K heap.
- Read →Intervals patternSort by start, then sweep and merge.
- Read →BFS and DFS patternExplore grids and graphs; BFS gives shortest steps.
- Read →Topological sort patternOrder tasks so every dependency comes first.
- Read →Union-find patternMerge groups and ask 'same group?' almost instantly.
- Read →Backtracking patternChoose, explore, un-choose.
- Read →Dynamic programming patternDefine the state, write the recurrence, fill the table.
- Read →Trie patternA tree of characters for fast prefix lookups.
- Read →Greedy patternTake the locally best choice, and prove it is safe.
Machine coding9
- Read →LRU cache with a memory budgetO(1) get and put, evicting the least recently used item when bytes exceed a limit.
- Read →Image loader with coalescing and two cache tiersMemory, then disk, then network, and fifty identical requests become one download.
- Read →Offline outbox with idempotent syncWrites persist first, sync later, survive kills, and are never applied twice.
- Read →Retry with exponential backoff and jitterRetries that recover calmly instead of stampeding a struggling server.
- Read →Search-as-you-type with debounce and cancellationOne request per pause in typing, and never a stale result on screen.
- Read →Cursor-based infinite feedPrefetch before the bottom, one request at a time, no duplicates, no stale pages.
- Read →Resumable multipart uploaderUpload a 4 GB video in parts, a few at a time, and resume after a kill.
- Read →Client-side token bucket rate limiterAllow bursts, then a steady rate, so your app cannot DDoS your own API.
- Read →List diffing for animated UI updatesTurn old and new lists into deletes, inserts, moves and reloads, in O(n log n).