← Mithril Interview Insights

Mithril·Software Engineer·Onsite - Coding / Algorithms·Senior

Senior
Jul 2026

Summary

Round 4 at Mithril was a debugging exercise, not an algorithm grind. They handed over a small GPU resource manager codebase with logs and failing tests and basically said: figure out what's broken and fix it.

Questions Asked (3)

Q1

Given a small codebase with failing unit tests and logs, identify and fix a bug in the GPU scoring logic where user preferences are not being compared correctly.

Root Cause AnalysisAPI & Integrations
Author's notes

The fix itself was small but finding it took longer than I expected.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by reproducing the failing tests and examining the logs to pinpoint where the GPU scoring logic diverges. Then trace the comparison logic for user preferences, checking for type mismatches, ordering issues, or incorrect operators. Finally, propose a fix, add a regression test, and verify the solution against the original tests and logs.

Pro tip: Before diving into the code, articulate your debugging strategy out loud—interviewers value a clear, methodical approach over immediately spotting the bug. Also, mention that you'd check if the bug is in the comparison logic itself or in the data being compared (e.g., unnormalized preferences).

1. Reproduce and Gather Evidence

Run the failing unit tests and inspect the logs to understand the exact failure conditions and error messages. Identify which test cases fail and what the expected vs. actual outcomes are.

2. Locate the Faulty Comparison

Examine the GPU scoring code, focusing on where user preferences are compared. Look for common pitfalls like using assignment instead of equality, comparing incompatible types, or incorrect ordering of operands.

3. Analyze Root Cause

Determine why the comparison fails: is it a logic error, a data issue (e.g., preferences not normalized), or a misunderstanding of the requirements? Consider edge cases and the intended behavior.

4. Implement and Test the Fix

Apply the minimal correct change to fix the comparison. Add or update unit tests to cover the bug and prevent regression. Run all tests to ensure no new issues arise.

5. Verify and Reflect

Confirm the fix resolves the original failures and aligns with the logs. Briefly explain how you would prevent similar bugs in the future, such as through code reviews or static analysis.

Key Points to Mention

  • Reproducing the bug using the provided tests and logs to confirm the failure.
  • Checking for common comparison errors: using '=' instead of '==', comparing floats without tolerance, or mismatched data types.
  • Validating that user preferences are correctly normalized or preprocessed before comparison.
  • Considering GPU-specific constraints like parallel execution or memory access patterns that might affect comparison logic.
  • Adding a regression test that specifically targets the fixed comparison to ensure it doesn't break again.
  • Communicating the root cause clearly and explaining the fix in simple terms.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Debug a resource allocation and preemption failure caused by a missing GPU lease in the codebase.

Root Cause AnalysisSystem Design
Author's notes

This one tripped me up a bit because I wasn't sure if the lease was supposed to be created somewhere upstream or right in the allocation path.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the symptoms and scope of the failure, then systematically trace the resource allocation and preemption logic to identify where the GPU lease is expected but missing. Propose a fix that addresses the root cause and prevents recurrence, and discuss how you would validate it.

Pro tip: Demonstrate a blameless, data-driven approach: focus on system behavior and logs rather than individuals, and suggest adding observability (e.g., metrics, tracing) to catch similar issues early.

1. Clarify the failure

Ask questions to understand the exact symptoms, when the failure occurs, and what the expected behavior is. Confirm the impact and urgency.

2. Trace the allocation flow

Follow the code path from resource request to GPU assignment, checking where leases are acquired, stored, and released. Identify the point where the lease is missing.

3. Analyze preemption logic

Examine how preemption decisions are made and whether they depend on lease information. Determine if the missing lease causes incorrect preemption or allocation.

4. Identify root cause

Pinpoint the exact condition or code defect (e.g., race condition, unhandled error, missing initialization) that leads to the missing lease.

5. Propose and validate fix

Suggest a code fix, add tests to cover the scenario, and outline how to verify the fix in a staging environment before deployment.

Key Points to Mention

  • Resource allocation and preemption mechanisms in distributed systems
  • Lease management: acquisition, renewal, expiration, and release
  • Race conditions and concurrency issues in resource scheduling
  • Logging, monitoring, and tracing for debugging resource issues
  • Root cause analysis techniques (e.g., 5 Whys, fishbone diagram)
  • Preventive measures: unit tests, integration tests, and canary deployments

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Extend the preemption logic to sort candidates by GPU score before making preemption decisions.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Felt like the most straightforward of the three.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the current preemption logic and the definition of GPU score, then propose a sorting-based extension that orders candidates by GPU score before applying preemption rules. Discuss trade-offs such as sorting overhead, stability, and whether to sort all candidates or only those eligible for preemption.

Pro tip: Mention that sorting by GPU score should be stable to preserve original order for ties, and consider using a priority queue if preemption decisions are made incrementally. Also, highlight the importance of defining GPU score precisely and ensuring it's comparable across candidates.

1. Clarify requirements and assumptions

Ask questions to understand the existing preemption logic, how GPU score is calculated, and whether sorting should be global or per-queue. Confirm if higher GPU score means higher priority for preemption.

2. Design the sorting mechanism

Choose an appropriate sorting algorithm (e.g., comparison-based sort) and data structure (e.g., array, priority queue) based on the frequency of preemption decisions and candidate set size. Consider stability and time complexity.

3. Integrate with preemption logic

Modify the preemption decision function to first sort candidates by GPU score (descending or ascending as needed) and then iterate through them to select preemption targets. Ensure the sorting does not break existing invariants.

4. Analyze trade-offs and edge cases

Discuss performance implications (e.g., O(n log n) sorting per decision vs. maintaining a sorted structure), memory usage, and how to handle ties, missing scores, or dynamic score updates.

5. Propose testing and validation

Suggest unit tests for sorting correctness, integration tests with preemption scenarios, and performance benchmarks to ensure the extension scales.

Key Points to Mention

  • Definition and comparability of GPU score (e.g., higher score = higher priority?)
  • Sorting algorithm choice and time complexity (e.g., O(n log n) vs. O(n) if scores are bounded)
  • Stability of sorting to preserve original order for equal scores
  • Data structure options: sorting on-the-fly vs. maintaining a priority queue
  • Trade-offs: latency vs. throughput, memory overhead, and frequency of preemption decisions
  • Edge cases: ties, missing scores, dynamic score updates, and concurrency

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.