TechSchool
Home / Interview questions / AI engineering / Palantir

Palantir AI Engineer Interview Questions

Short answers to 20 AI engineering questions asked at Palantir.

Questions and answers (20)

Answers are written in plain English and reviewed for technical accuracy. Each answer states the point first, then the reason.

1. Implement a set of shape classes that compute area, then extend them to handle a new shape.

Use a base Shape class with an area method, then add a new subclass for each new shape. Each subclass overrides area with its own formula. This keeps old code unchanged when you add a shape. The tradeoff is more classes to maintain.

class Shape:
    def area(self): raise NotImplementedError
class Circle(Shape):
    def __init__(self, r): self.r = r
    def area(self): return 3.14159 * self.r ** 2
class Square(Shape):
    def __init__(self, s): self.s = s
    def area(self): return self.s ** 2

2. Write a SQL query that joins and aggregates across tables to answer a business question.

Join the orders table to the customers table, then group by customer and sum the order totals. This answers questions such as total revenue per customer. Add a WHERE clause to filter dates before you aggregate.

SELECT c.customer_id, c.name, SUM(o.total) AS revenue
FROM customers c
JOIN orders o ON o.customer_id = c.customer_id
WHERE o.created_at >= '2024-01-01'
GROUP BY c.customer_id, c.name
ORDER BY revenue DESC;

3. Build a function that fetches paginated data from a REST API, handling page size and total-page logic.

Loop over pages until you reach the total page count or get an empty page. Read the page size and total count from the response body. Stop on an empty page to guard against a wrong total.

def fetch_all(url, page_size=100):
    items, page = [], 1
    while True:
        r = requests.get(url, params={'page': page, 'size': page_size}).json()
        items.extend(r['data'])
        if not r['data'] or page >= r['total_pages']: break
        page += 1
    return items

4. Find and fix a double-counting bug in a function that tallies values in a HashMap.

The bug is that the code adds a value twice, often once in a loop and once after it. Count each key exactly once and check the loop bounds. Print the map size and the sum to confirm the total.

def tally(values):
    counts = {}
    for v in values:
        counts[v] = counts.get(v, 0) + 1
    return counts  # one increment per item, no extra add

5. Debug a program that models infection spread across a social graph.

Check the update order first, because in-place updates spread infection within one step. Use two maps, one for the current state and one for the next state. Also confirm that you count each edge once. A common bug is a self-loop that inflates the count.

def step(graph, infected):
    new = set(infected)
    for node in infected:
        for nb in graph[node]:
            if nb not in infected: new.add(nb)
    return new  # read old state, write new state

6. You inherit an 800-line pipeline script from a previous deployment. It's slow and occasionally produces wrong numbers. The original author is gone. Go.

First add logging and tests around the outputs before you change any code. Then profile the script to find the slow part and the wrong numbers. Refactor in small steps and compare results against saved outputs. This costs time up front but prevents silent regressions.

7. Given exports from three customer systems, each with its own customer records, write code to produce one deduplicated set of entities and explain your design.

Normalize each record, then block on a key such as email or name plus zip, then match and merge within each block. Use a stable entity ID and keep a source field for each record. Blocking cuts the number of pair comparisons from N squared to a small set. The tradeoff is that a bad block key can miss true matches.

def dedupe(records):
    blocks = {}
    for r in records:
        key = (r['email'] or '').lower() or (r['name'].lower(), r['zip'])
        blocks.setdefault(key, []).append(r)
    return [merge(g) for g in blocks.values()]

8. Users ask “how many open orders are blocked on a supplier issue?” Plain RAG gets this wrong. Why, and what's the right architecture?

Plain RAG fails because the count needs a live query over structured order data, not a text lookup. The right design routes the question to a text-to-SQL tool over the orders and supplier tables. The model writes the query, the database returns the count, and the model explains the result. Keep RAG for policy text and use the tool for numbers.

9. What is an ontology in the Palantir sense, and why put LLM agents on top of one instead of on raw tables and documents?

An ontology is a typed model of the business objects, their links, and the actions allowed on them. LLM agents work better on this model because each object has a clear name, schema, and permission rule. Raw tables and documents force the agent to guess meaning and joins, and that guess causes errors. The ontology also gives the agent a safe action list, so a write becomes a defined operation and not free text.

10. Design an LLM agent that files and updates work orders in a customer's ERP: real writes to a production system. How do you make that safe?

Make every write a two-step action with a dry run, a policy check, and a human approval for high-risk changes. The agent proposes a typed work order change, and a validator checks the schema, the permissions, and the business rules before any write. Use an idempotency key and a full audit log, so a retry cannot create a duplicate order. Start with read-only access and add write scopes one at a time.

11. Your platform must support multiple LLM providers, including deployments in restricted environments where only some models are available. How do you architect model selection?

Put a model gateway between the application and the providers, and select the model from a policy, not from hard-coded names. The policy maps each task to a capability level, a latency budget, a cost cap, and a data-residency rule. The gateway reads a model registry that lists which models exist in each environment. A fallback chain handles a missing model, and a test suite checks that each task still passes on every allowed model.

12. How do you evaluate an LLM workflow before and after giving it access to production operations?

Build a fixed evaluation set with real tasks, expected outputs, and a scoring rubric, and run it before and after you grant production access. Before access, measure task accuracy and refusal quality on recorded data. After access, add checks for side effects, such as wrong writes, duplicate actions, and permission errors. Track a small set of numbers over time, for example task success rate and unsafe action rate.

13. A freight rail operator loses tens of millions a year to unplanned locomotive downtime. Decompose this into an engineering plan.

Start with the data path, because downtime prediction needs clean sensor and maintenance history joined to each locomotive. Build a failure taxonomy and label past events, then train a model for remaining useful life and rank the causes. Add a planning layer that turns a risk score into a maintenance slot, a parts order, and a crew schedule. Measure the plan in money saved per month and in false alarms per locomotive.

14. Design a system to improve traffic in NYC.

Treat the city as a network of sensors and signals, and start with one corridor, not the whole city. Collect loop detector, camera, and transit data, then build a short-horizon demand and queue model. Use the model to tune signal timing and to test policies in simulation before a live change. Report results as travel time and delay per corridor, and keep a human operator in the loop.

15. Design a sync system between two employee record systems.

Use one system as the source of truth for each field, and sync changes as events with a stable record ID and a version number. Each side keeps a mapping table and an outbox, so a change is sent once and retried safely. Resolve conflicts with a field-level rule, for example the latest write wins or the HR system wins for job title. Run a nightly reconciliation job and alert on any record that does not match.

16. Design a system that lets multiple teams query a shared dataset without exposing raw data.

Give each team a governed query layer, and let the data stay in the warehouse with row and column policies. Teams submit SQL or a saved query, and a policy engine rewrites it to filter rows and mask columns before execution. Return only aggregates or approved columns, and log every query with the user and the purpose. For model training, use a privacy method such as differential privacy or synthetic data, and never export raw rows.

17. Design an application to catalog and log species while exploring an unfamiliar environment.

Build an offline-first mobile app with a tokenizer-based text search and a small on-device model for photo suggestions. The app stores each sighting with a timestamp, GPS point, photo, and a species label. The model proposes a label and a confidence score, and the user confirms or corrects it. Corrections go into a review queue that syncs when the network returns.

18. A customer executive says “the AI keeps getting things wrong” and wants to cancel the pilot. Walk me through your next 48 hours.

I first collect concrete failure cases and measure the error rate before I discuss the contract. I meet the executive within 24 hours and show the top three failure modes with examples. Then I propose a short fix plan with clear success metrics and a review date. I do not promise a full fix in 48 hours.

19. Why Palantir, and why this team? Tell me about a time you pushed back on a customer request.

I want to work on hard data problems where the output reaches real operators, and this team owns that path end to end. In one case a customer asked for a real-time dashboard, but the data arrived once per day. I showed the latency numbers and proposed a batch report instead. The customer accepted the batch report and the project stayed on schedule.

20. Palantir works with defence and intelligence agencies. How do you think about that, and what would you do if asked to build something you're uncomfortable with?

I accept that defence and intelligence work needs careful engineers. I join only if the mission and the rules of engagement are clear to me. I ask for the legal and policy basis of each task before I start. If a task conflicts with my values, I raise it with my manager and the ethics contact. I decline the task and ask for a different assignment.

Related lessons
Ai agent intro Ai agent function calling Agent architecture Ai rag Retrieval augmented generation Vector database