Skip to main content
QUICK REVIEW

[Paper Review] BERTs are Generative In-Context Learners

David Samuel|arXiv (Cornell University)|Jun 7, 2024
Teaching and Learning ProgrammingComputer Science3 citations
TL;DR

This paper demonstrates that DeBERTa, a masked language model (MLM), can achieve strong in-context learning performance comparable to GPT-3, a causal language model, using a simple inference technique that restructures input tokens to enable autoregressive generation and sequence ranking without any fine-tuning. The key contribution is showing that in-context learning is not exclusive to causal models, and that MLMs like DeBERTa can match or surpass GPT-3 on specific tasks, revealing complementary strengths between masked and causal pretraining objectives.

ABSTRACT

While in-context learning is commonly associated with causal language models, such as GPT, we demonstrate that this capability also 'emerges' in masked language models. Through an embarrassingly simple inference technique, we enable an existing masked model, DeBERTa, to perform generative tasks without additional training or architectural changes. Our evaluation reveals that the masked and causal language models behave very differently, as they clearly outperform each other on different categories of tasks. These complementary strengths suggest that the field's focus on causal models for in-context learning may be limiting - both architectures can develop these capabilities, but with distinct advantages; pointing toward promising hybrid approaches that combine the strengths of both objectives.

Motivation & Objective

  • To challenge the prevailing assumption that masked language models (MLMs) cannot perform in-context learning.
  • To demonstrate that DeBERTa, an off-the-shelf MLM, can match or exceed GPT-3’s in-context learning performance without any additional training.
  • To show that the capacity for in-context learning is not inherently tied to causal pretraining objectives.
  • To explore the complementary strengths of masked and causal language modeling through empirical comparison across diverse NLP tasks.
  • To propose and validate a simple inference technique that enables generative in-context learning in MLMs using only input sequence reformatting.

Proposed method

  • Reformatting input sequences by appending a [MASK] token to prompts to enable autoregressive text generation in a left-to-right manner.
  • Extending the masking strategy beyond the target token to include the next two or more tokens to improve log-likelihood estimation for sequence ranking.
  • Using pseudo-log-likelihood estimation with multiple masked tokens to rank candidate sequences based on joint probability, improving accuracy over single-mask baselines.
  • Applying the same input formatting for both text generation and ranking tasks, ensuring consistency across evaluation protocols.
  • Evaluating the method on the same benchmark suite as GPT-3 (e.g., BoolQ, MultiRC, ReCoRD, HellaSwag) to enable direct comparison.
  • Using publicly available DeBERTa checkpoints (up to 1.4B parameters) to ensure reproducibility and avoid model-specific tuning.

Experimental results

Research questions

  • RQ1Can a masked language model like DeBERTa perform in-context learning without any fine-tuning or architectural changes?
  • RQ2How does the performance of DeBERTa in in-context learning compare to GPT-3 across diverse NLP tasks?
  • RQ3Do masked language models and causal language models exhibit complementary strengths on different types of tasks?
  • RQ4Does the proposed inference technique—reformatting input sequences with [MASK] tokens—enable effective text generation and sequence ranking in MLMs?
  • RQ5Is in-context learning a general phenomenon across different pretraining objectives, or is it exclusive to causal models?

Key findings

  • DeBERTa achieves 82.1% accuracy on the BoolQ dev set in 1-shot in-context learning, matching GPT-3’s performance on the same benchmark.
  • On the ReCoRD dataset, DeBERTa reaches 87.1% EM accuracy and 87.9% F1 in 0-shot setting with the 1.4B model, outperforming GPT-3 on this task.
  • DeBERTa surpasses GPT-3 on language understanding tasks such as ReCoRD and MultiRC, while underperforming on closed-book question answering like TriviaQA.
  • The method of masking additional subwords (up to three) improves pseudo-log-likelihood estimation, increasing ReCoRD F1 from 81.6 to 87.9 compared to single-mask baseline.
  • Scaling DeBERTa models from 0.1B to 1.4B parameters shows consistent log-linear performance gains across tasks, confirming that MLMs scale effectively for in-context learning.
  • The exact unidirectional log-likelihood computation performs poorly on bidirectional models like DeBERTa, indicating that bidirectional context should not be ignored in likelihood estimation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.