· Xiaojing Yang · NLP and LLMs · 2 min read

中文

Sequence-to-Sequence Models

The encoder-decoder idea behind machine translation, summarization, and many generation tasks.

Core idea

Seq2seq models turn one sequence into another by encoding meaning and decoding output step by step.

1. The task shape

Many NLP tasks are naturally sequence-to-sequence: translation, summarization, question answering, data-to-text generation, and grammatical correction.

Seq2seq flow
Source sequence
input tokens
Encoder
context representation
Decoder state
what has been generated
Next token
predict one step
Target sequence
complete output

2. Why it mattered

Before Transformers, encoder-decoder RNNs made neural machine translation practical. Attention improved them by letting the decoder look back at source states instead of relying on one fixed vector.

ComponentRole
Encoderreads the source
Decodergenerates the target
Attentionselects relevant source information
Teacher forcingtrains with gold previous tokens

3. Hugging Face practice

from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

name = "Helsinki-NLP/opus-mt-en-no"
tokenizer = AutoTokenizer.from_pretrained(name)
model = AutoModelForSeq2SeqLM.from_pretrained(name)

4. My research connection

English—Norwegian MT is a seq2seq problem. Domain adaptation asks whether the model can generate technically correct target text when the source contains rare petroleum terminology and formal document style.

Core strength

Seq2seq maps variable-length input to variable-length output.

Core risk

Generation can be fluent while still missing source details.

Takeaway

Seq2seq is the task grammar behind MT: input text becomes output text, but faithfulness must be evaluated carefully.

Interview pattern

My interview answer would usually be:

  1. define the concept in one sentence;
  2. explain the data flow;
  3. name the main failure mode;
  4. connect it to evaluation, multilinguality, or fine-tuning.

References

Share:
Back to Blog

Related Posts

View All Posts »
FoundationsNLP and LLMsEN

Attention Mechanism

Attention as a learned way to decide what context matters for each token.

FoundationsNLP and LLMsEN

Fine-Tuning Transformers

How pretrained language models are adapted to a task or domain with supervised data.

FoundationsNLP and LLMsEN

LLM Evaluation and Failure Modes

A practical map of LLM evaluation risks: hallucination, prompt sensitivity, bias, contamination, and brittle benchmarks.

FoundationsNLP and LLMsEN

NLP Evaluation

Why NLP evaluation needs metrics, uncertainty, human judgment, and task-specific error analysis.