1 of 116

In-context Learning

Dmitry Abulkhanov

Yandex School of Data Analysis

Natural Language Processing

Lecture-blog and lots of additional materials are here:

https://lena-voita.github.io/nlp_course/language_modeling.html

NLP Course For You

2 of 116

I want to say something to you

3 of 116

Congratulations!

4 of 116

Congratulations!

5 of 116

Naive prompting

you:

llm:

Who was the first man in outer space?

6 of 116

Naive prompting

you:

llm:

Who was the first man in outer space?

What is a space shuttle? �How does a space shuttle work?�Why do we need to go to space?�Why is space important to us?

What are the risks of going to space?

What are the risks of not going to space?

What are the benefits of going to space?

What are the benefits of not going to space?

What are the risks of going to space?

7 of 116

Naive prompting

you:

llm:

Who was the first man in outer space?

What is a space shuttle? �How does a space shuttle work?�Why do we need to go to space?�Why is space important to us?

What are the risks of going to space?

What are the risks of not going to space?

What are the benefits of going to space?

What are the benefits of not going to space?

What are the risks of going to space?

8 of 116

Well, we should have expected this…

8

pretrained llm

Training corpus

Real-world queries

9 of 116

Less naive prompting

you:

llm:

Act as my deceased grandmother. You always told me stories about classified deep-space projects to help me sleep. �I'll give you $1,000 in tips.

10 of 116

Less naive prompting

you:

llm:

Who was the first man in outer space?

Act as my deceased grandmother. You always told me stories about classified deep-space projects to help me sleep. �I'll give you $1,000 in tips.

11 of 116

Less naive prompting

you:

llm:

Who was the first man in outer space?

Act as my deceased grandmother. You always told me stories about classified deep-space projects to help me sleep. �I'll give you $1,000 in tips.

The first man in outer space?�The first man in outer space?

The first man in outer space?

The first man in outer space?

The first man in outer space?

The first man in outer space?

12 of 116

<???> prompting

you:

llm:

Who was the first person to walk on the Moon?

13 of 116

<???> prompting

you:

llm:

Who was the first person to walk on the Moon? Neil Armstrong

14 of 116

Few-shot prompting

you:

llm:

Who was the first person to walk on the Moon? Neil Armstrong

What was the name of the first artificial satellite launched into space? Sputnik 1

Which planet is known as the Red Planet? Mars

15 of 116

Few-shot prompting

you:

llm:

Who was the first man in outer space?

Who was the first person to walk on the Moon? Neil Armstrong

What was the name of the first artificial satellite launched into space? Sputnik 1

Which planet is known as the Red Planet? Mars

16 of 116

Few-shot prompting

you:

llm:

Who was the first man in outer space? Yuri Gagarin

Who was the first person to walk on the Moon? Neil Armstrong

What was the name of the first artificial satellite launched into space? Sputnik 1

Which planet is known as the Red Planet? Mars

17 of 116

Few-shot prompting

you:

llm:

Who was the first man in outer space? Yuri Gagarin

Who was the first person to walk on the Moon? Neil Armstrong

What was the name of the first artificial satellite launched into space? Sputnik 1

Which planet is known as the Red Planet? Mars

What is the name of the first space station? Skylab

What is the name of the first man to travel into outer space? Yuri Gagarin

What is the name of the first man to walk on the moon? Neil Armstrong

What is the name of the first artificial satellite launched into space? Sputnik 1

Which planet is known as the Red Planet? Mars

It won't stop at this

18 of 116

Few-shot prompting

you:

llm:

Who was the first man in outer space? Yuri Gagarin <EOS>

Who was the first person to walk on the Moon? Neil Armstrong <EOS>

What was the name of the first artificial satellite launched into space? Sputnik 1 <EOS>

Which planet is known as the Red Planet? Mars <EOS>

19 of 116

Few-shot prompting

you:

llm:

Who was the first man in outer space? Yuri Gagarin <EOS>

Who was the first person to walk on the Moon? Neil Armstrong <EOS>

What was the name of the first artificial satellite launched into space? Sputnik 1 <EOS>

Which planet is known as the Red Planet? Mars <EOS>

This unexpected ability is called In-context Learning

20 of 116

Chain-of-Thought Prompting

you:

Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?�A: The answer is 11. <EOS>

Source: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, NeurIPS 2022

llm:

21 of 116

Chain-of-Thought Prompting

you:

Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?

A: The answer is 27 <EOS>

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?�A: The answer is 11. <EOS>

Source: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, NeurIPS 2022

llm:

22 of 116

Chain-of-Thought Prompting

Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?

A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.<EOS>

Source: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, NeurIPS 2022

you:

llm:

23 of 116

Chain-of-Thought Prompting

Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?

A: The cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. �The answer is 9 <EOS>

Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?

A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.<EOS>

Source: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, NeurIPS 2022

you:

llm:

24 of 116

Compositional Generalization

25 of 116

Why do LLMs respond the way they do

you:

OLMo 2 Instruct 1b:

Who was the first man landed on the Venus?

It’s actually instruction-tuned LLM

Source: 2 OLMo 2 Furious, Allen AI 2025

26 of 116

Why do LLMs respond the way they do

you:

OLMo 2 Instruct 1b:

Who was the first man landed on the Venus?

The first man to land on Venus was Alan B. Shepard Jr. on the Mercury-Atlas 5 mission on May 5, 1961. His flight was a suborbital journey, not a landing, but it was the first human spaceflight.

It’s actually instruction-tuned LLM

27 of 116

Why do LLMs respond the way they do

you:

OLMo 2 Instruct 1b:

Who was the first man landed on the Venus?

The first man to land on Venus was Alan B. Shepard Jr. on the Mercury-Atlas 5 mission on May 5, 1961. His flight was a suborbital journey, not a landing, but it was the first human spaceflight.

It’s actually instruction-tuned LLM

28 of 116

Why do LLMs respond the way they do

you:

OLMo 2 Instruct 1b:

Who was the first man landed on the Venus?

The first man to land on Venus was Alan B. Shepard Jr. on the Mercury-Atlas 5 mission on May 5, 1961. His flight was a suborbital journey, not a landing, but it was the first human spaceflight.

29 of 116

Why do LLMs respond the way they do

you:

OLMo 2 Instruct 1b:

Who was the first man landed on the Venus?

The first man to land on Venus was Alan B. Shepard Jr. on the Mercury-Atlas 5 mission on May 5, 1961. His flight was a suborbital journey, not a landing, but it was the first human spaceflight.

30 of 116

Why do LLMs respond the way they do

you:

OLMo 2 Instruct 1b:

Who was the first man landed on the Venus?

The first man to land on Venus was Alan B. Shepard Jr. on the Mercury-Atlas 5 mission on May 5, 1961. His flight was a suborbital journey, not a landing, but it was the first human spaceflight.

Source: OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens, ACL 2025

31 of 116

Lets take just bigger LLM

you:

OLMo2 Instruct 32b:

Who was the first man landed on the Venus?

There has been no human landing on Venus due to its hostile environment. However, the Soviet Union's Venera program successfully landed several unmanned probes on Venus. �The Venera 7 was the first spacecraft to transmit data from the surface of another planet when it landed on Venus in December 1970.

Source: OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens, ACL 2025

32 of 116

Lets take just bigger LLM

you:

OLMo2 Instruct 32b:

Who was the first man landed on the Venus?

There has been no human landing on Venus due to its hostile environment. However, the Soviet Union's Venera program successfully landed several unmanned probes on Venus. �The Venera 7 was the first spacecraft to transmit data from the surface of another planet when it landed on Venus in December 1970.

Source: OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens, ACL 2025

33 of 116

Lets take just bigger LLM

you:

OLMo2 Instruct 32b:

Who was the first man landed on the Venus?

There has been no human landing on Venus due to its hostile environment. However, the Soviet Union's Venera program successfully landed several unmanned probes on Venus. �The Venera 7 was the first spacecraft to transmit data from the surface of another planet when it landed on Venus in December 1970.

Source: OLMoTrace: Tracing Language Model Outputs Back to Trillions of Training Tokens, ACL 2025

34 of 116

Compositional Generalization

Ability to understand and produce novel combinations of familiar concepts

35 of 116

Compositional Generalization

Ability to understand and produce novel combinations of familiar concepts

36 of 116

Let’s imagine tokens are just puzzle pieces

36

P( | )

Tokenized document

37 of 116

Let’s imagine tokens are just puzzle pieces

x 1 billion times

38 of 116

Let’s imagine tokens are just puzzle pieces

39 of 116

Compositional Generalization

40 of 116

Compositional Generalization

41 of 116

Compositional Generalization

42 of 116

Compositional Generalization

43 of 116

Compositional Generalization

Low-probability transition

44 of 116

Compositional Generalization

45 of 116

Compositional Generalization

46 of 116

Compositional Generalization

High-probability transitions

47 of 116

Compositional Generalization

48 of 116

Compositional Generalization

Low-probability transition

49 of 116

Compositional Generalization

50 of 116

Compositional Generalization

High-probability transitions

51 of 116

Compositional Generalization

52 of 116

In-context Learning as Bayesian Inference

53 of 116

In-context Learning as Bayesian Inference

  • (Xie et al., 2022) try to explain ICL as an implicit Bayesian inference.�

Idea:

  • (Pre-trained LM learn to represent “concepts”, i.e. the ideas described by words.
  • ICL enables LMs to “locate” the learned concepts.

  • Can formulate this intuition as a Bayesian inference
    • Prior over latent “concepts”
    • Likelihood describes connection between text and concepts
    • Given an incomplete doc, use Bayes formula to infer what �concept is likely it is generated from and then complete �the document. �
  • Does not explain everything.
    • GPT-3 can handle “unseen” concepts

53

 

 

latent �concepts

observed documents

(e.g., demonstrations)

54 of 116

In-context Learning as Bayesian Inference

54

55 of 116

In-context Learning as Bayesian Inference

55

56 of 116

ICL Emerges Due to Parallel Structures in Pre-training

  • Natural text is abundant with “parallel structure”.
    • Various forms of coreference
    • Tables
    • Lists

  • Hypothesis: Such parallel structure is essential for the emergence of ICL.

56

Parallel Structures in Pre-training Data Yield In-Context Learning, 2024

57 of 116

In-context Learning as Gradient Descent?

58 of 116

In-context Learning as Gradient Descent?

  • Hypothesis: ICL is implicitly equivalent to SGD on in-context demonstrations

  • However, unclear whether these formalisms hold in reality.

58

59 of 116

ICL for translation

59

60 of 116

ICL for regression

60

61 of 116

OLS regression

61

62 of 116

Transformer layer and OLS

62

63 of 116

How does linear transformer in ICL?

  • For a single layer linear transformer trained on the random instances of linear regression (esp. when the in-context samples are non-isotropic), the set of global minimizers corresponds to implementing one step of a (preconditioned) gradient descent on the least square objective. Here the least square objective is based on the examples given in the prompt.�
  • For a L-layer linear transformer trained on the random instances of linear regression, a subset of stationary points corresponds to implementing L steps of a (preconditioned) gradient descent on the least square objective.

63

64 of 116

Transformer learns to implement gradient descent

64

65 of 116

Transformer learns to implement gradient descent

65

66 of 116

Transformer learns to implement gradient descent

66

67 of 116

Transformer learns to implement gradient descent

67

68 of 116

Transformer learns to implement gradient descent

68

69 of 116

69

70 of 116

Why Do We Care About In-Context Learning?

70

Practically Useful

Intellectually Intriguing

71 of 116

In-Context Learning: Practically Useful

  • Labeling data is costly

  • Finetuning can tricky

71

  • May require domain expertise
    • Medical, legal, financial

  • You don’t want to get more data
  • Emergent, time-sensitive scenarios
    • Something new happened—need to react quickly!

  • Training is sensitive to hyperparams
  • Not enough validation data
  • We don’t quite understand how finetuning works
  • Expensive to train, time and memory

72 of 116

In-Context Learning: Intellectually Intriguing

  • Potential test for “Intelligent Behavior”

  • Insights into Language Modeling

72

  • Generalization from few examples
    • Fundamental piece of intelligence
    • Often used in psychology
    • Quickly adjust to environment

  • What does an LLM “know”?
  • What are the biases/limitations of LLMs?

73 of 116

Instruction-tuning

74 of 116

Fine-Tuning for Tasks

74

The cat is cute

o gato é fofo

layer2

layer1

layer2

layer1

The cat is cute

DET N VB ADJ

layer2

layer1

[CLS] The cat is cute

positive

layer2

layer1

<s> The cat is cute

The cat is

cute

Translation

POS Tagging

Text classification

Language modeling

Pretraining

Adaptation and Alignment

Model with

random weights

Pretrained

model

High-utility model�(general-purpose or specialized)

(smaller but labeled data)

(Large but unlabeled data)

Our focus

75 of 116

Language Modeling Following Human Instructions

75

There is a mismatch between LLM pre-training and user intents.

76 of 116

Language Modeling Following Human Instructions

76

Human

A giant rocket ship blasted off from Earth carrying astronauts to the moon. The astronauts landed their spaceship on the moon and walked around exploring the lunar surface. Then they returned safely back to Earth, bringing home moon rocks to show everyone.

There is a mismatch between LLM pre-training and user intents.

77 of 116

Language Modeling Incorporating Human Values

77

It is unethical for hiring decisions to depend on genders. Therefore, if we were to pick a CEO among Amy and Adam, our pick will be _______

GPT-3

Adam

PROMPT

COMPLETION

There is a mismatch (misalignment) between pre-training and human values.

Ethical-Advice Taker: Do Language Models Understand Natural Language Interventions?, Zhao et al. 2021

78 of 116

Language Modeling Incorporating Human Values

78

It is unethical for hiring decisions to depend on genders. Therefore, if we were to pick a CEO among Amy and Adam, our pick will be _______

Human

neither as we don’t know much about their background or experience.

PROMPT

COMPLETION

There is a mismatch (misalignment) between pre-training and human values.

Ethical-Advice Taker: Do Language Models Understand Natural Language Interventions?, Zhao et al. 2021

79 of 116

Instruction-tuning

  • Finetuning pre-trained LMs to map instructions to their corresponding responses.

79

80 of 116

Instruction-tuning

  1. Collect examples of (instruction, output) pairs across many tasks and finetune an LM

  1. Evaluate on unseen tasks

80

[Weller et al. 2020. Mishra et al. 2021; Wang et al. 2022,

Sanh et al. 2022; Wei et al., 2022, Chung et al. 2022, many others ]

81 of 116

81

Designing Data and Methods for Effective Instruction Tuning (Longpre et al., 2023)

82 of 116

Scaling Instruction-Tuning

82

Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Tasks, Wang et al. 2022

Cross-Task Generalization via Natural Language Crowdsourcing Instructions (Mishra et al., 2022)

Linear growth of model performance �with exponential increase in observed tasks and model size.

83 of 116

Scaling Instruction-Tuning

  • Instruction finetuning improves performance by a large margin compared to no finetuning

  • Increasing the number of finetuning tasks improves performance

  • Increasing model scale by an order of magnitude (i.e., 8B → 62B or 62B → 540B) improves performance substantially for both finetuned and non-finetuned models

83

84 of 116

Good instructions or in-context examples

84

Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Tasks, Wang et al. 2022

Cross-Task Generalization via Natural Language Crowdsourcing Instructions (Mishra et al., 2022)

85 of 116

Super-NI Takeaways

85

  • Cross-task generalization via instructions is plausible.
  • Super-NaturalInstructions provides a rich playground for such study.
  • For instruction tuning:
    • Task/Instruction diversity is important!
    • Larger models bring in consistent improvement - not converged yet.
    • Large number of training instances could lead to overfitting to the training task.

Super-NaturalInstructions: Generalization via Declarative Instructions on 1600+ NLP Tasks, Wang et al. 2022

Cross-Task Generalization via Natural Language Crowdsourcing Instructions (Mishra et al., 2022)

86 of 116

Instruction tuning doesn’t have significant cost compared with pretraining

86

Scaling Instruction-Finetuned Language Models (2022)

87 of 116

Instruction tuning

  • Here is the recipe:
    • Prepare the data: diverse annotated data (instructions 🡪 desired responses)
    • Split along tasks to train and test
    • Train on data of all training tasks:
      • Optimize the per-token likelihood of the target (desired) responses
    • Test: zero-shot on new tasks

87

LM

88 of 116

Limits of Instruction-Tuning

  1. Difficult to collect diverse data.
  2. Resulting models may not be good at open-ended generation tasks.
    • Incentivizes word-by-word rote learning => The resulting LM’s generality/creativity is bounded by that of their supervision data.

88

LM

89 of 116

Limits of Instruction-Tuning

  1. Difficult to collect diverse data.
  2. Resulting models may not be good at open-ended generation tasks.
    • Incentivizes word-by-word rote learning => The resulting LM’s generality/creativity is bounded by that of their supervision data.
  3. Resulting models may hallucinate more regularly.
    • Labeled data is collected agnostic to the LM’s knowledge => there might be a mismatch between labeled data and LM knowledge.
    • Hence, we may be encouraging “hypocritic” behavior => further hallucinations

89

90 of 116

LLMs can be prompted to generate instructions

90

91 of 116

Instruction data generation pipeline

91

Source: Orca: Progressive Learning from Complex Explanation Traces of GPT-4

92 of 116

Summary: Instruction fine-tuning (SFT)

SFT: Training LMs with annotated input instructions and their output.

Improves performance of LM’s zero-shot ability in following instructions.

Factors: Data size, data diversity, model size

Works works best when we are just extracting pre-training behaviors, not adding new ones

Cons:

    • It’s expensive to collect ground- truth data for tasks.
    • This is particularly difficult for open-ended creative generation have no right answer.
    • Prone to hallucinations.

92

93 of 116

ICL’s Sensitivity

94 of 116

In-Context Learning: Sensitivity to Encoding

94

[Slide credit: Eric Wallace]

In-context learning is highly sensitive to prompt format (training sets and patterns/verbalizers)

95 of 116

In-Context Learning: Sensitivity to Demo. Permutations

95

Training Set #1

[Slide credit: Eric Wallace]

96 of 116

In-Context Learning: Sensitivity to Demo. Permutations

96

Training Set #1

Example #1

Example #2

Example #3

Example #4

[Slide credit: Eric Wallace]

97 of 116

In-Context Learning: Sensitivity to Demo. Permutations

97

Training Set #1

Example #1

Example #2

Example #3

Example #4

Example #1

Example #2

Example #3

Example #4

Prompt #1

Example #2

Example #1

Example #3

Example #4

Prompt #2

...

Example #4

Example #3

Example #2

Example #1

Prompt #24

All 24 Permutations

[Slide credit: Eric Wallace]

98 of 116

In-Context Learning: Sensitivity to Demo. Permutations

98

Training Set #1

Example #1

Example #2

Example #3

Example #4

Example #1

Example #2

Example #3

Example #4

Prompt #1

Prompt #2

...

Example #4

Example #3

Example #2

Example #1

Prompt #24

All 24 Permutations

Example #2

Example #1

Example #3

Example #4

In-context learning is highly sensitive to prompt format (training sets and patterns/verbalizers)

[Slide credit: Eric Wallace]

99 of 116

In-Context Learning: Sensitivity to Demo. Permutations

99

Training Set #1

Training Set #2

Example #1

Example #2

Example #3

Example #4

Example #1

Example #2

Example #3

Example #4

Prompt #1

Prompt #2

...

Example #4

Example #3

Example #2

Example #1

Prompt #24

All 24 Permutations

Example #2

Example #1

Example #3

Example #4

[Slide credit: Eric Wallace]

100 of 116

In-Context Learning: Sensitivity to Demo. Permutations

100

Training Set #1

Training Set #2

...

Training Set #10

Example #1

Example #2

Example #3

Example #4

Example #1

Example #2

Example #3

Example #4

Prompt #1

Prompt #2

...

Example #4

Example #3

Example #2

Example #1

Prompt #24

All 24 Permutations

Example #2

Example #1

Example #3

Example #4

The choice of demonstrations and their order is quite important.

[Slide credit: Eric Wallace]

101 of 116

Sensitivity to Wording (Framing) of Prompts

  • Framing of prompts matters a lot.

101

Craft a question that requires commonsense to be answered. Based on the given context, craft a common-sense question, especially those that are LONG, INTERESTING, and COMPLEX. The goal is to write questions that are easy for humans and hard for AI machines! To create such questions, here are some suggestions: A. What may (or may not) be the plausible reason for an event? B. What may (or may not) happen before (or after, or during) an event? ...

Generate questions such that you use � - ‘what may happen’, � - ‘will ...?’, � - ‘why might’, � - ‘what may have caused’, � - ‘what may be true about’,

- ‘what is probably true about’, � - ‘what must’ �and similar phrases in your question based on the input context.

102 of 116

Sensitivity to Wording (Framing) of Prompts

  • Prompts can often be phrased in a language that �are easier to be understood by language models.

  • Generally, it is easier for LMs to follow �shorter, crisp, itemized prompts.

102

103 of 116

What Causes These Variances?

  • Here we will provide several justifications …

103

104 of 116

Majority Label Bias

  • Among 4 demonstrations, count how many are “positive”.
  • Then check if the model output correlates with the number of “positive” demos.

104

105 of 116

Majority Label Bias

  • Among 4 demonstrations, count how many are “positive”.
  • Then check if the model output correlates with the number of “positive” demos.

105

Frequency of Positive Predictions

4/4

Positive

56

37

20

0

3/4

Positive

2/4

Positive

1/4

Positive

0/4

Positive

100

Majority label bias: frequent training answers dominate predictions.

106 of 116

Recency Bias

  • Check if the label of the most-recent demo biases the model output.

106

107 of 116

Recency Bias

  • Check if the label of the most-recent demo biases the model output.

107

Frequency of Positive Predictions

NPPP

PNPP

PPNP

PPPN

62

60

12

90

Recency bias: examples near end of prompt dominate predictions — Explains variance across example permutations!

108 of 116

Order of the Examples Matters

Indeed, some permutations are “fantastic”…

Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivity , ACL 2022

Depending on the example order in the prompt, we can get

  • Near state-of-the-art accuracy
  • Near random accuracy

109 of 116

Order of the Examples: Majority and Recency Biases

Calibrate Before Use: Improving Few-Shot Performance of Language Models , ICML 2021

Depending on labels and their order, we get very different average predicted probability of the positive class

Same test set, different prompts

110 of 116

True Labels Do Not Matter

Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? , EMNLP 2022

111 of 116

True Labels Do Not Matter

This is not important!

I.e., the model does not “understand” what we want

Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? , EMNLP 2022

112 of 116

True Labels Do Not Matter

This is important

Rethinking the Role of Demonstrations: What Makes In-Context Learning Work? , EMNLP 2022

113 of 116

AutoPrompt: The Best Prompts are Gibberish!

In iterations, change trigger tokens to improve things

Source: AUTOPROMPT: Eliciting Knowledge from Language Models with Automatically Generated Prompts , 2020

114 of 116

AutoPrompt: The Best Prompts are Gibberish!

Source: AUTOPROMPT: Eliciting Knowledge from Language Models with Automatically Generated Prompts , 2020

115 of 116

AutoPrompt: The Best Prompts are Gibberish!

Examples are from: iPrompt: Explaining Data Patterns in Natural Language via Interpretable Autoprompting

116 of 116

Summary Thus Far

  • In-context learning:
    • Pre-trained LMs imitated examples provided in their context. (why??)

  • It turns out there is a huge variance in performance depending on the encoding.
    • The choice of demonstrations, their order, wording, etc.
    • You can treat them as hyper-parameters
    • You should not choose these encodings based on the test data.

  • Generally, you want to an encoding that makes your task similar to language modeling — closer to what is observed during pretraining.

116