Interview questions in LLMs & Generative AI, page 3

How does function calling work in modern LLMs?
Schemas in the prompt; model emits JSON name and arguments; client executes and returns results.

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.

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.
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.
Securing tool-using LLM agents
Name indirect prompt injection, data exfiltration, and unsafe tool execution, then defend with sandboxing, least-privilege scoped tools, input/output filtering, and human-in-the-loop on risky actions.
Designing an agent that resolves ambiguity
Detect ambiguity, gather evidence with the contact API, resolve relative time deterministically, ask the user only when genuinely uncertain, then confirm before the irreversible booking.
Explain GAN architecture, generator and discriminator roles, and objective function
Tests adversarial training as a minimax game. Strong answers: generator maps noise z to fakes; discriminator classifies real versus fake; both optimize V(D,G)=E[log D(x)]+E[log(1-D(G(z)))].

Key latent space difference between Autoencoder and VAE, and generative use
This tests deterministic versus probabilistic latent representations. Standard autoencoders encode fixed points; VAEs encode distributions. Sampling the regularized latent distribution generates new data. Red flag: calling VAEs mere noise adders.
Explain Denoising Diffusion models and forward/reverse processes.
This tests if you see diffusion as iterative latent generation, not GANs. Forward: add Gaussian noise over T steps until data is pure noise. Reverse: a network iteratively denoises random noise into data.
What is GAN mode collapse, its causes, and two mitigations?
Define mode collapse as diversity loss to few modes; cite discriminator imbalance and lenient JS loss; give two fixes: WGAN and mini-batch discrimination.
How does text guide Stable Diffusion via U-Net cross-attention?
Tests whether you know text embeddings condition the U-Net through cross-attention. Good answers explain that image features query text keys and values at every layer. Red flag: claiming the prompt is concatenated to the image latent.
Evaluating image generation: FID and IS
FID compares feature distributions of real and generated images, lower is better; Inception Score rewards confident, diverse classes but ignores real data.
DDIM: faster diffusion sampling
DDIM defines a non-Markovian deterministic process sharing DDPM's training, letting you skip steps and sample in far fewer iterations.
Diffusion-based image inpainting design
At each denoising step keep the known region by replacing it with the noised original, let the model generate only the masked area, condition on prompt and mask.
Temporal consistency in video diffusion
Add temporal layers, such as temporal attention or 3D convolutions across frames, so the model attends across time and frames denoise jointly rather than independently.
Classic image captioning architecture
A CNN encoder extracts image features, a recurrent or transformer decoder generates the caption word by word, and attention lets the decoder focus on image regions per word.
Early versus late modality fusion
Early fusion merges raw or low-level features so the model learns cross-modal interactions, while late fusion processes each modality separately and combines outputs.
Designing a Visual Question Answering system
Encode the image with a vision backbone, encode the question with a text encoder, fuse them via cross-attention into a joint representation, then decode or classify the answer.
How Stable Diffusion generates images
The text encoder turns the prompt into embeddings, the U-Net predicts noise to remove conditioned on those embeddings, and the scheduler controls how noise is stepped down over iterations in…
Aligning text and image representations
Contrastive learning like CLIP pulls matched image-text pairs together and pushes mismatches apart; alternatively projection layers map one modality into a frozen model's space.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles