SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2206.07023 · 2022

SBERT studies Meaning Representations: Decomposing Sentence Embeddings into Explainable Semantic Features

arXiv · PDF · Open in the Atlas

Code that ran

6 of 10 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 6 have no contract verdict; 0 failures of our instrument; 4 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/2206.07023.json · badge: /api/ran/2206.07023.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
flipz357/S3BERT canonical (classifier label)
classifier basis not recorded on the link
6 ran · 4 no recorded run
FunctionStatusWhere it lives
cosine_sim Ran
ran on a synthesized input
flipz357/S3BERT/src/prediction_helpers.py
code served (permissive licence) · get_code("b7d99c0d0c53c89d")
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 ndarray, 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 numpy as np

# The function computes cosine similarity between two matrices
# It expects mat1 and mat2 to be 2D numpy arrays
# The function multiplies them element-wise, computes norms along axis 1,
# and returns normalized dot products

mat1 = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=np.float32)

mat2 = np.array([
    [2.0, 3.0, 4.0, 5.0],
    [1.0, 1.0, 1.0, 1.0]
], dtype=np.float32)

ARGS = {
    "mat1": mat1,
    "mat2": mat2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, 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
dist_sim Ran
ran on a synthesized input
flipz357/S3BERT/src/custom_losses.py
code served (permissive licence) · get_code("866cc73fc6c3e77e")
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
from torch import nn, Tensor

torch.manual_seed(0)

# Create two tensors with distinct batch and dimension sizes
# reps1: batch_size=2, dim=4
reps1 = torch.randn(2, 4)

# reps2: batch_size=2, dim=4
reps2 = torch.randn(2, 4)

ARGS = {
    "reps1": reps1,
    "reps2": reps2,
}
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
get_preds Ran
ran on a synthesized input
flipz357/S3BERT/src/prediction_helpers.py
code served (permissive licence) · get_code("e1930a781ca4e475")
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 ndarray, ndim 2, dtype family float, shape (2, 5) 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 numpy as np

def cosine_sim(mat1, mat2):
    prod = mat1 * mat2
    normf = lambda x: np.sqrt(np.sum(x ** 2, axis=1))
    normx, normy = (normf(mat1), normf(mat2))
    return np.sum(prod, axis=1) / (normx * normy)

# Set up dimensions
batch_size = 2
n_metrics = 3
dim = 4
total_dim = dim * n_metrics + dim  # dim*n metrics + dim residual

# Create xsent_encoded and ysent_encoded matrices
# Shape: (batch_size, total_dim)
xsent_encoded = np.random.randn(batch_size, total_dim).astype(np.float32)
ysent_encoded = np.random.randn(batch_size, total_dim).astype(np.float32)

# Create biases for metrics
biases = np.ones(n_metrics).astype(np.float32)

ARGS = {
    'xsent_encoded': xsent_encoded,
    'ysent_encoded': ysent_encoded,
    'globalsim': cosine_sim,
    'subsim': cosine_sim,
    'biases': biases,
    'n': n_metrics,
    'dim': dim,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family float, shape (2, 5) — shape (2, 5) 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
jload Ran
ran on a synthesized input
flipz357/S3BERT/src/data_helpers.py
code served (permissive licence) · get_code("1779ed436ac80094")
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 dict. 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 json
import tempfile
import os

# Create a temporary JSON file for testing
temp_dir = tempfile.mkdtemp()
test_json_path = os.path.join(temp_dir, "test.json")

# Write a valid JSON file
test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(test_json_path, 'w') as f:
    json.dump(test_data, f)

# Define ARGS with the path parameter
ARGS = {
    "path": test_json_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
manhattan_sim Ran
ran on a synthesized input
flipz357/S3BERT/src/prediction_helpers.py
code served (permissive licence) · get_code("a2fb5897f0d97930")
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 ndarray, 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 numpy as np

# Create two small matrices for testing manhattan_sim
# mat1 and mat2 should be 2D numpy arrays
# The function computes Manhattan distance along axis=1, so we need compatible shapes

mat1 = np.array([
    [1.0, 2.0, 3.0, 4.0],
    [5.0, 6.0, 7.0, 8.0]
], dtype=np.float32)

mat2 = np.array([
    [1.5, 2.5, 3.5, 4.5],
    [5.5, 6.5, 7.5, 8.5]
], dtype=np.float32)

ARGS = {
    "mat1": mat1,
    "mat2": mat2
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, 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
prod_sim Ran
ran on a synthesized input
flipz357/S3BERT/src/custom_losses.py
code served (permissive licence) · get_code("8a73b88b2ee8016a")
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
from torch import nn, Tensor

torch.manual_seed(0)

# Create two small tensors for the dot product operation
# The function expects tensors where:
# - reps1 and reps2 are multiplied element-wise
# - sum is taken over dim=1
# So we need 2D tensors (batch_size, feature_dim)

batch_size = 2
feature_dim = 4

reps1 = torch.randn(batch_size, feature_dim)
reps2 = torch.randn(batch_size, feature_dim)

ARGS = {
    "reps1": reps1,
    "reps2": reps2,
}
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
co_sim Not yet run
unverified (harvested, no recorded run)
flipz357/S3BERT/src/custom_losses.py
code served (permissive licence) · get_code("9e1c02152506aa40")
How it ran

no invocation recorded.

freeze_all_layers Not yet run
unverified (harvested, no recorded run)
flipz357/S3BERT/src/model_freeze.py
code served (permissive licence) · get_code("b67a6e0d4b3fe113")
How it ran

no invocation recorded.

freeze_except_last_layers Not yet run
unverified (harvested, no recorded run)
flipz357/S3BERT/src/model_freeze.py
code served (permissive licence) · get_code("23fe518aded0d9fb")
How it ran

no invocation recorded.

jsave Not yet run
unverified (harvested, no recorded run)
flipz357/S3BERT/src/data_helpers.py
code served (permissive licence) · get_code("f94769cc07de90c4")
How it ran

no invocation recorded.

Also present in other papers' code

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

Models based on large-pretrained language models, such as S(entence)BERT, provide effective and efficient sentence embeddings that show high correlation to human similarity ratings, but lack interpretability. On the other hand, graph metrics for graph-based meaning representations (e.g., Abstract Meaning Representation, AMR) can make explicit the semantic aspects in which two sentences are similar. However, such metrics tend to be slow, rely on parsers, and do not reach state-of-the-art performance when rating sentence similarity. In this work, we aim at the best of both worlds, by learning to induce $S$emantically $S$tructured $S$entence BERT embeddings (S$^3$BERT). Our S$^3$BERT embeddings are composed of explainable sub-embeddings that emphasize various semantic sentence features (e.g., semantic roles, negation, or quantification). We show how to i) learn a decomposition of the sentence embeddings into semantic features, through approximation of a suite of interpretable AMR graph metrics, and how to ii) preserve the overall power of the neural embeddings by controlling the decomposition learning process with a second objective that enforces consistency with the similarity ratings of an SBERT teacher model. In our experimental studies, we show that our approach offers interpretability -- while fully preserving the effectiveness and efficiency of the neural sentence embeddings.

For agents

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

get_harvested_code_for_paper("2206.07023")
get_code_for_paper("2206.07023")
have("2206.07023")

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

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

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

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

Connect an agent — have() is free.