SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2103.15316 · 2021

Whitening Sentence Representations for Better Semantics and Faster Retrieval

arXiv · PDF · Open in the Atlas

Code that ran

2 of 5 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, 1 violated it and 0 have no contract verdict; 0 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2103.15316.json · badge: /api/ran/2103.15316.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
sleepthroughdifficulties/kernelwhitening reimplementation (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
autoliuweijie/bert-whitening-pytorch reimplementation (classifier label)
classifier basis: classifier_2025
0 ran · 3 no recorded run
FunctionStatusWhere it lives
check_data Ran
ran, violated the contract we drafted
sleepthroughdifficulties/kernelwhitening/EMNLP22/utilis/datasets.py
code served (permissive licence) · get_code("d259d4952723bb10")
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) and returned bool, ndim 0, dtype family float, shape () 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

torch.manual_seed(0)

# The function check_data takes three parameters: s1, s2, and args
# It calls .split() on s1 and s2, so they must be strings
# It checks if the length of split results is 0
# The args parameter is not used in the function body

s1 = "hello world"
s2 = "foo bar baz"

args = {}

ARGS = {
    "s1": s1,
    "s2": s2,
    "args": args
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () 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
processSentences Ran
ran, honoured the contract we drafted
sleepthroughdifficulties/kernelwhitening/EMNLP22/utilis/datasets.py
code served (permissive licence) · get_code("ea5e089cab451f0a")
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) and returned tuple, ndim 3, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim 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
from transformers import AutoTokenizer

torch.manual_seed(0)

# Create a minimal tokenizer stand-in that implements the required interface
class MinimalTokenizer:
    def encode_plus(self, sent1, sent2, max_length=128, truncation=True, padding='max_length'):
        # Simulate tokenization by creating dummy token IDs
        # Combine both sentences and create token IDs
        combined = sent1 + " " + sent2
        tokens = combined.split()
        
        # Create input_ids (dummy token IDs)
        input_ids = [101] + [i + 1000 for i in range(min(len(tokens), max_length - 2))] + [102]
        
        # Pad to max_length
        if len(input_ids) < max_length:
            input_ids = input_ids + [0] * (max_length - len(input_ids))
        else:
            input_ids = input_ids[:max_length]
        
        # Create attention mask (1 for real tokens, 0 for padding)
        attention_mask = [1 if i < len(tokens) + 2 else 0 for i in range(max_length)]
        
        # Create token_type_ids (0 for first sentence, 1 for second)
        token_type_ids = [0] * (max_length // 2) + [1] * (max_length - max_length // 2)
        
        return {
            'input_ids': input_ids,
            'attention_mask': attention_mask,
            'token_type_ids': token_type_ids
        }

# Create test data
tokenizer = MinimalTokenizer()
samples1_list = ["Hello world", "This is a test"]
samples2_list = ["How are you", "Another sentence"]

ARGS = {
    'tokenizer': tokenizer,
    'samples1_list': samples1_list,
    'samples2_list': samples2_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family int — a tuple output has no array shape of its own; none is stated
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
batcher Not yet run
unverified (harvested, no recorded run)
autoliuweijie/bert-whitening-pytorch/eval_with_whitening(nli).py
code served (permissive licence) · get_code("85db364c67187a22")
How it ran

no invocation recorded.

prepare Not yet run
unverified (harvested, no recorded run)
autoliuweijie/bert-whitening-pytorch/eval_with_whitening(nli).py
code served (permissive licence) · get_code("9ca27cd7321dc94d")
How it ran

no invocation recorded.

prepare Not yet run
unverified (harvested, no recorded run)
autoliuweijie/bert-whitening-pytorch/eval_with_whitening(target).py
code served (permissive licence) · get_code("41a1326c23b14192")
How it ran

no invocation recorded.

Also present in other papers' code

Of 5 samples lifted from this paper's linked repositories, 5 carry a function identity and 0 do not. Of the 5 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 5 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.

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

Repositories linked to this paper

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

Abstract

Pre-training models such as BERT have achieved great success in many natural language processing tasks. However, how to obtain better sentence representation through these pre-training models is still worthy to exploit. Previous work has shown that the anisotropy problem is an critical bottleneck for BERT-based sentence representation which hinders the model to fully utilize the underlying semantic features. Therefore, some attempts of boosting the isotropy of sentence distribution, such as flow-based model, have been applied to sentence representations and achieved some improvement. In this paper, we find that the whitening operation in traditional machine learning can similarly enhance the isotropy of sentence representations and achieve competitive results. Furthermore, the whitening technique is also capable of reducing the dimensionality of the sentence representation. Our experimental results show that it can not only achieve promising performance but also significantly reduce the storage cost and accelerate the model retrieval speed.

For agents

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

get_harvested_code_for_paper("2103.15316")
get_code_for_paper("2103.15316")
have("2103.15316")

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

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

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

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

Connect an agent — have() is free.