NCA-GENL - Core Machine Learning and AI Knowledge - Section 1.2

Describe how transformers function as the building blocks of modern LLMs for NLP.

Describe the transformer architecture, including the self-attention mechanism, positional encoding, and the encoder-decoder structure that underpins modern NLP systems. Recognise how stacking transformer layers produces the large language models used for text generation, summarisation, and translation.

TransformersLLMsNLP

Practice question for this objective

Free sampleCore Machine Learning and AI Knowledgemedium

A researcher notices that a transformer language model produces identical output regardless of the order in which tokens appear in the input sequence. Which component is most likely missing or misconfigured?

  • AThe feed-forward sublayer within each encoder block.
  • BThe positional encoding added to the token embeddings before the attention layers. Correct
  • CThe layer normalisation applied after each sublayer.
  • DThe residual connections that bypass each sublayer.
Recognise that positional encoding is the transformer component responsible for injecting token-order information into the model. Self-attention computes scores from pairwise dot products of query and key vectors derived from token embeddings. If no positional signal is added, the same embedding is produced for a given token regardless of where it appears in the sequence, making the model permutation-invariant. Positional encodings - whether sinusoidal or learned - are summed with token embeddings before the first attention layer, giving the model the ability to distinguish 'cat sat' from 'sat cat'.

Why A is wrong: Tempting because the feed-forward sublayer processes each position, but it operates identically on each position independently and does not encode order information - its absence would degrade quality but would not cause order-invariance on its own.

Why B is correct: Without positional encoding, the self-attention mechanism treats the input as a set rather than a sequence - the attention scores depend only on token identity, not position, so permuting tokens produces the same output. Positional encodings inject order information into the embeddings to break this symmetry.

Why C is wrong: Layer normalisation stabilises training and affects output magnitudes, but it contains no positional information and its removal would not cause the model to treat token order as irrelevant.

Why D is wrong: Residual connections carry gradient flow and preserve earlier representations, but they do not encode sequence order. Removing them would harm gradient propagation, not make the model order-invariant.

See more NCA-GENL practice questions, answers explained.

More in this domain

Back to all Core Machine Learning and AI Knowledge objectives, or the NCA-GENL cert hub.

Examworthy is not affiliated with or endorsed by NVIDIA. Original, blueprint-aligned practice material only.