Skip to content
tezvyn:

Llms

63 bites tagged Llms — interview questions with model answers, and 60-second explainers.

LLMs & Generative AI2 min read

What fixes an LLM agent's incorrect JSON arguments for a complex tool?

Tests mixing prompting with system guardrails for valid tool JSON. Outline: few-shot demos plus CoT prompting; schema validation, constrained decoding, and retries. Red flag: weak prompts without validation or structured output.

LLMs & Generative AI2 min read

Describe a ReAct agent architecture for multi-step dependent tool calls

Sketch ReAct's thought-action-observation cycle; keep state in an append-only trajectory; re-plan after each observation. Designing loops that interleave reasoning and tool use across steps.

LLMs & Generative AI2 min read

Walk me through building a weather agent with get_weather

Register get_weather, let the model emit parameters, execute it yourself, feed the result back, then synthesize the answer. The LLM tool-use loop separating inference from execution. Claiming the LLM calls the API.

LLMs & Generative AI2 min read

How does function calling work in modern LLMs?

Schemas in the prompt; model emits JSON name and arguments; client executes and returns results. whether you see function calling as client-side structured generation, not model execution.

LLMs & Generative AI2 min read

How would you modify retrieval architecture for hybrid text and SQL RAG?

It tests unified retrieval across unstructured text and structured SQL. Outline a query planner that routes to vector search or text-to-SQL, joins the results, and synthesizes a final answer. Never suggest embedding the whole database as text chunks.

LLMs & Generative AI1 min read

Describe a basic RAG architecture and its two main components

This tests retrieval-generation separation. Good answers name the retriever, which fetches relevant documents, and the generator, which synthesizes an answer using those documents plus the query.

LLMs & Generative AI2 min read

What is catastrophic forgetting in LLMs and how do you mitigate it?

This tests stability-plasticity trade-offs in fine-tuning. A strong answer defines catastrophic forgetting as lost prior capabilities, cites LoRA, regularization, and continual learning.

LLMs & Generative AI2 min read

Walk through RLHF's three stages, outputs, and purposes.

Tests your grasp of the RLHF pipeline end-to-end. A strong answer lists: pretrain an instruction-following LM, train a reward model outputting a scalar preference score, then fine-tune the LM via RL.

LLMs & Generative AI2 min read

How does LoRA work and why is it memory-efficient?

LoRA freezes weights and trains A and B so delta-W equals BA, cutting trainable params 10,000x and memory 3x since only A and B get grads. Low-rank adaptation. Claiming it shrinks size or adds latency.

LLMs & Generative AI2 min read

Full fine-tuning or LoRA on a tight compute budget?

This tests budget-constrained adaptation for many tasks. A strong answer picks LoRA: it trains only a small number of extra parameters, cutting compute and storage versus full fine-tuning while matching performance.

LLMs & Generative AI2 min read

Describe supervised fine-tuning for a pre-trained language model

Tests if you know SFT aligns a base model to instructions using curated prompt-completion data. A strong answer covers next-token prediction on completions, conversational formats, and small learning rates.

LLMs & Generative AI2 min read

Design dynamic few-shot example retrieval from a vector database

Tests RAG-style prompt engineering with semantic retrieval and latency. Use shared embeddings, approximate nearest neighbors with metadata filters, diversity reranking, and token-bounded prompt templates.

LLMs & Generative AI2 min read

Describe two prompt-based techniques to ensure valid LLM JSON output

This tests output constriction via prompt design. First, embed an exact JSON skeleton with empty values. Second, provide few-shot exemplars mapping inputs to valid JSON. A red flag is suggesting only post-hoc regex repair or larger models.

LLMs & Generative AI2 min read

How do you select in-context examples for text-to-SQL prompts?

What it tests: practical ICL design for structured generation. Answer outline: select examples by SQL syntax similarity plus pattern diversity, order from simple to complex, and anchor schema context. Red flag: claiming random examples work fine.

LLMs & Generative AI2 min read

Explain Chain-of-Thought prompting, its reasoning mechanism, and ideal use cases

This tests reasoning scaffolding. A good answer says CoT makes the model emit intermediate steps before the final answer, excelling at multi-step math and logic versus direct instructions.

LLMs & Generative AI2 min read

How would you construct zero-shot and few-shot prompts for feedback classification?

Tests knowledge of zero-shot versus few-shot prompt structure. Zero-shot gives instructions, labels, and format without examples; few-shot prepends 2-4 labeled demonstrations before the target input. Red flag: calling an example-containing prompt zero-shot.

LLMs & Generative AI2 min read

How does pre-training dataset composition influence capabilities and biases?

This probes whether you link data mix to capabilities and bias. Answer: code strengthens reasoning, web text adds noise; for science, use domain-adaptive pretraining on filtered literature, instruction tuning, and reasoning distillation, validating via…

LLMs & Generative AI2 min read

How did Chinchilla change compute allocation between model size and data size?

This tests whether you know prior scaling fixed data while growing parameters, but Chinchilla showed parameters and tokens must scale equally. A good answer: double both together, so train smaller models on more data. Red flag: huge models, fixed data.

LLMs & Generative AI2 min read

Why is self-attention O(n^2) and what are the implications?

Tests the attention matrix bottleneck. Strong answers note QK^T yields an N×N matrix, creating quadratic compute and memory that blocks long documents and high-res images. Red flag: confusing model size with activation memory.

LLMs & Generative AI2 min read

Explain Q, K, and V matrices in self-attention

This tests the information-retrieval intuition behind self-attention. Cover that Q, K, V are linear projections of one input; Q requests, K indexes, V supplies content; scores weight a sum of V.

LLMs & Generative AI2 min read

Explain positional encodings in Transformers and their necessity

Explain encodings inject order into embeddings; cite sinusoidal or learned vectors. Self-attention is permutation-invariant, requiring position signals. Claiming attention learns token order without position info.

LLMs & Generative AI2 min read

Validation loss increases while training loss decreases: what is this?

This tests recognition of overfitting and regularization. A strong answer names it, offers early stopping, dropout or weight decay, and data augmentation or more data. A red flag is suggesting longer training or more parameters without fixing generalization.

LLMs & Generative AI2 min read

Data Poisoning: Corrupting Models at the Source

Data poisoning is slipping lies into a textbook that a model memorizes forever. It shows up when you train on scraped web data or open fine-tuning sets. The footgun is assuming clean benchmarks mean clean weights; poison can hide until a trigger appears.

LLMs & Generative AI2 min read

Function Calling: LLMs Using Tools

Function calling turns an LLM into an API translator: it reads input and emits JSON telling your code which tool to run. Use it when the model needs live data it cannot store in weights. The model never executes the call and can hallucinate arguments.

Get Llms bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.