SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2021.acl-long.390 · ACL · 2021

Few-Shot Text Ranking with Meta Adapted Synthetic Weak Supervision

Chenyan Xiong, Zhiyuan Liu, Paul Bennett, Zhenghao Liu, Jie Bao, Si Sun, Yingzhuo Qian, Kaitao Zhang

Open in the Atlas

Code that ran

7 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; 1 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 5 failures of our instrument; 2 no recorded run), measured 2026-11-24; 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/2021.acl-long.390.json · badge: /api/ran/2021.acl-long.390.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
thunlp/MetaAdaptRank canonical (classifier label)
classifier basis: census
7 ran · 2 no recorded run
FunctionStatusWhere it lives
angle_defn Ran
ran; our contract draft was wrong, not the code
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_ctrl.py
code served (permissive licence) · get_code("671a619bed5669a3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) 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

torch.manual_seed(0)

# pos: should be a tensor representing positions
# The function multiplies pos by angle_rates, so pos should be numeric
pos = torch.arange(0, 2, dtype=torch.float32).unsqueeze(1)  # shape: (2, 1)

# i: index used in the calculation (2 * (i // 2) / d_model_size)
# Should be an integer or tensor of integers
i = torch.tensor([0, 1, 2, 3], dtype=torch.long)

# d_model_size: the model dimension size, used as divisor
# Should be a positive integer
d_model_size = 4

ARGS = {
    "pos": pos,
    "i": i,
    "d_model_size": d_model_size
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — 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, 4) — shape (2, 4) 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: none by the harness; any seed is in the setup block
invert_mask Ran
ran; our contract draft was wrong, not the code
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_bart.py
code served (permissive licence) · get_code("c9f6adbecd206460")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (2, 4) 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

torch.manual_seed(0)

# The function expects a 2D attention_mask tensor
# It calls .dim() to check it's 2D, then .eq(0) to create a boolean mask
attention_mask = torch.tensor([[1, 1, 0, 0],
                               [1, 0, 1, 1]], dtype=torch.long)

ARGS = {
    "attention_mask": attention_mask
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — 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, 4) — shape (2, 4) 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: none by the harness; any seed is in the setup block
make_padding_mask Ran
ran; our contract draft was wrong, not the code
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_bart.py
pointer only (licence: MIT); the stored copy get_code serves, from yeliu918/KG-BART, is pointer only (licence: NONE) · get_code("f20c9b1aead27fea")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yeliu918/KG-BART, and GitHub detected no licence in that repository 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.

mish Ran
ran; our contract draft was wrong, not the code
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from llyx97/sparse-and-robust-PLM, is pointer only (licence: NONE) · get_code("060527bb34794b59")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from llyx97/sparse-and-robust-PLM, and GitHub detected no licence in that repository 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.

positional_encoding Ran
ran, honoured the contract we drafted
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_ctrl.py
code served (permissive licence) · get_code("59ac77747a12b1cb")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Tensor, ndim 2, dtype family float, shape (8, 4) 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

torch.manual_seed(0)

ARGS = {
    "position": 8,
    "d_model_size": 4,
    "dtype": torch.float32
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — 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 (8, 4) — shape (8, 4) 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: none by the harness; any seed is in the setup block
scaled_dot_product_attention Ran
ran on a synthesized input
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_ctrl.py
code served (permissive licence) · get_code("27e71cce0a74b944")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type 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 numpy as np

torch.manual_seed(0)

# Construct tiny tensors for q, k, v
# Shape: (batch=2, num_heads=1, seq_len=4, d_k=3)
batch_size = 2
num_heads = 1
seq_len = 4
d_k = 3

q = torch.randn(batch_size, num_heads, seq_len, d_k)
k = torch.randn(batch_size, num_heads, seq_len, d_k)
v = torch.randn(batch_size, num_heads, seq_len, d_k)

# Construct mask: causal mask for attention
# mask shape should be (seq_len, seq_len)
mask = torch.tril(torch.ones(seq_len, seq_len))
mask = torch.where(mask == 0, torch.tensor(1.0), torch.tensor(0.0))

# attention_mask: optional, same shape as scaled_attention_logits
# scaled_attention_logits shape will be (batch=2, num_heads=1, seq_len=4, seq_len=4)
attention_mask = torch.zeros(batch_size, num_heads, seq_len, seq_len)

# head_mask: optional, shape typically (num_heads,) or (batch, num_heads, 1, 1)
head_mask = torch.ones(batch_size, num_heads, 1, 1)

ARGS = {
    "q": q,
    "k": k,
    "v": v,
    "mask": mask,
    "attention_mask": attention_mask,
    "head_mask": head_mask,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is stated
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: none by the harness; any seed is in the setup block
shift_tokens_right Ran
ran; our contract draft was wrong, not the code
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_bart.py
pointer only (licence: MIT); the stored copy get_code serves, from yeliu918/KG-BART, is pointer only (licence: NONE) · get_code("e00ccf7847d12b59")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from yeliu918/KG-BART, and GitHub detected no licence in that repository 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.

load_tf_weights_in_albert Not yet run
unverified (harvested, no recorded run)
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_albert.py
pointer only (licence: MIT); the stored copy get_code serves, from microsoft/fastformers, is pointer only (licence: NOASSERTION) · get_code("08a158e902f91371")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from microsoft/fastformers, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

load_tf_weights_in_bert Not yet run
unverified (harvested, no recorded run)
thunlp/MetaAdaptRank/contrastqg/transformers/modeling_bert.py
pointer only (licence: MIT); the stored copy get_code serves, from llyx97/sparse-and-robust-PLM, is pointer only (licence: NONE) · get_code("0766f48ad6e01b56")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from llyx97/sparse-and-robust-PLM, and GitHub detected no licence in that repository 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, 8 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 7 later) and 1 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
mish 19 other papers
3 dated earlier, 11 later, 5 same year, order not determinable
2006.04884 (2020-06)
On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselines
2007.12223 (2020-07)
The Lottery Ticket Hypothesis for Pre-trained BERT Networks
2012.07463 (2020-12)
Parameter-Efficient Transfer Learning with Diff Pruning
and 16 more not named here
load_tf_weights_in_bert 16 other papers
3 dated earlier, 9 later, 4 same year, order not determinable
2006.04884 (2020-06)
On the Stability of Fine-tuning BERT: Misconceptions, Explanations, and Strong Baselines
2007.12223 (2020-07)
The Lottery Ticket Hypothesis for Pre-trained BERT Networks
2012.07463 (2020-12)
Parameter-Efficient Transfer Learning with Diff Pruning
and 13 more not named here
shift_tokens_right 11 other papers
3 dated earlier, 5 later, 3 same year, order not determinable
1910.13461 (2019-10)
BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
2009.12005 (2020-09)
MinTL: Minimalist Transfer Learning for Task-Oriented Dialogue Systems
2009.12677 (2020-09)
KG-BART: Knowledge Graph-Augmented BART for Generative Commonsense Reasoning
and 8 more not named here
invert_mask 10 other papers
3 dated earlier, 4 later, 3 same year, order not determinable
1910.13461 (2019-10)
BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
2009.12005 (2020-09)
MinTL: Minimalist Transfer Learning for Task-Oriented Dialogue Systems
2009.12677 (2020-09)
KG-BART: Knowledge Graph-Augmented BART for Generative Commonsense Reasoning
and 7 more not named here
make_padding_mask 9 other papers
3 dated earlier, 2 later, 4 same year, order not determinable
1910.13461 (2019-10)
BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension
2009.12005 (2020-09)
MinTL: Minimalist Transfer Learning for Task-Oriented Dialogue Systems
2009.12677 (2020-09)
KG-BART: Knowledge Graph-Augmented BART for Generative Commonsense Reasoning
and 6 more not named here
angle_defn 2 other papers
2 later
2212.03506 (2022-12)
WIDER & CLOSER: Mixture of Short-channel Distillers for Zero-shot Cross-lingual Named Entity Recognition
2404.19563 (2024-04)
RepEval: Effective Text Evaluation with LLM Representation
load_tf_weights_in_albert 2 other papers
1 dated earlier, 1 same year, order not determinable
2010.13382 (2020-10)
FastFormers: Highly Efficient Transformer Models for Natural Language Understanding
2021.findings-acl.216 (2021 (year only))
Dynamic Connected Networks for Chinese Spelling Check
positional_encoding 2 other papers
2 later
2212.03506 (2022-12)
WIDER & CLOSER: Mixture of Short-channel Distillers for Zero-shot Cross-lingual Named Entity Recognition
2404.19563 (2024-04)
RepEval: Effective Text Evaluation with LLM Representation

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-24.

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 effectiveness of Neural Information Retrieval (Neu-IR) often depends on a large scale of in-domain relevance training signals, which are not always available in real-world ranking scenarios. To democratize the benefits of Neu-IR, this paper presents MetaAdaptRank, a domain adaptive learning method that generalizes Neu-IR models from label-rich source domains to few-shot target domains. Drawing on source-domain massive relevance supervision, MetaAdaptRank contrastively synthesizes a large number of weak supervision signals for target domains and meta-learns to reweight these synthetic "weak" data based on their benefits to the target-domain ranking accuracy of Neu-IR models. Experiments on three TREC benchmarks in the web, news, and biomedical domains show that MetaAdaptRank significantly improves the few-shot ranking accuracy of Neu-IR models. Further analyses indicate that MetaAdaptRank thrives from both its contrastive weak data synthesis and metareweighted data selection. The code and data of this paper can be obtained from https: //github.com/thunlp/MetaAdaptRank.

For agents

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

get_harvested_code_for_paper("2021.acl-long.390")
get_code_for_paper("2021.acl-long.390")
have("2021.acl-long.390")

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

curl https://syntology.ai/api/ran/2021.acl-long.390.json

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

[![Syntology run record](https://syntology.ai/api/ran/2021.acl-long.390.svg)](https://syntology.ai/paper/2021.acl-long.390)

Connect an agent — have() is free.