SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2106.08181 · 2021

Direction is what you need: Improving Word Embedding Compression in Large Language Models

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; 1 honoured the contract we drafted, 0 violated it and 6 have no contract verdict; 0 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/2106.08181.json · badge: /api/ran/2106.08181.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
MohammadrezaBanaei/orientation_based_embedding_compression canonical (classifier label)
classifier basis: census
7 ran · 0 no recorded run
FunctionStatusWhere it lives
cosine_distance_loss Ran
ran on a synthesized input
MohammadrezaBanaei/orientation_based_embedding_compression/losses/cosine_distance_loss.py
code served (permissive licence) · get_code("268611043c2b35f8")
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
from torch import nn

torch.manual_seed(0)

# Create small tensors with batch size 2 and dimension 4
output = torch.randn(2, 4)
target = torch.randn(2, 4)
epoch = 5

ARGS = {
    "output": output,
    "target": target,
    "epoch": epoch
}
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
get_layer_params_num Ran
ran on a synthesized input
MohammadrezaBanaei/orientation_based_embedding_compression/utils_funcs.py
code served (permissive licence) · get_code("a92218ae0d90dd05")
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 int, ndim 0, dtype family int, 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)

# Create a small nn.Linear layer
# The function accesses layer.weight and layer.bias, and calls .numel() on them
# A minimal nn.Linear(in_features, out_features) will have:
# - weight shape: (out_features, in_features)
# - bias shape: (out_features,)
layer = nn.Linear(in_features=3, out_features=4)

ARGS = {
    "layer": layer
}
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 int, ndim 0, dtype family int, 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
get_lr Ran
ran, honoured the contract we drafted
MohammadrezaBanaei/orientation_based_embedding_compression/ae_train.py
pointer only (licence: MIT); the stored copy get_code serves, from yjzhang96/UTI-VFI, is pointer only (licence: NONE) · get_code("7337f1f5ff01dcd0")
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 yjzhang96/UTI-VFI, 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.

get_model_weight_dict Ran
ran on a synthesized input
MohammadrezaBanaei/orientation_based_embedding_compression/transformers_data_utils.py
code served (permissive licence) · get_code("204006412d2334a0")
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 torch
import torch.nn as nn
from transformers import AutoModel, AutoTokenizer

torch.manual_seed(0)

# Create a minimal mock BERT model that has the structure expected
class MockBertEmbeddings(nn.Module):
    def __init__(self):
        super().__init__()
        self.word_embeddings = nn.Embedding(100, 8)
        self.position_embeddings = nn.Embedding(512, 8)

class MockBertAttention(nn.Module):
    def __init__(self):
        super().__init__()
        self.self = nn.Linear(8, 8)

class MockBertLayer(nn.Module):
    def __init__(self):
        super().__init__()
        self.attention = MockBertAttention()
        self.intermediate = nn.Linear(8, 32)
        self.output = nn.Linear(32, 8)

class MockBertEncoder(nn.Module):
    def __init__(self, num_layers=2):
        super().__init__()
        self.layer = nn.ModuleList([MockBertLayer() for _ in range(num_layers)])

class MockBertModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.embeddings = MockBertEmbeddings()
        self.encoder = MockBertEncoder(num_layers=2)
    
    def parameters(self):
        return super().parameters()
    
    def state_dict(self):
        state = super().state_dict()
        return state

# We need to mock AutoModel.from_pretrained to return our mock model
original_from_pretrained = AutoModel.from_pretrained

def mock_from_pretrained(model_name, **kwargs):
    return MockBertModel()

AutoModel.from_pretrained = mock_from_pretrained

ARGS = {
    'model_name': 'bert-base-uncased'
}
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 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
l1_norm_loss Ran
ran on a synthesized input
MohammadrezaBanaei/orientation_based_embedding_compression/losses/l1_norm_loss.py
code served (permissive licence) · get_code("79649aea92c2caa0")
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
from torch import nn

torch.manual_seed(0)

# Create small tensors for output and target
batch_size = 2
dim = 4
output = torch.randn(batch_size, dim)
target = torch.randn(batch_size, dim)

# Define epoch
epoch = 5

# Create config dict with required keys
config = {
    'start_alpha': 2.0,
    'end_alpha': 1.0
}

# Define changing_epochs_num
changing_epochs_num = 10

# Define epsilon with default value
epsilon = 1e-10

ARGS = {
    'output': output,
    'target': target,
    'epoch': epoch,
    'config': config,
    'changing_epochs_num': changing_epochs_num,
    'epsilon': epsilon
}
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
l2_norm_loss Ran
ran on a synthesized input
MohammadrezaBanaei/orientation_based_embedding_compression/losses/l2_norm_loss.py
code served (permissive licence) · get_code("25471ca70b09e529")
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
from torch import nn

torch.manual_seed(0)

# Create small tensors for output and target
# Batch size: 2, Feature dimension: 4
output = torch.randn(2, 4)
target = torch.randn(2, 4)

# epoch as an integer
epoch = 1

ARGS = {
    "output": output,
    "target": target,
    "epoch": epoch,
}
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
run_svd Ran
ran on a synthesized input
MohammadrezaBanaei/orientation_based_embedding_compression/utils_funcs.py
code served (permissive licence) · get_code("a3de5ce5addb03b3")
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 numpy as np
from sklearn.decomposition import TruncatedSVD

# Create a small input matrix for SVD
# Using shape (10, 8) - 10 samples, 8 features
np.random.seed(42)
input_matrix = np.random.randn(10, 8)

# Define parameters
latent_dim = 3
n_iter = 2
random_state = 42

ARGS = {
    "input_matrix": input_matrix,
    "latent_dim": latent_dim,
    "n_iter": n_iter,
    "random_state": random_state,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — 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

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, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 6 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
get_lr 25 other papers
8 dated earlier, 16 later, 1 same year, order not determinable · 2 only as an assembly brick
1605.07148 (2016-05)
Backprop KF: Learning Discriminative Deterministic State Estimators
1606.00915 (2016-06)
DeepLab: Semantic Image Segmentation with Deep Convolutional Nets, Atrous Convolution, and Fully Connected CRFs
1904.01355 (2019-04)
FCOS: Fully Convolutional One-Stage Object Detection
and 22 more not named here

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

The adoption of Transformer-based models in natural language processing (NLP) has led to great success using a massive number of parameters. However, due to deployment constraints in edge devices, there has been a rising interest in the compression of these models to improve their inference time and memory footprint. This paper presents a novel loss objective to compress token embeddings in the Transformer-based models by leveraging an AutoEncoder architecture. More specifically, we emphasize the importance of the direction of compressed embeddings with respect to original uncompressed embeddings. The proposed method is task-agnostic and does not require further language modeling pre-training. Our method significantly outperforms the commonly used SVD-based matrix-factorization approach in terms of initial language model Perplexity. Moreover, we evaluate our proposed approach over SQuAD v1.1 dataset and several downstream tasks from the GLUE benchmark, where we also outperform the baseline in most scenarios. Our code is public.

For agents

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

get_harvested_code_for_paper("2106.08181")
get_code_for_paper("2106.08181")
have("2106.08181")

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

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

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

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

Connect an agent — have() is free.