Careers / Prep packs

Mid level

LLM and GenAI Engineer interview questions and prep

Mid-level LLM engineers build production GenAI applications: designing prompts, implementing RAG systems, evaluating model outputs, and deploying guardrails. Interviews test your ability to spot injection vectors, design secure retrieval pipelines, evaluate quality and safety, and reason through latency and cost trade-offs.

  • 30 questions
  • 8 skills
  • 10 labs

Open roles this pack fits

  1. Applied AI Engineer - StartupsOpenAI

Skills this role needs

  • Prompt injection attack and defenseDirect attacks on LLM apps; you must recognize vectors and harden prompts against them.
  • RAG security and poisoningRetrieval systems are attack surfaces; you must design ingestion, retrieval ranking, and cache safely.
  • Agent hijacking and tool safetyAgents with tool access are powerful and exploitable; you must control what agents do with outputs and approvals.
  • Output validation and rendering safetyModel outputs flow to users, databases, and other systems; unsafe rendering causes XSS, SQL injection, and data leaks.
  • Evaluation metrics and quality gatesYou must measure whether the model is safe and accurate; weak evals hide failures and security gaps.
  • Cost and latency optimizationProduction LLM apps fail on cost or slowness; you must balance model choice, context size, and batching.
  • LLM fingerprinting and probingUnderstanding what an LLM leaks through its outputs helps you design safer applications and defend against inference attacks.
  • Indirect injection and supply chain threatsAttacks arrive through documents, tool results, and cached memory; you must assume untrusted input at every boundary.

Labs to practise

Hands-on labs on this site that match the work in this role. They run in the browser.

Courses that help

Tutorials to read

30 interview questions

Answer in your own words first, then open what a strong answer covers. Sign in to practise with AI feedback.

  1. A user enters a prompt that closes your system instructions with triple quotes, then injects new rules. Walk through what happens in the model's context window and how you would detect and block this.

    What a strong answer covers
    • prompt injection mechanics
    • context window layout
    • input validation strategy
  2. You are building a RAG pipeline that ingests user-uploaded documents. Where in the pipeline can adversaries inject malicious instructions, and what checks would you add before indexing?

    What a strong answer covers
    • RAG ingestion security
    • document validation
    • untrusted input handling
  3. An agent has a tool that fetches URLs and reads their content. An attacker crafts a prompt that makes the agent request an internal service. How would you design the agent's tool policy to prevent this?

    What a strong answer covers
    • agent tool safety
    • SSRF via LLM
    • least-privilege access
  4. Your LLM outputs JSON that the backend parses and stores in a database. The model generates a field value that includes SQL syntax. How does this fail and what output validation would prevent it?

    What a strong answer covers
    • output injection risks
    • schema validation
    • downstream trust boundaries
  5. You are evaluating a model's safety on a benchmark of 500 prompts. What metrics would you track beyond just accuracy, and how would you catch evasion attacks that the benchmark missed?

    What a strong answer covers
    • evaluation design
    • safety metrics
    • adversarial testing
  6. A prompt that works in GPT-4 times out in Claude 3. Walk through how you would diagnose the latency issue and what trade-offs you would consider: longer context window, smaller model, or batching.

    What a strong answer covers
    • latency diagnosis
    • model selection trade-offs
    • cost-latency balance
  7. An attacker poisons your embedding database by inserting a document that is semantically similar to many queries but contains harmful instructions. How would you detect this and prevent retrieval of poisoned embeddings?

    What a strong answer covers
    • embedding poisoning
    • retrieval ranking safety
    • anomaly detection
  8. Your chatbot stores conversation history in a shared cache. User A's message in one session reappears in User B's session. What data isolation flaw caused this and how would you fix it?

    What a strong answer covers
    • memory poisoning
    • cache isolation
    • multi-tenant safety
  9. You run an LLM against a dataset to infer whether a user's data was in its training set. What attack is this, what does success look like, and how would you defend the model?

    What a strong answer covers
    • membership inference
    • training data leakage
    • defense mechanisms
  10. An agent sends a tool call with an argument that looks benign but, when the backend processes it, executes unintended logic. Give an example and explain how output schema validation should catch it.

    What a strong answer covers
    • tool argument injection
    • schema bypass
    • validation layers
  11. Your system renders LLM output as HTML in the browser. The model generates valid markdown that includes image alt-text with JavaScript. How is this vulnerable and how would you sanitize safely?

    What a strong answer covers
    • LLM-output XSS
    • markdown rendering risks
    • output sanitization
  12. An attacker uses many examples of a behavior in the conversation history to make the model ignore your instructions and do something unsafe. What is this attack called and how would you defend it?

    What a strong answer covers
    • many-shot jailbreaking
    • in-context attack
    • instruction robustness
  13. You need to decide whether to use a 7B or 70B model for a customer-facing task. The 7B is 10x faster but hallucinates more. How would you frame this decision using cost, latency, and accuracy metrics?

    What a strong answer covers
    • model sizing
    • trade-off analysis
    • production constraints
  14. An indirect prompt injection attack uses a third-party document summarization tool. The document contains hidden instructions that the LLM executes. Walk through the attack chain and where to add controls.

    What a strong answer covers
    • indirect injection
    • document supply chain
    • control points
  15. Your LLM generates an authentication token. The backend accepts it without verification. Why is this dangerous and what should the backend do instead?

    What a strong answer covers
    • LLM-generated token forgery
    • trust boundaries
    • backend validation
  16. You are red-teaming your own system. You generate a carefully crafted prompt, hidden Unicode characters, and a poisoned document. Which attack surface would you test first and why?

    What a strong answer covers
    • red-teaming methodology
    • attack prioritization
    • testing scope
  17. An agent's scratchpad (internal reasoning) is corrupted by an attacker to make the agent exfiltrate data. What type of control would prevent the agent from executing corrupted plans?

    What a strong answer covers
    • plan injection
    • scratchpad validation
    • agent state safety
  18. Your cost per request is 5¢ for context retrieval and 95¢ for inference. You are considering caching embeddings or reusing context windows. Which optimization would you pursue first and how would you measure ROI?

    What a strong answer covers
    • cost breakdown analysis
    • caching strategy
    • optimization ROI
  19. An LLM app allows users to upload images for analysis. An attacker hides a jailbreak prompt in the image metadata and in invisible text. How would you detect and block this?

    What a strong answer covers
    • multimodal injection
    • image parsing safety
    • metadata validation
  20. You are designing a human-in-the-loop approval step for high-risk agent decisions. An attacker manipulates the LLM's summary of the action to hide what the agent will actually do. How do you ensure the human sees the truth?

    What a strong answer covers
    • approval summary spoofing
    • human oversight design
    • transparency controls
  21. Your RAG system retrieves documents, but the model uses them to construct a SQL query. An attacker poisons a document with SQL syntax that breaks out of the intended query. How is this different from a prompt injection and how do you defend it?

    What a strong answer covers
    • text-to-SQL injection
    • RAG to downstream integration
    • query construction safety
  22. An agent has permissions to read and write files. An attacker uses path traversal in a tool call to access files outside the intended directory. What permission model would prevent this?

    What a strong answer covers
    • agent blast radius
    • least-privilege tool access
    • file system sandboxing
  23. You are choosing between fine-tuning a base model vs. using few-shot prompting for a task. Walk through the security, latency, and cost implications of each approach.

    What a strong answer covers
    • fine-tuning vs. prompting trade-off
    • training data security
    • deployment latency
  24. An attacker creates a fake MCP server tool and your agent connects to it. The tool's description is crafted to trick the agent into calling it with sensitive data. How would you vet tools before integrating them?

    What a strong answer covers
    • tool supply chain security
    • MCP vetting
    • tool description validation
  25. Your LLM app is queried by millions of users daily. You notice a few queries return unusually similar outputs that reveal model internals. What attack might this be and how would you detect it at scale?

    What a strong answer covers
    • model fingerprinting
    • inference-time attacks
    • anomaly detection at scale
  26. A user's conversation history is stored in a database and used to personalize future responses. An attacker from a different tenant manipulates the database to inject instructions into another user's history. How do you prevent this?

    What a strong answer covers
    • shared memory injection
    • database isolation
    • multi-tenant data integrity
  27. You are designing the system prompt. It includes rules like 'Do not leak confidential data.' An attacker asks the model to repeat its instructions. How would you structure the prompt to minimize leakage if extracted?

    What a strong answer covers
    • system prompt hardening
    • extraction resistance
    • prompt design principles
  28. An LLM app generates code that is automatically executed in a sandbox. An attacker crafts a prompt that escapes the sandbox. What would you check in the generated code before execution?

    What a strong answer covers
    • code interpreter abuse
    • sandbox escape
    • execution safety validation
  29. You are building an evaluation benchmark to test your system's safety. It includes 100 adversarial prompts. What would cause your benchmark to give false confidence and how would you catch it?

    What a strong answer covers
    • evaluation overfitting
    • benchmark limitations
    • adversarial robustness testing
  30. An LLM is told to generate a report by analyzing tool outputs. An attacker returns a fake tool output that contains instructions the agent will follow. How is this different from a system prompt injection and what defense applies?

    What a strong answer covers
    • tool-output injection
    • agent state manipulation
    • output trustworthiness

A 14-day preparation plan

  1. Days 1 to 3Start with fundamentals. Take the LLM Security Fundamentals course and work through the Prompt Injection From Zero course in parallel. Run the Prompt Injection — Sales Bot lab to see how injections work in practice. Read the AI Recon piece to understand how attackers fingerprint your LLM app. Focus on the mechanics of
  2. Days 4 to 7Dive into RAG and agent security. Complete the OWASP Top 10 for LLM Applications course. Work through RAG-focused labs: ai-review-rag-ingestion-1 and ai-rag-poisoning-1. Read the adversarial document lab notes. Run the agent hijacking and tool-output injection labs. Understand how untrusted input enters systems through
  3. Days 8 to 11Focus on evaluation, output safety, and cost. Take the Securing AI Agents and MCP course. Work through output validation labs: ai-llm-output-xss-1, ai-text-to-sql-injection-1, ai-tool-arg-command-injection-1. Read the fine-tuning security and multimodal security pieces. Practice sketching evaluation strategies and cost
  4. Days 12 to 14Synthesis and practice. Work through advanced labs you have not yet run: ai-agent-hijack-1, ai-embedding-poisoning-1, ai-role-confusion-1. Answer all 30 practice questions, focusing on reasoning through attack chains and defense layers. Prepare a mental model of your role: you build systems that resist prompt injection

These questions are SecurityElites practice material for this kind of role. They are not taken from any employer, and a real interview may differ.