InterviewLegend

LLM Inference From Scratch

Alex Chen50 min readUpdated 19 real interview reports

Most xAI coding rounds ask you to build a class and then extend it. Machine learning and infrastructure loops sometimes swap that for a piece of a model server, the kind of code that serves a model like Grok. The pieces candidates describe are the parts of an inference stack, from turning text into tokens to deciding what runs on each step. If you're interviewing for one of those roles, work through all five. On a product or backend loop, one of the five is the one to know, since it has come up for general software candidates too.

None of these needs a framework. You write plain loops over lists of numbers or token IDs, so the work is in getting the logic right. Most bugs sit in one edge case, like a slot that frees up partway through.

After the code works, the conversation usually moves to memory use and speed, so know the cost of each step you wrote. Of the five problems below, one comes up far more than the others.

xAIPremium lesson · Coding round

The 5 xAI problems are below.

  1. A Premium questionCoding · Medium · Signature problem
  2. A Premium questionCoding · Medium
  3. A Premium questionCoding · Medium

+ 2 more in this lesson

Each with hints, the follow-up and a tested solution.

Get the xAI questions

$49 a year · all 100 companies · cancel anytime

From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.

Had your xAI interview?Tell us what they asked. Reviewed before it goes in, never with your name.
xAI interview guide

Know what xAI asks before you walk in.

25 coding · 2 system design · 15 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.