esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • AI papersPages
  • Interview KitPages
  • Book a callContact
Letโ€™s talk

Iโ€™ll build the agent for it.

Design Explanations for Recommendations

How to design the why behind a recommendation so it is true, useful and easy to check, explained simply for your AI interview.

In short

Show the real reason a recommendation was made, taken from the signals the system logged, and say when a business rule moved the item. A reason written after the fact can sound right and still be wrong.

12 min readIntermediateOccasional ยท estimateFacts checked 27 November 2026

Say it out loud

Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.

When a recommender suggests an item, I build the reason from the signals it actually used: past orders, similar parts, or a promotion that moved the item up. I save those reasons while the system runs, and the text reads from that log. I don't ask a model to invent a reason afterwards, because it can sound right and still be wrong. The user should also see when a rule changed the order.

What is a recommendation explanation, in plain words?

A recommender is software that picks items for a person. On a plant's reorder page, it decides which spare parts appear first. Google's machine learning course says recommendation models work by "analyzing similarities between items and past user interactions to suggest relevant content". A recommendation explanation is the short line beside an item that says why it was picked, such as "Ordered 4 times by your plant this year."

Picture a senior buyer at a spare-parts store. A site manager asks why she stocked a gate valve. She pulls up the orders and the sales that led to it. A good explanation works the same way: it points to the records the system really used.

Key words

Candidate
An item the system thinks might fit, before the final order is set.
Ranker
The model that gives each candidate a score.
Re-ranking rule
A rule that moves, boosts or drops items after scoring, such as a discount or a stock check.
Post-hoc explanation
A reason worked out or written after the decision, rather than built into the model.
Logged reason
A reason the system saves while it runs, so it can be checked later.

How does a recommendation get its reason?

Most recommenders work in stages. Google's course says "Candidate generation is the first stage of recommendation." Given a query, the system builds a set of relevant candidates. One common way is content-based filtering, which recommends items similar to what the user likes. A second common way is collaborative filtering, which uses similarity between users and items. Its example is simple: if user A is like user B, and user B likes a video, the system can suggest that video to user A.

Next, the ranker scores the candidates. Last come the re-ranking rules. The course describes that final stage as "In the final stage of a recommendation system, the system can re-rank the candidates to consider additional criteria or constraints." That is where a discount or a stock check changes the order, and where an explanation can drift from the truth.

Where the reason comes from

Signals the log saves

Past orders

what this plant bought

Similar parts

same use and similar size

Ranker

scores each candidate

Re-ranking rules

Promo boost

a rule moves an item up

Stock check

drops items not in stock

Reason shown

built from the same log

  1. 1Past orders go to the ranker, which scores each candidate.
  2. 2Similar parts go to the ranker as well.
  3. 3The scored list then passes through the re-ranking rules.
  4. 4The reason shown is built from what the log saved.
Two signals feed the ranker, which scores the candidates. Re-ranking rules can then move or drop items. The reason shown is built from the log of all of it, so the text matches what happened.

A worked case, with made-up numbers. A plant's reorder list covers 180,000 part numbers. For a 6204 bearing, the ranker sees four orders from this plant in the past year, so the score is high. For a 2-inch gate valve, it sees similar parts the team saved, so the score is medium. Then a supplier discount is set to end on Friday, and the promo rule moves the valve to the top. The line for the valve must name the discount, not only the saved parts. "Moved up: a supplier discount ends Friday." tells the truth about both.

Where should the reason come from?

There are two ways to write the line. The first reads the reasons the system saved while it ran. The second asks a language model to write a reason after the decision. NIST says that "Explainability can answer the question of "how" a decision was made in the system." So the first way is the one that can be checked.

  • Read from the log

    Matches what happened

    The text is built from the reason codes the system saved. It can only say what those codes record, so the codes must be true to how the ranker works.

  • Written after

    Sounds right, may be wrong

    A model writes a believable story from the item and the question. Nothing checks it against the ranking.

Two ways to write the reason

Logged reasons

saved while the system runs

Model writes a story

written after the decision

Matches the ranking

can be checked against the log

Sounds right, may not be

no record behind the claim

  1. 1The text is read from the saved codes, so it matches the record only if the codes are true.
  2. 2The model writes a reason with no record behind it.
A logged reason can be checked line by line against the record. A model's story can sound right while the real cause is something else.

A survey of explainable recommendation says explanations may be post-hoc or come from a model built to be read. It also says explanations help transparency and trust, and help designers debug the system. NIST adds that explainable systems can be debugged and monitored more easily.

  • โ€œExplainable recommendation tries to address the problem of why: by providing explanations to users or system designers, it helps humans to understand why certain items are recommended by the algorithmโ€

    Survey on explainable recommendation (arXiv)

  • โ€œRisk from lack of explainability may be managed by describing how AI systems function, with descriptions tailored to individual differences such as the user's role, knowledge, and skill level.โ€

    NIST AI Risk Management Framework

So one reason can come at two depths: one clear line for a planner, and the full log entry for an auditor.

Tip

Asked to design this? Say the reasons come from logs, name any rule that moved an item, and tailor the depth to who reads it. Don't promise that the model knows its own mind.

How do you check that a reason is true?

Test the text, not the model's mood. For a sample of recommendations, compare each line shown with the log for that item. Here is a small made-up version. The text is built only from logged codes, and a rule that moved an item always appears in the line.

  1. 1

    Log every reason

    Save the reason codes, and any rule that changed the order, at the moment of the decision.

  2. 2

    Build the text from the log

    Each line is a lookup from a logged code. Nothing is written freely.

  3. 3

    Sample and compare

    Each week, pull a random set of recommendations and check every line against its log.

  4. 4

    Re-check after changes

    After a model update or a new rule, run the same check again, because old wording can stop matching.

Python
# A made-up reorder list for a plant. Each reason text comes only from
# the reasons the ranker logged, so the line can't name a cause it never used.
LOG = [
    {"item": "6204 bearing", "reasons": ["ordered_4x"], "rule": None},
    {"item": "2-inch gate valve", "reasons": ["similar_saved"], "rule": "promo_ends_friday"},
]
TEXT = {
    "ordered_4x": "Ordered 4 times by your plant this year.",
    "similar_saved": "Similar to parts your team saved.",
    "promo_ends_friday": "Moved up: a supplier discount ends Friday.",
}

def explain(entry):
    lines = [TEXT[code] for code in entry["reasons"]]
    if entry["rule"]:
        # A rule that moved the item must be named, never hidden.
        lines.append(TEXT[entry["rule"]])
    return " ".join(lines)

for entry in LOG:
    print(entry["item"] + ": " + explain(entry))

Output

6204 bearing: Ordered 4 times by your plant this year.
2-inch gate valve: Similar to parts your team saved. Moved up: a supplier discount ends Friday.

NIST notes that explainable systems can be debugged and monitored more easily, and that they lend themselves to more thorough documentation, audit and governance. That is why the log is worth the storage.

How would you explain recommendations to a buyer who doesn't trust them?

Start with the buyer's question, not the model. A buyer who has been caught by a wrong suggestion wants two answers: did the system use my history, and did someone pay to move this item? Answer both on the line itself.

  1. 1

    Name the record

    Show the order count or the similar part that counted, in plain words.

  2. 2

    Name the rule

    If a discount or a stock rule changed the order, say so in the same line.

  3. 3

    Offer the detail

    Give a link to the full log entry, for the buyer or an auditor who wants it.

  4. 4

    Let them push back

    A 'this looks wrong' button sends the case to a person, and the answer feeds the next check.

Explanations carry risk too. A line can reveal private data, such as one person's browsing on a shared account. Limit what each line shows to what that reader should see.

What does the interviewer want to hear?

A strong answer covers

  • A plain definition: the short line that says why an item was shown.
  • Where the reason comes from: logged signals, not a guess.
  • The stages: candidates, then ranking, then re-ranking rules.
  • Naming any rule that moved an item.
  • Two designs, and why the logged one is easier to trust.
  • A test that checks each reason against its log.

Common traps

  • Trap"The model can tell you its own reason."

    BetterIt can write a reason, but that is a guess unless the text is built from logged signals.

  • Trap"If nothing is logged, make up a plausible reason."

    BetterShow a plain line or none. An invented reason breaks trust the first time someone checks it.

  • Trap"More detail is always more trustworthy."

    BetterMatch the depth to the reader. A planner needs one line; an auditor needs the log entry.

Can you spot the wrong reason?

Spot the wrong reason

The log for a gate valve shows similar parts, then a supplier discount that moved it up. Which reason line is wrong?

Quick check

Your recommender explains each pick. Which change makes the explanations more trustworthy?

Can you answer these from memory?

Flash cards ยท tap a card to flip it

1 / 6

What will they ask next?

  1. Q467How explainable are LLMs?11 min
  2. Q463Auditability and audit logs?11 min
  3. Q247Offline vs online evaluation?11 min
  4. Q258How do you A/B test an LLM feature?12 min
  5. Q126Rerankers: cross-encoder vs bi-encoder?12 min

Learn it in depth

Last updated on 27 November 2026

Building a recommender or a reorder tool your team has to trust?

I design and build AI products and agents, including the screens and the system behind them. Book a short call and tell me what the recommendations need to explain.