CrackML by @ml.with.umang
Interview questions / ML Fundamentals
ML Fundamentals interview question

BERT: Architecture and Training

Explain BERT’s architecture, pretraining objective, and why it differs from decoder-only LLMs.

mediumconceptEvidence 41/1001 source reportLinkedIn

The 60-second answer

BERT is an encoder-only Transformer: every token can attend bidirectionally to the full unmasked input context. Its original pretraining used masked-language modeling and next-sentence prediction; downstream tasks typically fine-tune the encoder or add lightweight task heads.

Build the answer in this order

1
Give the core idea

BERT is an encoder-only Transformer: every token can attend bidirectionally to the full unmasked input context.

2
Explain how it works

Its original pretraining used masked-language modeling and next-sentence prediction; downstream tasks typically fine-tune the encoder or add lightweight task heads.

3
Compare alternatives

Contrast it with decoder-only models, which use causal masking and are naturally suited to autoregressive generation.

4
State failure modes + validation

Mention practical tradeoffs: BERT-style encoders remain strong for classification, token labeling, and dense representations where generation is unnecessary.

A useful interview mental model

This is the shape of a strong answer—not a script to memorize.

01Definition
02Mechanism
03Trade-offs
04Failure modes
05When to use

Senior-level signal

  • Senior answers distinguish pretraining objective from architecture and avoid implying NSP is essential to all BERT-family models.
  • Discuss when a smaller encoder is materially cheaper and more reliable than prompting a large generative model.

What the interviewer is really testing

Mechanistic understanding, assumptions, trade-offs, and whether you can turn a definition into a model decision.

Likely follow-up questions

What assumption makes this approach work?
When would you choose the strongest alternative instead?
What production or data failure mode changes your answer?

Common weak-answer patterns

  • Reciting a definition without mechanism or assumptions.
  • Claiming one technique is always better without a data regime.
  • Stopping before failure modes, validation, or deployment implications.