SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2012.15723 · ACL · 2021

Making Pre-trained Language Models Better Few-shot Learners

Adam Fisch, Danqi Chen, Tianyu Gao

arXiv · PDF · Open in the Atlas

Code that ran

2 of 9 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 7 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2012.15723.json · badge: /api/ran/2012.15723.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ucsb-nlp-chang/promptboosting community
Papers with Code archive
1 ran · 5 no recorded run
facebookresearch/perfect community
Papers with Code archive
1 ran · 0 no recorded run
alrope123/prompt-waywardness community
Papers with Code archive
0 ran · 1 no recorded run
hannight/amulap community
Papers with Code archive
0 ran · 1 no recorded run
FunctionStatusWhere it lives
Adapter Ran
ran on a synthesized input
facebookresearch/perfect/fewshot/adapters/adapter_modeling.py
code served (permissive licence) · get_code("848dfe9da2a6b283")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 2, dtype family float, shape (2, 8) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn
from transformers.activations import get_activation

class Activations(nn.Module):

    def __init__(self, activation_type):
        super().__init__()
        self.f = get_activation(activation_type)

    def forward(self, x):
        return self.f(x)

class Adapter(nn.Module):
    """Conventional adapter latyer."""

    def __init__(self, config, input_dim):
        super().__init__()
        self.config = config
        self.input_dim = input_dim
        self.down_sample_size = self.input_dim // config.reduction_factor
        self.down_sampler = nn.Linear(self.input_dim, self.down_sample_size)
        self.activation = Activations(config.nonlinearity.lower())
        self.up_sampler = nn.Linear(self.down_sample_size, self.input_dim)

    def forward(self, x):
        output = self.down_sampler(x)
        output = self.activation(output)
        return self.up_sampler(output)


class Config:
    def __init__(self, reduction_factor, nonlinearity):
        self.reduction_factor = reduction_factor
        self.nonlinearity = nonlinearity


config = Config(reduction_factor=2, nonlinearity="gelu")

INIT_ARGS = {
    "config": config,
    "input_dim": 8
}

ARGS = {
    "x": torch.randn(2, 8)
}

if __name__ == "__main__":
    adapter = Adapter(**INIT_ARGS)
    output = adapter(**ARGS)
    print(f"Input shape: {ARGS['x'].shape}")
    print(f"Output shape: {output.shape}")
    print("Success!")
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 2, dtype family float, shape (2, 8) — shape (2, 8) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
SentenceTemplate Ran
ran on a synthesized input
ucsb-nlp-chang/promptboosting/src/multicls_trainer.py
pointer only (licence: NONE) · get_code("307acb49942e47f3")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ucsb-nlp-chang/promptboosting when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

BaseMuticlsTrainer Not yet run
unverified (harvested, no recorded run)
ucsb-nlp-chang/promptboosting/src/multicls_trainer.py
pointer only (licence: NONE) · get_code("bf0624569417a8a0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ucsb-nlp-chang/promptboosting when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

MyEmbedding Not yet run
unverified (harvested, no recorded run)
alrope123/prompt-waywardness/model_util.py
pointer only (licence: NONE) · get_code("bfe6f1322cece789")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, alrope123/prompt-waywardness when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

PromptBoostingTrainer Not yet run
unverified (harvested, no recorded run)
ucsb-nlp-chang/promptboosting/src/multicls_trainer.py
pointer only (licence: NONE) · get_code("2d2563d117bf30eb")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ucsb-nlp-chang/promptboosting when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

RoBERTaVTuningClassification Not yet run
unverified (harvested, no recorded run)
ucsb-nlp-chang/promptboosting/src/multicls_trainer.py
pointer only (licence: NONE) · get_code("a61da81d2fd7eec9")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ucsb-nlp-chang/promptboosting when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

RobertaForPromptFinetuning Not yet run
unverified (harvested, no recorded run)
hannight/amulap/models.py
code served (permissive licence) · get_code("13e2332945c4e127")
How it ran

no invocation recorded.

TestPredictionSaver Not yet run
unverified (harvested, no recorded run)
ucsb-nlp-chang/promptboosting/src/multicls_trainer.py
pointer only (licence: NONE) · get_code("d6b16c1ebf5bf7fe")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ucsb-nlp-chang/promptboosting when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

generate_multicls_l1_label_set_with_cache Not yet run
unverified (harvested, no recorded run)
ucsb-nlp-chang/promptboosting/src/multicls_trainer.py
pointer only (licence: NONE) · get_code("7424c5b4dbe4fa38")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, ucsb-nlp-chang/promptboosting when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. No invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 2 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 2 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
TestPredictionSaver
brick of this paper's assembly: helper
1 other paper
1 later
2212.09257 (2022-12)
PromptBoosting: Black-Box Text Classification with Ten Forward Passes
generate_multicls_l1_label_set_with_cache
brick of this paper's assembly: helper
1 other paper
1 later
2212.09257 (2022-12)
PromptBoosting: Black-Box Text Classification with Ten Forward Passes

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The recent GPT-3 model (Brown et al., 2020) achieves remarkable few-shot performance solely by leveraging a natural-language prompt and a few task demonstrations as input context. Inspired by their findings, we study few-shot learning in a more practical scenario, where we use smaller language models for which fine-tuning is computationally efficient. We present LM-BFF-better few-shot fine-tuning of language models 1 -a suite of simple and complementary techniques for finetuning language models on a small number of annotated examples. Our approach includes (1) prompt-based fine-tuning together with a novel pipeline for automating prompt generation; and (2) a refined strategy for dynamically and selectively incorporating demonstrations into each context. Finally, we present a systematic evaluation for analyzing few-shot performance on a range of NLP tasks, including classification and regression. Our experiments demonstrate that our methods combine to dramatically outperform standard fine-tuning procedures in this low resource setting, achieving up to 30% absolute improvement, and 11% on average across all tasks. Our approach makes minimal assumptions on task resources and domain expertise, and hence constitutes a strong task-agnostic method for few-shot learning. 2 * The first two authors contributed equally. MLM head ••• no utterly ✔ ••• MLM head great (label:positive) terrible (label:negative) ✔ label:positive label:negative ✔ CLS head [CLS] No reason to watch . It was [MASK] . [SEP] A fun ride . It was great . [SEP] The drama discloses nothing . It was terrible . [SEP] [CLS] No reason to watch . [SEP] [CLS] it's a [MASK] movie in every regard , and [MASK] painful to watch . [SEP] MLM head ••• great terrible ✔ ••• (a) MLM pre-training (b) Fine-tuning (c) Prompt-based fine-tuning with demonstrations (our approach)

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2012.15723")
get_code_for_paper("2012.15723")
have("2012.15723")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2012.15723.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2012.15723.svg)](https://syntology.ai/paper/2012.15723)

Connect an agent — have() is free.