SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2311.05296 · 2023

BeLLM: Backward Dependency Enhanced Large Language Model for Sentence Embeddings

arXiv · PDF · Open in the Atlas

Code that ran

7 of 7 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 0 have no contract verdict; 7 failures of our instrument; 0 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/2311.05296.json · badge: /api/ran/2311.05296.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
SeanLee97/AnglE canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
angle_loss Ran
ran; our contract draft was wrong, not the code
SeanLee97/AnglE/angle_emb/loss.py
code served (permissive licence) · get_code("6ed9f1e379c06231")
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 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

torch.manual_seed(0)

# Construct y_true: zigzag style [x[0][0], x[0][1], x[1][0], x[1][1], ...]
# We need pairs, so let's create 4 elements (2 pairs)
# Shape should be (4, 1) based on how it's indexed as y_true[::2, 0]
y_true = torch.tensor([[1.0], [0.5], [2.0], [1.5], [3.0], [2.5], [4.0], [3.5]])

# Construct y_pred: zigzag style with real and imaginary parts
# The function does torch.chunk(y_pred, 2, dim=1) so it expects shape (N, 2)
# It then indexes [::2] and [1::2], so we need an even number of rows
# Let's create shape (8, 2) to match y_true's 8 rows
y_pred = torch.randn(8, 2)

# tau: scale factor
tau = 1.0

# pooling_strategy: can be 'sum' or 'mean'
pooling_strategy = 'sum'

ARGS = {
    'y_true': y_true,
    'y_pred': y_pred,
    'tau': tau,
    'pooling_strategy': pooling_strategy,
}
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 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
categorical_crossentropy_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SeanLee97/AnglE/angle_emb/loss.py
code served (permissive licence) · get_code("4c17f05a6c7ab88d")
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 1, dtype family float, shape (2,) 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.functional as F

torch.manual_seed(0)

# Create small tensors for testing
batch_size = 2
num_classes = 4

# y_true: ground truth labels as one-hot encoded vectors
# Shape: (batch_size, num_classes)
y_true = torch.zeros(batch_size, num_classes)
y_true[0, 1] = 1.0  # First sample has class 1
y_true[1, 3] = 1.0  # Second sample has class 3

# y_pred: model predictions (logits, not softmax)
# Shape: (batch_size, num_classes)
y_pred = torch.randn(batch_size, num_classes)

# from_logits: boolean flag indicating if y_pred contains logits
from_logits = True

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
    "from_logits": from_logits
}
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 1, dtype family float, shape (2,) — shape (2,) 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
cosine_loss Ran
ran; our contract draft was wrong, not the code
SeanLee97/AnglE/angle_emb/loss.py
code served (permissive licence) · get_code("0f81bf914723e107")
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 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.functional as F

torch.manual_seed(0)

# The function expects:
# - y_true: torch.Tensor in zigzag style [x[0][0], x[0][1], x[1][0], x[1][1], ...]
#   It indexes with [::2, 0], so it needs at least 2 dimensions with the second dim >= 1
# - y_pred: torch.Tensor in zigzag style, normalized and summed pairwise
#   It indexes with [::2] and [1::2], so needs even number of rows
#   It's normalized on dim=1, so needs at least 2 dimensions
# - tau: float, scale factor

# Create y_true: zigzag pairs means we need even number of rows
# Shape: (4, 1) - 4 rows to get 2 pairs when indexed [::2]
# Each row represents one element in zigzag order
y_true = torch.tensor([
    [0.1],
    [0.2],
    [0.3],
    [0.4]
], dtype=torch.float32)

# Create y_pred: must be normalizable on dim=1, needs even rows for [::2] and [1::2]
# Shape: (4, 3) - 4 rows (2 pairs), 3 features for normalization
y_pred = torch.tensor([
    [1.0, 2.0, 3.0],
    [0.5, 1.5, 2.5],
    [2.0, 1.0, 0.5],
    [1.5, 0.5, 1.0]
], dtype=torch.float32)

tau = 20.0

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
    "tau": tau
}
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 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
cosine_similarity Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SeanLee97/AnglE/angle_emb/utils.py
code served (permissive licence) · get_code("9af44343ac96ad7f")
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 float64, ndim 0, dtype family float; 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
import numpy as np
from scipy import spatial

# Create two simple integer vectors
vec1 = [1, 2, 3, 4]
vec2 = [1, 2, 3, 4]

ARGS = {
    "vec1": vec1,
    "vec2": vec2,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float64, ndim 0, dtype family float — no output shape is stated: observe_signature.py recorded float ndim 0, which disagrees with the fixture run
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
detect_dataset_format Ran
ran; our contract draft was wrong, not the code
SeanLee97/AnglE/angle_emb/angle.py
code served (permissive licence) · get_code("a64391cb1ba6a10e")
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 str. 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.

from datasets import Dataset

# Create a simple dataset with columns that match format 'A'
ds = Dataset.from_dict({
    'text1': ['hello world', 'foo bar'],
    'text2': ['goodbye world', 'baz qux'],
    'label': [0, 1]
})

ARGS = {
    'ds': ds
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
datasets — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not 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
find_all_linear_names Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SeanLee97/AnglE/angle_emb/utils.py
code served (permissive licence) · get_code("1f7e9b5195bb7b08")
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 list, ndim 1, dtype family float; 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
import torch.nn as nn
from transformers import PreTrainedModel

torch.manual_seed(0)

# Create a minimal PreTrainedModel subclass for testing
class MinimalModel(PreTrainedModel):
    def __init__(self):
        # Initialize without calling parent __init__ to avoid config requirement
        nn.Module.__init__(self)
        self.linear1 = nn.Linear(4, 3)
        self.linear2 = nn.Linear(3, 2)
        self.nested = nn.Sequential(
            nn.Linear(2, 4),
            nn.ReLU(),
            nn.Linear(4, 1)
        )
        self.lm_head = nn.Linear(1, 2)
        self.non_linear = nn.ReLU()

model = MinimalModel()

ARGS = {
    "model": model,
    "linear_type": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list 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
get_pooling Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
SeanLee97/AnglE/angle_emb/utils.py
code served (permissive licence) · get_code("05848ee5366200da")
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)

# Create model outputs tensor: (batch_size=2, sequence_length=5, hidden_dim=4)
outputs = torch.randn(2, 5, 4)

# Create inputs dict with attention_mask and input_ids
inputs = {
    'attention_mask': torch.tensor([
        [1, 1, 1, 1, 0],  # First sequence has 4 real tokens
        [1, 1, 1, 0, 0]   # Second sequence has 3 real tokens
    ]),
    'input_ids': torch.tensor([
        [101, 2054, 2003, 999, 102],
        [101, 2054, 2003, 102, 0]
    ])
}

# pooling_strategy can be one of: 'cls', 'cls_avg', 'cls_max', 'last', 'avg', 'mean', 'max', 'all', or int
pooling_strategy = 'cls'

# padding_side can be 'left' or 'right'
padding_side = 'right'

ARGS = {
    'outputs': outputs,
    'inputs': inputs,
    'pooling_strategy': pooling_strategy,
    'padding_side': padding_side
}
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

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 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 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.

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

Sentence embeddings are crucial in measuring semantic similarity. Most recent studies employed large language models (LLMs) to learn sentence embeddings. Existing LLMs mainly adopted autoregressive architecture without explicit backward dependency modeling. Therefore, we examined the effects of backward dependencies in LLMs for semantic similarity measurements. Concretely, we propose a novel model: backward dependency enhanced large language model (BeLLM). It learns sentence embeddings via transforming specific attention layers from uni- to bi-directional. We extensively experiment across various semantic textual similarity (STS) tasks and downstream applications. BeLLM achieves state-of-the-art performance in varying scenarios. It shows that auto-regressive LLMs benefit from backward dependencies for sentence embeddings.

For agents

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

get_harvested_code_for_paper("2311.05296")
get_code_for_paper("2311.05296")
have("2311.05296")

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

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

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

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

Connect an agent — have() is free.