Skip to content
Tech Interview Prep

Real Interview Questions for the AI / ML Engineer at Accenture

New

Interview Q&A

16 questions · Flow follows Relevance until this set has a learning order.

Q&A-1Why retrieval-augmented generation instead of fine-tuning a model on the same data?

Reported in Accenture AI Engineer Interview Guide 2026: Process & Questions

The 90-second answer

The two approaches put the data in different places. Fine-tuning writes the data into the model's weights, so the model can only recall it from training. Retrieval-augmented generation (RAG) keeps the data in an index and fetches the relevant passages at query time, so the model answers from text it can see and cite. For a client corpus that changes, needs citations, or has per-user access rules, RAG is the default. Fine-tuning earns its place when the problem is behaviour rather than knowledge: output format, tone, a tool-call schema, or domain phrasing.

Before I pick, I'd ask three things: how often the source changes, whether answers must be traceable to a document, and whether access differs by user.

Why fine-tuning on the same data falls short for knowledge

A fine-tuned model learns patterns from the training snapshot. It has no reliable index of which document a fact came from, so it cannot cite. A stale policy stays in the weights until you retrain. Fine-tuning also does not stop hallucination: the model can produce a fluent, confident clause that was never in the corpus, and nothing in the output tells you.

RAG changes the failure surface. A wrong answer usually means one of three measurable things: the retriever missed the right chunk, the chunk was there but the model ignored it, or the index was stale. Each has its own metric.

ConcernFine-tune on the corpusRAG
FreshnessRetrain to updateRe-index the changed document
CitationNot available by defaultChunk id and document version per answer
Per-user accessNeeds separate models or data partitionsFilter at retrieval with the caller's ACL
Deleting a documentRetrain; the data may persist in weightsDelete the chunks
Style, format, schemaStrongWeak; prompt and examples help
Latency per queryLower; no retrieval hopHigher; retrieval plus longer prompt

Worked trace (hypothetical figures)

Query: "What is the notice period for contractor termination under MSA v3?" The retriever returns five chunks, each tagged with doc=msa_v3, section=9.2, indexed=2025-06-02. The answer quotes section 9.2 and links the chunk id. If the MSA is revised to v4 on Monday and re-indexed that day, the next query returns v4 with no retraining. A fine-tuned model would keep giving the v3 number confidently, with nothing to show where it came from.

Failure modes to name

  • Chunk boundaries split a clause from its exception. Detect by evaluating retrieval recall@5 on a labelled question set, not by reading a few answers.
  • Stale index after a source update. Detect with a freshness check that compares source checksums to index metadata.
  • Access leakage if the ACL filter runs after the top-k cut, so a restricted document is never returned but the query still ranks against it. Filter before ranking.
  • Prompt injection inside a retrieved document. Treat retrieved text as data, and keep tool permissions separate from the context.

When not to use RAG

If the corpus is small, static and fits in the context window with caching, put it in the prompt and skip the retrieval stack. If the task is to write in a house style or call internal APIs reliably, fine-tune or use few-shot examples. In practice I'd often combine them: fine-tune for format and tool use, retrieve for facts.

I would validate the choice with a recall@k test and a faithfulness check against the cited chunks before comparing it with a fine-tuned baseline on the same questions.

Curated: · Written: · Reviewed:

Q&A-2How does the design keep the model from making things up?

Reported in Accenture AI Engineer Interview Guide 2026: Process & Questions

The honest starting point is that the design cannot stop a model generating fluent text it has no basis for. What it can do is make unsupported text fail a check before a user sees it. I'd first confirm the setting, which I'll assume is a question-answering assistant over a client's policy documents, and ask what a wrong answer costs, because that decides how aggressive the abstain path needs to be.

Three layers do the work. First, the model never answers from memory. Retrieval returns the top-k chunks with stable source ids, and the prompt tells the model to answer only from those passages, cite each claim as [doc_id:chunk_id], and return status: insufficient_context when the passages don't contain the answer. Temperature 0 makes outputs reproducible for evaluation, but it does not prevent fabrication on its own.

Second, a verifier runs after generation. Split the draft into atomic claims, then check each claim against the chunk it cites, using an NLI model or a second judge model with a fixed rubric. Any claim without entailment support is removed, and if the core claim is removed the whole answer is withheld.

Third, a retrieval threshold gates generation. If the best reranker score is below 0.35 (a hypothetical value, calibrated on a labelled set of 300 questions), the service skips generation and returns the abstain response. Trace: a user asks for the notice period in the Northwind contract. Top reranker score is 0.21, so the response is insufficient_context and no tokens are generated. A later query scores 0.78, the model answers with two citations, the verifier confirms both, and the answer ships with its sources attached.

Measure it instead of asserting it. Keep a golden set of 300 questions with known answers, 60 of them unanswerable from the corpus. Track citation precision, claim-level faithfulness from the verifier, and abstain rate on the unanswerable set. In production, watch user-reported errors per 1,000 answers and sample passed answers for human review each week.

The failure modes I'd name first: retrieval returns a topically close chunk from a superseded document version, so the answer is grounded and still wrong. Fix that at retrieval by filtering on document version and effective date, not by hoping the prompt handles it. The second is verifier false negatives, which silently drop correct answers; a rising abstain rate on answerable questions is the signal.

The limit to state plainly: grounding shows the answer matches a source, not that the source is true, and the model can still misread a passage it cites correctly.

Curated: · Written: · Reviewed:

Q&A-3What is RAG and how did you use it in your project?

Reported in Accenture Interview Experience for LLM Operations Engineer

The 90-second answer

RAG means the model answers from text fetched at query time, not from its weights alone. Offline, you split the source documents into chunks, embed each chunk, and store the vectors in an index. At query time you embed the user's question the same way, retrieve the top k chunks, and place them in the prompt with an instruction to answer only from them and cite chunk IDs. The model reads and synthesises. The retrieval step decides what it is allowed to see, so most RAG failures are retrieval failures, and that is where I'd spend my debugging time.

In my project I built an internal policy assistant for an HR team (example figures, adapt to your own work): about 4,200 documents, 61k pages, PDFs plus wiki exports.

StageChoiceFigure
ParsingLayout-aware PDF extraction, tables kept as markdown61k pages
Chunking512 tokens, 64-token overlap, split on headings first~38,000 chunks
Embedding1536-dim embedding model~38k vectors, ~230 MB as float32
Indexpgvector HNSW, m=16, ef_construction=64p95 retrieval 35 ms
RetrievalHybrid: vector top 20 + BM25 top 20, fused with reciprocal rank fusion, keep 8recall@8 0.81 to 0.91
GenerationHosted chat model, grounded prompt, ~3k tokens incitations to chunk IDs

Trace. Query: 'How many days of adoption leave apply in the UK entity?' Vector search alone ranked a 2021 handbook chunk first, because it was the closest wording match. The BM25 leg found the 2024 section by its exact clause code. Fusion put the 2024 chunk into the top 8. A metadata filter on effective_date then dropped the stale chunk before it reached the prompt. The answer cited chunk 14, section 6.3.

Decisions I'd defend.

  • Hybrid search, not pure vectors. Policy clause codes like HR-7.2 embed poorly, and exact-match recall fixed most misses.
  • Access control applied inside the index query, not after generation. Filtering after generation leaks text the user should never see, even if the answer is then withheld.
  • Chunk size is a trade-off. Smaller chunks raise precision but split tables and cross-references. Headings-first splitting kept most policy clauses intact.

Failure modes and how I caught them.

  • Retrieval miss: the right chunk is not in the top 8. I measured recall@8 on 200 labelled question and gold-chunk pairs, and tracked it on every index rebuild.
  • Stale sources: retrieval returns superseded text. Caught by checking the effective-date filter in the eval set.
  • Context dilution: more than about 8 chunks made answers vaguer. Capped at 8 and roughly 4k tokens.
  • Boundary splits: a table cut across two chunks. Caught by reviewing a sample of chunks with a 5% sampling rule.

When not to use it. Questions that need aggregation over the whole corpus, such as 'which policies changed in 2024?', fail with 8 chunks. Use structured metadata or precomputed summaries there.

Measurement. I scored retrieval (context recall, precision) and generation (faithfulness to the retrieved text) separately. Splitting them tells you which stage to fix.

Curated: · Written: · Reviewed:

Q&A-4Explain step by step how RAG works behind the scenes.

Reported in Accenture Final Interview : Experience for LLM Operations ...

The 90-second answer

RAG splits into two pipelines. Offline, documents are chunked, embedded and written to an index. At query time, the question is embedded, the nearest chunks are retrieved, and the model answers from those chunks with their sources attached. The model never searches anything itself. Your code does the search and hands the model a bounded context.

Offline: ingestion

  1. Load each source with its metadata: document id, source system, last-modified time, and the access groups allowed to read it.
  2. Split into chunks. A starting point is 512 tokens with 64 tokens of overlap, split on headings where they exist. Tables and code blocks should stay whole, because a split table row loses its column headers.
  3. Embed each chunk with one embedding model. Record the model name and version with every vector. Mixing vectors from two models in one index returns nonsense without any error.
  4. Write vector, text and metadata to the index. Keep a keyword index (BM25) beside it if the corpus has product codes, IDs or rare names, since dense vectors match those poorly.

Online: answering a question

  1. Apply the caller's permissions as a filter inside the retrieval query, for example access_groups ∩ user_groups ≠ ∅. Filtering after generation is a leak, even if the answer looks clean.
  2. Embed the question with the same model used for the chunks.
  3. Retrieve the top 20 candidates by vector similarity, merge with the top 20 keyword hits, and deduplicate.
  4. Rerank the merged set with a cross-encoder and keep the top 5. Reranking costs 100 to 300 ms here, which is usually worth it because the first-stage ranking is coarse.
  5. Build the prompt: system instructions, the 5 chunks each labelled [S1] to [S5] with source and date, then the question. Check the total against the context budget, and drop the lowest-ranked chunks rather than truncating mid-sentence.
  6. Generate with an instruction to cite [S n] for each claim and to say "not in the sources" when the chunks do not answer the question.
  7. Validate the response: every citation must reference a chunk that was actually sent, and the cited chunk must be one the user could open.

Trace (hypothetical figures)

Question: "What is the notice period in the 2024 MSA?"

StageResultTime
Permission filter41,000 chunks left of 2.3 M8 ms
Vector top 20 + BM25 top 2034 unique22 ms
Rerank to top 5[S2] clause 14.2 ranks first180 ms
Generate"90 days written notice [S2]"1.4 s

Failure modes and how to see them

  • Stale index: the contract was amended but the old chunk still ranks. Track index lag per source and alert when a source's newest indexed document is older than its last change.
  • Chunk splits the answer: the notice period and its exception land in separate chunks, and only one is retrieved. Log retrieval recall on a labelled set of 200 questions, and widen k or add the neighbouring chunk when recall drops.
  • Context overflow: the prompt is silently truncated and the answer omits the key clause. Log prompt token counts and the number of chunks dropped.
  • Ungrounded answers: the model states a figure no chunk contains. Check each cited figure against its cited chunk, and measure the rate on the labelled set.

Trade-offs

RAG suits knowledge that changes, must be cited, or is permission-scoped. It is the wrong tool for teaching a model a style or a skill, and for questions that need a join across many records, where a query over structured data is more reliable.

Curated: · Written: · Reviewed:

Q&A-5Which framework did you use (LangChain or CrewAI) and why?

Reported in Accenture Final Interview : Experience for LLM Operations ...

The 90-second answer

The framework mattered less than the shape of the workflow. I used LangChain, pinned to the 0.3 line, for a retrieval service that answered questions about claims policy from an internal document corpus. The pipeline was a fixed sequence: rewrite the query, run hybrid retrieval, rerank, generate an answer with citations. LCEL let me express that as one composable chain with a trace span per step, and that per-step visibility was the main reason I chose it.

CrewAI would have fit if the work had been several agents with different tools and roles handing decisions to each other. It wasn't. A multi-agent loop adds nondeterminism I would have had to test for every release, and I could not justify that cost for a sequence I could write as code.

NeedLangChain (LCEL)CrewAI
Fixed multi-step pipelineexplicit, easy to test per stepagent indirection for work that is already sequential
Agents delegating to each otherLangGraph for explicit statenative Agent, Task and Crew model
Per-step tracingcallbacks or LangSmithyou wire it yourself
Behaviour on retryyou decide what re-runsan agent may re-plan

The core chain looked like this:

chain = (
    {"context": retriever | format_docs, "question": RunnablePassthrough()}
    | prompt
    | llm.bind(temperature=0)
    | StrOutputParser()
)

Failure modes I watched for

Version drift. The langchain-core and integration packages move at different speeds, so I pinned them together and upgraded them as one change with the eval suite running.

Hidden retries. The model wrapper retries on 429 and timeouts by default. One slow call can become three billable calls, so I set max_retries explicitly and logged token counts per span. In a hypothetical load test at 50 requests per second, an unset retry policy would have roughly tripled spend during a rate-limit spike.

Silent quality regression. A framework upgrade can change prompt formatting without any error. I ran a labelled set of 200 questions on every change and blocked merges if citation accuracy dropped more than 3 points (a threshold I chose, not an industry standard).

When I'd change my answer

If the flow grew into branching agents with shared state and human approval steps, I would move that part to LangGraph before considering CrewAI, because explicit state transitions are easier to audit than role-based delegation. For a single retrieval-and-answer path, I would still write plain code around the model client and skip the framework entirely, since the framework's main value there is tracing, and that can be added without it.

Curated: · Written: · Reviewed:

Q&A-6What is the key difference between a Generative AI system and an Agentic AI system?

Reported in Accenture Final Interview : Experience for LLM Operations ...

The 90-second answer

A generative system maps an input to an output in one model call. The model produces the artefact (a summary, a draft, code, an image) and the application decides what happens next. An agentic system puts the model inside a loop: it chooses a tool, observes the result, updates its working state, and decides whether to continue or stop. The key difference is who controls the control flow. In a generative system the application does. In an agentic system the model does, at least partly, so the failure modes move from bad text to wrong actions, repeated actions and runaway cost.

Before I pick an architecture I'd ask three questions: does the task need data the model doesn't have, does it need to change something in a client system, and are the steps known in advance. If the answer to all three is no, a single generative call with a fixed prompt is cheaper, faster and easier to test. Agents earn their cost only when the path depends on intermediate results.

Worked trace (hypothetical figures)

Task: reconcile invoice 4411 against its purchase order and raise a ticket if they differ.

StepGenerative systemAgentic system
1One call with both documents pasted in. Returns a text verdict.Call 1: model emits get_invoice(4411)
2None. Application parses the verdict.Tool result returned. Call 2: model emits get_po(...)
3NoneCall 3: model compares, emits create_ticket(...)
4NoneCall 4: model reads the ticket id, writes the final answer
Model calls14
Latency at ~2 s per call~2 s~8 s

The agentic version costs roughly four times the tokens and has four points where it can fail: a wrong tool, a bad argument, a misread result, or a second create_ticket after a timeout.

Failure modes and how I'd detect them

  • Loops and drift. The agent calls the same tool with the same arguments. Cap steps (for example 8 per task), log each step with tool name and arguments, and alert on the step-count distribution. A rising p95 is usually the first sign.
  • Non-idempotent writes. A retried create_ticket makes a duplicate. Give every write tool an idempotency key derived from the task id, and make the agent read back state before writing again.
  • Prompt injection through tool output. A PO description containing instructions can redirect the agent. Treat tool results as data, keep tool permissions narrow, and put human approval in front of any action that moves money or changes a client record.
  • Evaluation. Scoring the final answer hides the path. I'd grade the trajectory too: right tools, right order, right stop condition, and cost per completed task.

What I'd recommend on a client engagement

Start generative where the output is the deliverable and the inputs are already in the prompt. Move to an agent only where the path must branch on retrieved data, and keep writes behind an approval gate with an audit record of every tool call. That gate and the trace log are what make the system defensible to a client's risk team, which in most Accenture programmes matters more than the model choice.

Curated: · Written: · Reviewed:

Q&A-7Design an enterprise-ready architecture utilizing a RAG pipeline with strict latency and data privacy constraints.

Reported in Accenture AI Engineer Interview Questions & Guide 2026

The 90-second answer

I'd start by pinning the numbers: end-to-end p95 to first token, the data classes in the corpus (public, internal, regulated PII), and whether documents are shared across tenants or isolated per tenant. Those decide almost everything else. My default design keeps the whole pipeline inside the customer's VPC, separates the ingestion path from the query path, enforces access control inside the retrieval query rather than in the prompt, and budgets latency per stage.

Hypothetical budget for a 1.5 s p95 target to first token:

StageRuns wherep95 budget
Authn and ACL lookupgateway, cached group claims20 ms
PII redaction of queryin-VPC service30 ms
Query embeddingin-VPC model, warm40 ms
Hybrid retrieval (vector + BM25), ACL filter appliedvector store, private endpoint120 ms
Cross-encoder rerank, top 50 to top 6in-VPC GPU pool120 ms
LLM time to first tokenprivate model endpoint700 ms
Network and orchestration overhead150 ms

That sums to about 1.18 s, so the remaining headroom absorbs tail latency. Streaming tokens to the client keeps perceived latency inside the budget even when full generation runs longer.

Privacy controls that survive audit

The ACL filter goes into the retrieval query itself, using tenant and group metadata stored on each chunk. If the filter lives only in the prompt, a retrieval bug or a prompt injection can expose text the user should never see. Per-tenant KMS keys encrypt the index and object store. Logs keep hashed user IDs and redacted query text, with a retention window of about 30 days. Telemetry leaving the VPC carries no document or query content. I'd confirm in the contract that the model vendor offers zero data retention and no training on customer data, and I'd verify that claim against the vendor's current data-processing documentation rather than a sales deck.

Failure modes and how they show up

  • Stale ACLs after a group change: a canary principal that gets removed should fail a nightly check. Alert when any canary retrieves a restricted chunk.
  • Retrieval miss, then the model answers from its weights: if the top score is below a calibrated threshold, return an explicit "no source found" response. Track the share of answers with zero citations.
  • Reranker timeout: fall back to hybrid order after 200 ms. Watch the fallback rate, because a rising rate means the GPU pool is saturated.
  • Prompt injection inside retrieved documents: treat retrieved text as data, give the model no tools in this path, and log any output that echoes instruction-like text.

Trace

Query from user in group legal-acme: "What is the notice period in the Acme MSA?" Redaction finds no PII. Hybrid retrieval returns 40 candidates, 11 pass the ACL filter, and the reranker keeps 6. The top chunk scores above threshold, so generation runs with citations. A second user outside legal-acme asking the same question gets zero candidates after the filter and receives the "no source found" response, with no hint that the document exists.

When not to use this shape

If the corpus is small and static and the answer must not vary between runs, a fine-tuned model or a deterministic lookup may be simpler and cheaper to certify.

Curated: · Written: · Reviewed:

Q&A-8How would you design an architecture for a GenAI project?

Reported in Accenture Technology Machine Learning Engineer Interview ...

The 90-second answer

Before drawing boxes I'd pin down three things: what the system must answer (open generation, or grounded answers over company documents), the latency and cost budget per request, and the data classification, since that decides whether a third-party API may see the data at all. I'll assume grounded Q&A over about 2 million internal documents, p95 under 3 s to the full answer, and fewer than 20 concurrent users at launch.

The shape I'd build is a thin orchestration service in front of three swappable parts: a retrieval layer, a model gateway, and an evaluation and observability loop. The model gateway is the most important boundary. Every model call goes through it, so model versions, providers, rate limits, timeouts and fallbacks change in one place instead of in every caller.

client -> API (authn, rate limit, PII redaction)
       -> orchestrator
            -> retriever (BM25 + vector, top 40 -> reranker -> top 6)
            -> prompt builder (token budget, citations)
            -> model gateway (primary model, fallback model, 8 s timeout)
            -> output guard (schema, citation check, policy)
       -> trace store + eval queue
Stagep95 budgetNote
Auth and redaction30 msin-region
Retrieval plus rerank250 msindex co-located with the orchestrator
Time to first token1.5 sstreaming hides the rest
Full generation2.5 sabout 400 output tokens at a hypothetical 60 tok/s

Cost arithmetic (hypothetical figures). Six chunks of 500 tokens plus 1,500 tokens of instructions and history gives about 4,500 input tokens and 400 output tokens per request. At 50,000 requests a day that is roughly 225M input and 20M output tokens daily. Cost follows context size, so cutting the reranked set from 40 to 6 is a cost control as much as a quality one. Caching embeddings and repeated retrievals removes work you would otherwise pay for twice.

Managed API or self-hosted model. A managed API ships fastest, but you must check the data-processing terms in your contract, and its outages become your outages, so the fallback path has to be real and tested. A self-hosted open-weight model keeps data inside your VPC, but you then own GPU capacity, autoscaling, and throughput per GPU becomes your planning number. Decide on data classification first and on cost second.

Failure modes and how you catch them

  • Stale index: source documents change but embeddings do not. A nightly job compares source version hashes with index metadata, and alerts when lag exceeds 24 h.
  • Prompt injection through retrieved text. Add canary cases to the eval set, treat retrieved text as data rather than instructions, and restrict which tools the model may call. Log every tool call the output guard rejects.
  • Silent regression after a model or prompt change. Run a fixed golden set of 300 labelled questions on every gateway change, and block the rollout if faithfulness drops more than 3 points.
  • Context overflow that truncates the policy text. Count tokens before sending and fail closed when the budget is exceeded.

Evaluation. Track faithfulness (every claim is supported by a cited chunk), answer relevance, and recall@6 for retrieval on the golden set. Offline evals gate releases. Sampled production traces, reviewed by people, feed new cases back into the golden set.

I'd build the gateway and the eval harness before the retriever's tuning work, because they make every later change measurable.

Curated: · Written: · Reviewed:

Q&A-9What is overfitting?

Reported in Accenture Interview Experience for LLM Operations Engineer

The 90-second answer

Overfitting is when a model fits the noise and quirks of its training set instead of the pattern underneath, so training performance keeps improving while performance on unseen data gets worse. The signal is a widening gap: low training loss, high validation loss. I'd check that gap before anything else, because the same symptom can also come from leakage, which looks like overfitting but is a data bug.

The mechanism is capacity against data. A model with more degrees of freedom than the data can constrain will find spurious structure: a feature that happens to correlate with the label in one batch, a customer ID, a timestamp that encodes the collection process. Variance is the term that rises as the model chases those details. Regularisation, early stopping and more data all reduce it.

Worked example (hypothetical figures)

A gradient-boosted classifier on 2,000 labelled support tickets, 5-fold cross-validated:

  • max_depth 12, 400 trees: train AUC 0.99, validation AUC 0.71. Gap 0.28.
  • max_depth 4, 200 trees, min_child_weight 20: train AUC 0.84, validation AUC 0.82. Gap 0.02.

The second model is worse on training data and better everywhere that matters. That is the trade I want the client to see explicitly.

How I detect it

Plot learning curves: training and validation metric against training set size or epoch. Overfitting shows as curves that diverge. Early stopping with patience on a validation metric catches the turn. For time-ordered data I use a forward-chaining split, because a random split lets the model see the future and hides the problem.

Fixes, in the order I'd try them

  1. Remove leaked or proxy features, then re-measure. A suspiciously high validation score is a leakage question before it is a capacity question.
  2. Reduce capacity: shallower trees, fewer parameters, smaller embedding dimension.
  3. Regularise: L2 or L1 penalties, dropout, data augmentation.
  4. Get more data, or label the hard cases.

For fine-tuning a large model on a few thousand examples, the same pattern appears as memorised outputs and degraded behaviour on held-out prompts. I keep a frozen evaluation set the training pipeline never touches, and I stop tuning hyperparameters against it, since repeated selection on one validation set overfits that set too.

When it isn't overfitting

If training error is also high, the model is underfitting and needs more capacity or better features. If validation error jumps only in production, suspect distribution shift: the model may be fine and the data has moved. Monitoring input distributions and label delay will separate those cases faster than retraining will.

Curated: · Written: · Reviewed:

Q&A-10Explain how regression and classification differ, including target type, outputs, and how you evaluate each.

Reported in dataford.io › accenture-in-india › ai-engineerAccenture in India AI Engineer Interview Questions 2026

The 90-second answer

The difference is what the target is. Regression predicts a continuous quantity such as price, demand or latency, so the output is a real number and an error is a distance in the target's units. Classification predicts a discrete label such as fraud or not fraud, so the output is a class, usually produced by a score or probability per class that is then thresholded. Logistic regression is a classifier despite the name. Because the output types differ, the metrics differ too: regression is judged on error magnitude, classification on how the chosen threshold trades false positives against false negatives.

Before picking metrics I'd confirm two things with the client: what a wrong prediction costs in each direction, and how the class balance looks in production, not in the training extract.

RegressionClassification
Targetcontinuous, e.g. invoice_amountdiscrete, e.g. is_fraud in {0,1}
Model outputreal numberclass, or probability per class
Loss in trainingMSE, MAE, Huberlog loss (cross-entropy)
Core metricsMAE, RMSE, R²precision, recall, F1, ROC-AUC, PR-AUC, log loss
Failure to watchoutliers dominate RMSEaccuracy hides rare-class failure

Regression evaluation. MAE is the average absolute error in target units, so it reads directly as "we are off by about X". RMSE penalises large errors more, so a large gap between RMSE and MAE means a few outliers dominate. Hypothetical example: on 5,000 invoices, MAE is 18k and RMSE is 42k. That gap says the tail matters and the mean error alone would mislead the client. R² tells you how much variance you explain relative to predicting the mean; it says nothing about whether the errors are acceptable in money terms. I'd also plot residuals against fitted values, since a funnel shape means the error grows with the target and a single MAE hides that.

Classification evaluation. Accuracy is the first metric to distrust. Hypothetical example: 10,000 transactions with 100 fraud cases. A model that always predicts "not fraud" scores 99% accuracy and catches nothing. Use the confusion matrix first. If the model flags 150 transactions and 80 are fraud, precision is 80/150 = 0.53 and recall is 80/100 = 0.80. Those two numbers force the threshold conversation. ROC-AUC measures ranking across all thresholds and stays optimistic under heavy imbalance; average precision (PR-AUC) is the better summary when positives are rare. Log loss rewards calibrated probabilities, which matters when the score feeds a downstream decision or a cost calculation. Check calibration with a reliability plot before trusting the probabilities.

Pitfalls to name. Fitting the threshold on the test set. Evaluating with a random split on time-ordered data, which leaks the future. Reporting one aggregate score when a subgroup, such as one region, fails. For regression, forgetting to compare against a naive baseline (predict the last value or the mean) before celebrating an R² of 0.7.

Monitoring after launch. Regression drift shows up as a rising MAE by segment. Classification drift shows up as a shifting predicted-positive rate and a changed precision at a fixed threshold, which can happen even when AUC looks stable. Both need labels, so I'd set up delayed-label tracking, since fraud labels can take weeks to arrive.

Curated: · Written: · Reviewed:

Q&A-11Write Python code to read a CSV and impute null values with median.

Reported in Accenture Interview Experience for LLM Operations Engineer

The 60-second answer

Read the file with pandas, select the numeric columns, compute each column's median once, and fill the nulls with those values. If this feeds a model, fit the medians on training data only and reuse them on test data, because a median over the full dataset leaks information from the test rows.

import pandas as pd

def impute_median(path):
    df = pd.read_csv(path)
    num_cols = df.select_dtypes(include='number').columns
    medians = df[num_cols].median()  # skips NaN by default
    all_null = medians[medians.isna()].index.tolist()
    if all_null:
        raise ValueError(f'no median for all-null columns: {all_null}')
    df[num_cols] = df[num_cols].fillna(medians)
    return df, medians

Returning medians matters. It is the artefact you apply to new data, and it is what you log for reproducibility.

Trace. A column age reads as [34, NaN, 29, 41, NaN]. The non-null values sorted are 29, 34, 41, so the median is 34. After fillna the column is [34, 34, 29, 41, 34]. The nulls never count toward the median, because median() skips NaN by default.

Why raise on all-null columns. The median of an empty set is NaN. fillna(NaN) changes nothing, so the nulls pass silently into the model. Failing loudly, or dropping the column, is safer than shipping it.

What the interviewer will follow up on

  • Dtype traps. A single stray string such as 'n/a' makes the whole column read as object. select_dtypes then skips it and its nulls stay. Check df.dtypes, or coerce first with pd.to_numeric(df[col], errors='coerce').
  • Integer columns. An even-count median is often x.5, so a filled integer column becomes float. Cast explicitly if the downstream schema needs ints.
  • Leakage. For a train/test split, use train_medians = train[num_cols].median() and then test[num_cols].fillna(train_medians). scikit-learn's SimpleImputer(strategy='median') does the same with fit and transform, and it avoids the leak when used inside a Pipeline.
  • Categorical columns. Median is undefined for them. Use the mode, or a sentinel category such as 'missing' when missingness itself is informative.
  • Grouped median. To fill per segment, use df[col] = df[col].fillna(df.groupby('segment')[col].transform('median')). Groups that are entirely null come back as NaN, so fall back to the global median.
  • Files larger than memory. An exact median needs the whole column. You can count values in chunks, but exactness costs a second pass or a full sort. For streaming, use an approximate quantile sketch such as t-digest, and say the imputed values are approximate.

State the assumptions out loud before you type: numeric or mixed columns, whether this is a model pipeline, and whether the data fits in memory. Those three decide which of the bullets above you need.

Curated: · Written: · Reviewed:

Q&A-12How do you manage cloud costs?

Reported in Accenture Interview Experience for LLM Operations Engineer

The 90-second answer

First I'd ask which spend we mean. For an LLM operations role it's usually inference (per-token or GPU-hour), then training GPUs, then storage and egress. I'd start with attribution, because you can't cut what you can't assign to a team and a model.

Every resource gets tags for team, service, environment and model_version, enforced at provisioning and checked by a weekly report. Cost Explorer or the Cost and Usage Report grouped by those tags shows where money goes. AWS Budgets alerts at 80% of forecast and at 100% actual, routed to the owning team. Below roughly 90% tag coverage, the numbers can't be trusted, so that comes first.

Once spend is attributable, I pull levers in order of return on effort:

LeverWhat it changesRisk to watch
Stop idle GPUsAuto-stop notebooks and endpoints, scale inference to zero off-peakCold-start latency on first request
RoutingSend easy requests to a smaller model, hard ones to the large oneQuality loss on misrouted queries
CachingExact-match and semantic cache in front of the modelStale answers after a prompt change
Output capsmax_tokens set per use caseTruncated answers
CommitmentsSavings Plans or reserved capacity for the steady baseline onlyPaying for capacity you stop using
SpotInterruptible training with checkpointsLost progress on reclaim

Commitments come last. I'd buy coverage for the floor of steady usage, not the peak, after four to six weeks of data.

Worked example (hypothetical prices and volumes)

Assume 2 million requests a day, averaging 1,500 input and 300 output tokens. The large model is priced at $3 per million input and $15 per million output, so:

  • Input: 2,000,000 × 1,500 = 3,000M tokens × $3 = $9,000/day
  • Output: 2,000,000 × 300 = 600M tokens × $15 = $9,000/day
  • Total: $18,000/day

If a classifier routes 70% of traffic to a small model at $0.25 and $1.25 per million:

  • Small: 1,400,000 requests → 2,100M input × $0.25 = $525, plus 420M output × $1.25 = $525, so $1,050/day
  • Large: 600,000 requests → 900M input × $3 = $2,700, plus 180M output × $15 = $2,700, so $5,400/day
  • Total: $6,450/day, about 64% lower

That saving only holds if quality holds, so I'd gate the change on an eval set. Shipping it without one is how cost work turns into an incident.

Failure modes and detection

  • Routing misclassifies hard queries. Detect with a sampled weekly eval on the routed traffic and the thumbs-down rate per route.
  • Cache serves answers from an old prompt template. Key the cache on prompt version and model version, and track hit rate and stale-hit complaints.
  • Spot reclaims wipe a training run. Checkpoint every N steps and alert on restarts per job.
  • Budget alerts fire but nobody owns them. Route alerts to a named owner per tag, and review unowned spend monthly.

What I'd not do

I wouldn't start with commitments or aggressive quantization. Both lock in a cost structure before the workload is understood, and the first is hard to undo.

Curated: · Written: · Reviewed:

Q&A-13Explain the transformer architecture and why it revolutionized NLP.

Reported in Accenture in India Machine Learning Engineer Interview Questions 2026

The 60-second answer

A transformer is a stack of identical blocks. Each block has multi-head self-attention, a position-wise feed-forward network, residual connections and layer normalisation. Inside attention, every token builds its new representation from all the tokens in the sequence in one batch of matrix multiplications. Attention alone ignores order, so positional information is added to the token embeddings. It replaced recurrence, which read tokens one at a time and forced everything the model knew about the start of a sentence through a single hidden state.

The mechanism

For an input matrix X of shape n × d_model, the layer projects it into queries, keys and values: Q = XW_Q, K = XW_K, V = XW_V. Then:

Attention(Q, K, V) = softmax(QKᵀ / √d_k) V

The √d_k term matters. Dot products of random vectors grow in variance with dimension d_k. Without scaling, softmax saturates, most gradients go to zero, and training stalls. Dividing by √d_k keeps the variance near one.

Trace on "The animal didn't cross the road because it was too tired." In one head, the query for "it" scores highly against the key for "animal", so after softmax that head puts most of its weight on "animal" (hypothetical figure, around 0.7). Another head might attend from "tired" back to "it". Several heads run in parallel, each with its own projections, and their outputs are concatenated and projected again.

Why it changed NLP

Three things, in order of importance:

Property (per layer, sequence length n, width d)RNNTransformer
Sequential operations during trainingO(n)O(1)
Maximum path length between two tokensO(n)O(1)
Compute per layerO(n·d²)O(n²·d)

(Vaswani et al., 2017, Table 1.)

First, training parallelises across the sequence, so a GPU stays busy. Second, any token can reach any other in one hop, so long-range dependencies stop depending on information surviving many recurrent steps. Third, the block scales cleanly with data and parameters, which made large pretraining worth doing. Attention itself was not new. The gain came from removing the sequential bottleneck and making pretraining on web-scale text practical.

Where it breaks

The cost is quadratic in sequence length. A single head materialises an n × n score matrix. At n = 4,096 that is about 16.8 million entries, roughly 34 MB in fp16 per head per layer (hypothetical sizing; real kernels avoid storing it). With 32 heads that is over 1 GB per layer if you do store it. FlashAttention computes exact attention in tiles and avoids writing that matrix to HBM, so the fix is usually a kernel change rather than an architecture change.

At inference, the KV cache grows linearly with tokens. For 32 layers, 8 KV heads, head dimension 128, fp16 and 8,192 tokens: 2 × 32 × 8 × 128 × 8,192 × 2 bytes ≈ 1 GiB per sequence. Batch size is then limited by memory, not compute. Detect it by watching GPU memory against concurrency, not by looking at latency alone.

Quality also degrades past the training context length unless positional encoding was designed to extrapolate. Check this with long-context evals such as needle-in-a-haystack retrieval at several depths, not with a single perplexity number.

Variants, and what I would say on a client project

Encoder-only models (BERT-style) suit classification and embeddings. Decoder-only models with a causal mask generate text, and most enterprise work now uses these through an API. Encoder-decoder models suit translation and summarisation.

On an Accenture delivery I would rarely build a transformer from scratch. I would choose a pretrained model, decide between prompting, retrieval and fine-tuning based on the data and evaluation results, and budget context length and KV-cache memory against the latency and cost targets the client set.

Curated: · Written: · Reviewed:

Q&A-14Explain the mechanics of attention mechanisms and how transformer architectures process long-range dependencies.

Reported in Accenture AI Engineer Interview Questions & Guide 2026

The 90-second answer

Attention lets each token build its output as a weighted mix of every token's value vectors, with the weights computed from the tokens themselves. Each input embedding X is projected three ways: Q = XW_Q, K = XW_K, V = XW_V. The scores are QKᵀ / √d_k, a softmax turns each row into weights that sum to 1, and the output is weights × V. The √d_k scaling keeps dot products from growing with the key dimension, which would push softmax into saturated regions where gradients nearly vanish.

The long-range point is about path length. In an RNN, information from token 1 to token n crosses n sequential steps and degrades on the way. In self-attention every pair of tokens is connected within a single layer, so the path length is O(1). The model does not remember better in some vague sense. It reads position 3 directly while writing position 40,000.

The cost is the catch. The score matrix is n × n per head per layer, so compute and memory grow quadratically with context length.

Worked figures (hypothetical, one head, fp16, 2 bytes per entry)

Sequence length nScore matrix entriesMaterialised size
2,0484.2 M8 MiB
32,7681.07 B2 GiB
131,07217.2 B32 GiB

At 32k that is per head, per layer, per sequence. This is why FlashAttention computes attention in tiles and never writes the full matrix to HBM. It is exact attention with lower memory traffic, not an approximation.

Multi-head and position

Multiple heads run in parallel on lower-dimensional projections, so different heads can specialise: one tracks syntax, another copies an earlier entity name. Attention is permutation-invariant on its own, so position has to be injected. Modern decoder models use rotary embeddings (RoPE) applied to Q and K, which encode relative offset in the dot product and extrapolate better than learned absolute positions, though not indefinitely.

Failure modes and how you detect them

  1. Lost in the middle. Models retrieve facts at the start and end of a long context more reliably than in the middle. Detect it with a needle-in-a-haystack sweep over position and context length, not a single score.
  2. Attention sinks. Early tokens soak up disproportionate attention mass. Usually harmless, but it shows up in attention-map analysis and affects streaming setups that evict the start of the cache.
  3. Degradation beyond the trained length. Quality falls off past the context the model was trained or fine-tuned on. Check perplexity and retrieval accuracy at each length you plan to serve.
  4. KV cache exhaustion in serving. At inference, keys and values for every past token are cached, so memory scales with batch × context × layers. Long-context requests cause OOMs under concurrency that look fine in single-request tests.

Alternatives and when not to use full attention

Sliding-window or sparse attention caps per-token cost but cuts direct long-range paths, so it suits local structure such as code or logs. Linear attention variants and state-space models reduce cost to near-linear but have weaker exact recall. For enterprise document QA, where the need is to find and cite a clause in a 300-page contract, I would often keep full attention on a retrieval-reduced context rather than stretch the window. Retrieval shrinks n, and that is usually cheaper and more accurate than architectural cleverness.

If asked to size a deployment: state the target context length, the batch size at peak, and the KV cache bytes per token for the chosen model, then check the arithmetic against the GPU memory budget before committing.

Curated: · Written: · Reviewed:

Q&A-15Explain bagging versus boosting.

Reported in Accenture AI Engineer Interview Guide 2026: Process & Questions

The 60-second answer

Both combine many base learners into one predictor. They differ in how the learners are trained and which error they target. Bagging trains learners independently on bootstrap resamples and averages them, so it mainly reduces variance. Boosting trains learners in sequence, each one fitting the errors of the ensemble so far, so it mainly reduces bias, and it overfits if you run it too long.

Before picking one for a client, I check two things: whether the single model is high variance (deep trees that swing with the sample) or high bias (shallow trees that underfit), and whether the labels are noisy, because boosting chases mislabelled rows.

Mechanism

Bagging draws n rows with replacement from n training rows. A given row is missed by all n draws with probability (1 - 1/n)^n, which tends to 1/e ≈ 0.368. Each tree therefore sees about 63% of distinct rows, and the remaining 37% give you out-of-bag (OOB) validation for free. Trees are built in parallel, and classification takes a majority vote. Random forest adds feature subsampling at each split (scikit-learn defaults to sqrt(p) for classifiers), which decorrelates the trees so averaging removes more variance.

Boosting fits round t to the current residual structure. AdaBoost reweights misclassified rows upward. Gradient boosting fits the negative gradient of the loss (pseudo-residuals). Each new learner is shrunk by a learning rate η, and the final model is the weighted sum. Shrinkage trades more rounds for better generalisation: XGBoost defaults to η = 0.3, and scikit-learn's GradientBoostingClassifier defaults to 0.1.

from sklearn.ensemble import RandomForestClassifier, HistGradientBoostingClassifier

rf = RandomForestClassifier(n_estimators=500, oob_score=True, n_jobs=-1)  # bagging + feature subsampling
gb = HistGradientBoostingClassifier(learning_rate=0.05, max_depth=4,
                                    early_stopping=True, validation_fraction=0.1)  # boosting

Comparison

Bagging (random forest)Boosting (GBM, XGBoost)
Trainingparallel, independentsequential, dependent
Targetsvariancebias
Base learnerdeep, near-unpruned treesshallow trees (depth 3 to 6)
Label noise and outliersrobustsensitive, fits noise
Tuningfew knobs, forgivingrounds, η, depth, regularisation all matter
More treesplateausoverfits past the validation optimum

Failure modes I watch for

  • Boosting with η = 0.3 and thousands of rounds: training loss keeps falling while validation loss rises. Detect it by early stopping on a held-out split, never on training loss.
  • Bagging with leakage: duplicated customers land on both sides of the bootstrap, so the OOB score looks excellent. Group the split by customer before trusting OOB.
  • Random forest on imbalanced claims data (about 2% positives): the majority vote hides the minority class. Judge it on PR curves and class weights, not accuracy.

What I'd tell the client

Start with a random forest. It is hard to break, it trains in parallel, and OOB gives a usable estimate. Move to gradient boosting when the baseline shows a measurable bias gap and the validation curve has room to improve. Report both on the same grouped split so the comparison is fair.

Curated: · Written: · Reviewed:

Q&A-16Compare XGBoost and Random Forest.

Reported in Accenture AI Engineer Interview Guide 2026: Process & Questions

The 90-second answer

Both are tree ensembles for tabular data, but they reduce error in opposite ways. Random Forest averages many deep trees grown independently, so it mainly cuts variance. XGBoost fits trees in sequence, each one fitting the loss gradient left by the ensemble so far, so it mainly cuts bias and needs far more care in tuning. On a clean tabular problem I would start with XGBoost plus early stopping on a validation set. I would keep Random Forest as the robust baseline when tuning time is short or the labels are noisy.

Mechanism

  • Random Forest draws a bootstrap sample per tree (about 63% of distinct rows) and, at each split, considers only max_features columns. scikit-learn's default for classifiers is sqrt(p). Trees are grown deep, so each has low bias and high variance, and averaging cancels much of that variance.
  • XGBoost, in round t, fits a tree to the first and second derivatives of the loss at the current prediction. A leaf's weight is w = -G / (H + λ), and a split survives only if its gain exceeds γ. Each new tree is scaled by the learning rate η.

Arithmetic with made-up numbers: a leaf with gradient sum G = -6, hessian sum H = 10 and λ = 1 gets w = 6 / 11 ≈ 0.55. Shrinking that by η = 0.1 means each round moves the prediction only a tenth of the way toward the leaf value.

Random ForestXGBoost
Tree constructionindependent, parallel across treessequential, each tree corrects the last
Main error term reducedvariancebias, with regularization on variance
Tree sizedeep by defaultmax_depth 6 by default
Regularization knobsmin_samples_leaf, max_featuresλ, γ, α, η, subsample, colsample_bytree
Sensitivity to tuninglow; more trees rarely hurtshigh; rounds and η interact
Missing valuesneeds handling in your pipeline (check your scikit-learn version)learns a default direction per split
from xgboost import XGBClassifier
from sklearn.ensemble import RandomForestClassifier

rf = RandomForestClassifier(n_estimators=500, min_samples_leaf=2, n_jobs=-1)
rf.fit(X_tr, y_tr)

xgb = XGBClassifier(n_estimators=2000, learning_rate=0.05, max_depth=6,
                    subsample=0.8, colsample_bytree=0.8,
                    early_stopping_rounds=50, eval_metric="logloss")
xgb.fit(X_tr, y_tr, eval_set=[(X_va, y_va)])
print(xgb.best_iteration)

Failure modes and how to catch them

  • Boosting overfits when rounds run unchecked. Watch the validation loss curve: it turns up while training loss keeps falling. Early stopping must use a validation split, not the test set, or the reported score is optimistic.
  • Boosting amplifies label noise, because mislabelled rows keep large gradients round after round. Compare against a Random Forest on a held-out set with a deliberate label-noise sample. If the forest wins there, suspect the labels before the model.
  • Forests get slow and memory-heavy with hundreds of full-depth trees. Measure p99 latency under production batch sizes, not the average, before choosing one for online serving.
  • Forest probabilities cluster away from 0 and 1, so they are often poorly calibrated. Check with a reliability plot before using scores as probabilities for thresholds or cost decisions.

My default: XGBoost with early stopping if I can tune it and the data is reasonably clean. Random Forest if I need a baseline in an afternoon, or if the labels are unreliable and I would rather accept a little accuracy for stability.

Curated: · Written: · Reviewed:

Curated: · Written: · Reviewed: