Agentic LLM Design Choices: Multi-Agent, RAG vs Regex, Long Context, Context Assembly
Company: Apple
Role: Machine Learning Engineer
Category: Machine Learning
Difficulty: hard
Interview Round: Onsite
The first half of this round was a series of short design questions about building agentic applications on large language models (LLMs). The report lists the following as examples of the kind asked, so expect others like them. Answer each with a clear rule of thumb, the trade-off behind it, and a concrete example.
### Clarifying Questions
- Is there a particular product in mind, such as an assistant over internal documents or an agent that takes actions in other systems, or should the answers be general?
- Are there cost or latency limits per request that should shape the answers?
### Part 1: When to use multiple agents
When should an application be split into several cooperating agents instead of one agent with a set of tools? When is a single agent the better choice?
```hint Count what differs
Consider what would actually differ between the agents: their tools, permissions, models or context. If nothing differs, ask what the split buys.
```
#### What This Part Should Cover
- Concrete signals that justify more than one agent
- The costs of multiple agents in latency, tokens, coordination and debugging
- Common multi-agent patterns, and an example of each choice
### Part 2: RAG versus regex
Compare retrieval-augmented generation (RAG) with regular expressions. For which tasks is each the right tool, and when would you combine them?
```hint Exact or semantic
Think about whether what you are looking for has a fixed shape you can write down, or is defined by meaning that can be phrased in many ways.
```
#### What This Part Should Cover
- Where deterministic patterns win, and why
- Where retrieval wins, and what it costs
- Hybrid designs that use both, with an example
### Part 3: Handling long context
How do you handle inputs or conversations longer than the model can use well, whether they exceed the context window or only make calls slow, expensive or less accurate?
```hint Not everything at once
Ask which parts of the long input the current step actually needs, and what could be stored and fetched instead of carried in every call.
```
#### What This Part Should Cover
- Why long context hurts even when it fits in the window
- The main techniques and the information each one risks losing
- How to choose among them and evaluate the result
### Part 4: Context assembly
How would you assemble the context for each model call: what goes in, in what order, and how do you decide what to keep when the token budget is tight?
```hint List the ingredients
Write down every source that could go into a call and give each a priority and a budget before thinking about order.
```
#### What This Part Should Cover
- The sources of context and how each is selected and compressed
- Ordering and formatting choices, including caching and the handling of untrusted text
- Budgeting, deduplication, provenance, and how to tell whether assembly is working
### What a Strong Answer Covers
- Choices driven by the task, with explicit criteria rather than enthusiasm for a technique
- Cost, latency and reliability weighed in every answer
- A concrete example for each part
- Evaluation as the way to settle each choice
- Awareness of failure modes such as coordination loops, retrieval misses, lost details and prompt injection
### Follow-up Questions
- Your multi-agent system is slower and no more accurate than a single agent. How do you find out why?
- Retrieval returns the right document, but the answer is still wrong. Where do you look?
- A conversation has run for hours. What exactly does the model see on the next turn?
Overview: Short design questions on building agentic LLM applications: when to split work across multiple agents, when retrieval-augmented generation beats regular expressions, how to handle long context, and how to assemble each model call's context. It tests practical judgment about cost, reliability and trade-offs.
Read the full Apple Machine Learning Engineer interview experience this question came from