What they’re really asking
If you only remember one thing, say this in the first minute: “Once I know one good node, testing it paired with any other node is the same as testing that other node alone. So round one splits all nodes into disjoint groups and tests them; every node in a passing group is good. From round two on, I pair each suspect with a different known-good node. With 1,024 nodes and 4 bad, groups of 32 find all of them in 160 tests and 2 rounds. The problem is only solvable if at least two nodes are good, and if tests are flaky I condemn a node only after it fails with several different good partners.”
The rest of this page explains each part of that answer.
This is a coding question with an infrastructure story. The algorithm is short. What the interviewer listens for is the one insight that makes it short, and whether you can then reason about cost, edge cases and flaky tests.
What makes this different from a normal search problem
If you could test one node at a time, this would be trivial: test every node, done. The rules take that away.
- A test needs at least two nodes. Think of a test as a short burn-in that sends data between GPUs on different machines. It needs at least two machines to mean anything.
- A test only says “something in here is bad”. It fails if any node in the group is bad, and it doesn’t say which.
- Tests that run at the same time can’t share nodes. A node can only be in one burn-in at once. One batch of simultaneous tests is called a round.
In production this is how a GPU cloud finds faulty machines after a bad batch of hardware or a failed job: run group tests, narrow down, pull the bad nodes. Each round may take minutes, so the number of rounds matters as much as the number of tests.
PracHub lists this as an xAI Machine Learning Engineer onsite question, posted 2026-09-05; the follow-ups on the page are PracHub’s own write-up (PracHub).
The problem as stated
You have n nodes, some of them bad. test(S) fails if any node in S is bad. Every test needs at least two nodes,
and tests in the same round can’t share nodes. Implement find_bad_nodes(n, run_tests), where run_tests runs one
round of disjoint tests. Follow-ups: few bad nodes, flaky tests, test time that grows with group size, and running
it continuously in production.
Clarify first
- What counts as efficient? “Fewer rounds, fewer total tests, or both? In production I’d guess rounds, because each one is a burn-in that takes minutes.”
- How many bad nodes do we expect? “I’ll assume they’re rare, say 4 of 1,024, and handle the common case too.”
- Is at least one good pair guaranteed? “If not, I need an error case.”
- May a round leave nodes idle or mix group sizes? “I’ll assume yes.”
Answer
The insight
Say it like this: “Once I know a node g is good, the test on the pair (g, x) passes exactly when x is good. A known-good node turns a group test into a single-node test.”
So the plan has two phases: find good nodes fast, then use them as probes.
The algorithm
- Round 1. Split all nodes into disjoint groups of size k (k is at least 2) and test them all at once. Every node in a passing group is good.
- Later rounds. Test each remaining suspect x as the pair (g, x), with a different known-good g for each test, because tests in a round can’t share nodes. Each round resolves as many suspects as you have good nodes.
- If no group passed in round 1, pair up the suspects and retest until one pair passes. That pair gives you two good nodes, and step 2 takes over.
Follow one sweep: 1,024 nodes, 4 bad
Here are three ways to choose round 1, with the same fleet.
| Round 1 groups | What round 1 leaves | Tests | Rounds |
|---|---|---|---|
| Pairs: 512 tests | At most 4 fail, so at most 8 suspects and at least 1,016 good nodes. Round 2 runs 8 probes. | 520 | 2 |
| Groups of 32: 32 tests | At most 4 fail, so 128 suspects and at least 896 good nodes. Round 2 probes all 128 at once. | 160 | 2 |
| Binary splitting: halve each failing group and retest | Narrows each bad node down by halving | about 32, plus a few | about 10 |
The theoretical minimum, from counting how many possible answers there are, is about 35 tests. Binary splitting gets close to it, but it needs about ten rounds instead of two.
The arithmetic behind the numbers (for a Staff-level follow-up)
- Information bound: there are C(1,024, 4) possible sets of 4 bad nodes, and each test answers one yes/no question, so you need at least log₂ C(1,024, 4) ≈ 35.4 tests (group testing).
- Binary splitting: about d × log₂(n ÷ d) = 4 × log₂(256) = 32 tests, plus a few, in about log₂ n = 10 rounds.
- Groups of 32: 1,024 ÷ 32 = 32 tests in round 1; 4 failing groups × 32 = 128 suspects; 128 probes in round 2; 32 + 128 = 160.
- Pairs: 512 tests; 4 failing pairs × 2 = 8 suspects; 512 + 8 = 520.
Which scheme to pick
It depends on what a round costs.
- Long tests (a burn-in that takes minutes): wall-clock time is set by the number of rounds, so the two-round schemes win.
- Cheap tests and scarce GPUs: total tests matter more, so binary splitting wins.
- Bad nodes are common: big groups almost all fail and teach you nothing, so start with pairs.
- Test time grows with group size: smaller groups in round 1 keep the round short.
Say it like this: “I’d pick groups of 32 for a rare-failure fleet with slow burn-ins: two rounds, 160 tests. If failures are common I’d start with pairs.”
Correctness, and when it can’t be solved
Every node ends up either in a passing group (good) or probed alone with a good partner. So every answer is exact.
The edge case to say out loud: the bad set is identifiable exactly when at least two nodes are good. With one or zero good nodes, every test fails, and “everyone is bad” can’t be told apart from “everyone but one is bad”. Return that case as an error rather than guessing.
Flaky tests
Real burn-ins sometimes fail for no reason. So condemn a node only after it fails several probes, each with a different good partner. With a 5% false-failure rate and three required failures, a good node is wrongly condemned about once in 8,000 times, which is about 0.13 nodes per 1,024-node sweep.
Rotate partners, and the network switches they sit under, because a flaky link between two machines looks exactly like a flaky node.
The arithmetic behind the numbers (for a Staff-level follow-up)
With an independent false-fail rate q = 0.05 and m = 3 failures required, a good node is wrongly flagged with probability q^m = 0.05³ = 1.25 × 10⁻⁴. Across 1,024 nodes that is 1,024 × 1.25 × 10⁻⁴ ≈ 0.13 nodes per sweep.
Running it continuously in production
Test idle nodes between jobs, never nodes running work. Keep a health score per node that decays over time, so an old failure counts less than a new one. Send repeat suspects to a full re-qualification run instead of probing them forever. Nodes joining and leaving just change who is eligible for the next round.
Senior vs Staff
Group testing
Senior
- Finds the known-good-probe insight, implements two-round schemes and counts tests and rounds.
Staff
- States the identifiability condition, handles flakiness with partner rotation, and chooses the scheme from what a round costs in production.
In plain words: a Senior answer finds the trick and counts correctly. A Staff answer also says when the problem has no answer, survives flaky tests, and picks the scheme from what a round costs.
Small-team version
You won’t run fleet-wide group tests. The idea transfers, though: when a multi-GPU job fails, bisect the GPUs with short tests rather than restarting the whole job and hoping.
The money is why. Each hour an 8×H100 job sits on a bad GPU costs about $32 at Together’s on-demand cluster price of $3.99 per GPU-hour (8 × $3.99, fetched 2026-10-11). A DCGM r1 check (NVIDIA’s quickest built-in GPU diagnostic) takes under 2.5 seconds per node.
Default: let the provider find and replace bad nodes. You report the failing GPU with its logs.
Say it like this: “At our size, the useful habit is bisecting a failed job’s GPUs with short tests, not restarting and hoping.”
Pitfalls
- Testing single nodes. The rules forbid it; the whole point is to get the same effect with a good partner.
- Reusing a good node in two tests in the same round. Tests in a round can’t share nodes.
- Ignoring the all-bad and one-good cases. With fewer than two good nodes there is no answer, and the code should say so.
- Treating one failure of a flaky test as proof. Require several failures with different partners.
Go deeper
- Family walkthrough: group tests deep dive.
- Related ECC pipeline: question infra-013.