Cohere interview questions
AI startup · 7 questions reported
- junior 1
- mid 3
- senior 3
These are 7 technical questions candidates reported being asked in Cohere interviews for AI engineer, ML engineer and applied AI engineer roles, each with a model answer you can say out loud in a minute or two. They cover fine-tuning & alignment, sampling, hallucination and rag: 1 junior, 3 mid-level and 3 senior questions. Every question comes from a public interview write-up that names Cohere.Updated
Cohere next-token prediction and sampling questions
Model answer
Temperature divides every logit by T before softmax: low T sharpens, high T flattens, and T near 0 approaches greedy. Top-k keeps a fixed number of top tokens; top-p keeps the smallest set whose probabilities reach p, so the cut adapts to the distribution's shape.
At top-p 0.9, GPT-2 kept 1 token after "Thank you very" but 417 for an open-ended prompt. No single k suits both: Holtzman et al.'s argument.
Model answer
Greedy takes the argmax. Both samplers sort the probabilities, keep a prefix, renormalise it and sample.
import numpy as np
def softmax(z):
e = np.exp(z - z.max())
return e / e.sum()
def pick(logits, rng, mode="greedy", k=5, p=0.9,
temp=1.0):
if mode == "greedy":
return int(np.argmax(logits))
probs = softmax(logits / temp)
order = np.argsort(probs)[::-1] # high to low
if mode == "top_k":
keep = order[:k]
else: # top_p
cum = np.cumsum(probs[order])
keep = order[:np.searchsorted(cum, p) + 1]
q = probs[keep] / probs[keep].sum()
return int(rng.choice(keep, p=q))
Interviewers check the max subtracted in softmax, that top-p keeps the token that crosses p, and the renormalisation before sampling.
Cohere hallucination and limits questions
Model answer
The model doesn't know today's date, so tell it: put the date and the training cutoff in the system prompt.
Then train the behaviour. Fine-tune on questions about things that change, like recent events or latest versions, with answers that give what held at the cutoff and flag it may be stale, or call search. Include stable questions so it doesn't over-refuse. Evaluate on dated questions either side of the cutoff.
Cohere retrieval-augmented generation questions
Model answer
Make citation part of generation, not decoration. Retrieve with hybrid search and a reranker, respecting document permissions, and give each passage an id. Have the model write claim by claim, each with the supporting span as structured output.
Then verify every claim: an entailment model or judge checks it against its cited span, and unsupported claims are dropped or flagged. Show citations as quotes that open the source. Evaluate citation precision and recall: is each claim supported, and is each citation needed?
Scroll sideways to see the whole diagram
Search your own documents for passages related to the question, with keywords, embeddings or both.
Text version
- Search your own documents for passages related to the question, with keywords, embeddings or both.
- A reranker reads the question with each candidate and keeps the few that actually answer it.
- The kept passages go into the prompt, with instructions to answer only from them.
- The model answers from evidence in its context instead of memory alone, so the answer can be checked against its sources.
The pattern of Lewis et al. (2020), Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks, as used in production systems.
Cohere fine-tuning and alignment questions
Model answer
Start with the target: an execution-based eval built from the customer's real tasks, with unit tests that pass or fail, plus public coding benchmarks to catch regressions.
Data: their repositories, internal libraries and review history, scrubbed of secrets, plus synthetic tasks kept only if they run. Then stages: continued pretraining on their code if it's unusual, SFT on instruction and solution pairs, then RL from execution feedback or DPO on passing versus failing samples. Gate every stage on the eval and watch for forgetting. LoRA adapters keep many customers on one base.
Model answer
Pretraining learns language and knowledge by next-token prediction on trillions of tokens, most of the compute. SFT trains on curated prompt-response pairs so the model follows instructions and a format. Then preference or RL training goes beyond imitation: RLHF with a reward model, DPO on preference pairs, or verifiable rewards for maths and code.
Evaluation runs throughout: loss and benchmarks, then instruction-following, safety and preference scores, so no stage undoes the last.
Scroll sideways to see the whole diagram
RLHF: fit a reward model to human preferences, then optimise the policy against it with reinforcement learning.
Text version
- RLHF: fit a reward model to human preferences, then optimise the policy against it with reinforcement learning.
- DPO: one supervised-style loss on the same pairs. No reward model, no sampling loop, far fewer moving parts.
Ouyang et al. (2022), Training language models to follow instructions with human feedback; Rafailov et al. (2023), Direct Preference Optimization.
Model answer
First measure: a domain eval with checkable answers, and read the failures to tell missing knowledge from bad reasoning. Missing facts call for retrieval, not training.
Cheap wins next: chain-of-thought with worked domain examples, and self-consistency, sampling several chains and voting. If that isn't enough, train: SFT on reasoning traces from experts or a stronger model, kept only when the answer is correct, then RL with verifiable rewards, as in GRPO. Watch for reward hacking and chains that grow without getting better.
Each question comes from a public interview write-up or video that names Cohere; the answers are ours. Not affiliated with Cohere.