SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2603.10913 · 2026

LLM2VEC-GEN: Generative Embeddings from Large Language Models

Marius Mosbach, Siva Reddy, Nicolas Chapados, Parishad Behnamghader, Vaibhav Adlakha, Fabian Schmidt

arXiv · PDF · Open in the Atlas

Code that ran

4 of 5 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (1 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2603.10913.json · badge: /api/ran/2603.10913.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
McGill-NLP/llm2vec-gen community
Papers with Code archive
4 ran · 1 no recorded run
FunctionStatusWhere it lives
ProjectionModel Ran
ran on a synthesized input · constructed an object; no result was computed
McGill-NLP/llm2vec-gen/llm2vec_gen/models/modeling_encoder_decoder.py
code served (permissive licence) · get_code("f615629a46cf0ccd")
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 an instance of its own class, ProjectionModel: the run constructed the object and did not call it, so no result was computed. 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

torch.manual_seed(0)

ARGS = {
    'input_dim': 4,
    'output_dim': 3,
    'dtype': torch.float32,
    'size': 1,
    'pooling_mode': 'linear'
}
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 ProjectionModel — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a ProjectionModel 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
custom_constructor Ran
ran; our contract draft was wrong, not the code
McGill-NLP/llm2vec-gen/llm2vec_gen/models/modeling_encoder_decoder.py
code served (permissive licence) · get_code("58f0830a33792738")
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.

import yaml

class MockLoader:
    """Stand-in YAML loader with minimal methods"""
    def construct_scalar(self, node):
        return "scalar_value"
    
    def construct_sequence(self, node):
        return [1, 2, 3]

# Create test nodes
scalar_node = yaml.ScalarNode(tag='!test', value='test_value')
sequence_node = yaml.SequenceNode(tag='!test', value=[
    yaml.ScalarNode(tag='tag:yaml.org,2002:int', value='42')
])

# Create loader instance
loader = MockLoader()

ARGS = {
    'loader': loader,
    'tag_suffix': 'custom',
    'node': scalar_node
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
prepend_prompt_to_left_padded_tok_embeds Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
McGill-NLP/llm2vec-gen/llm2vec_gen/models/modeling_encoder_decoder.py
code served (permissive licence) · get_code("5ba2d9c2ed0f59ff")
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

torch.manual_seed(0)

# Define tensor dimensions
batch_size = 2
seq_length = 5
hidden_dim = 4
prompt_length = 3

# Create tok_embeds: (B, T, H) with left padding
# Left-padded means first few tokens are PADs
tok_embeds = torch.randn(batch_size, seq_length, hidden_dim, dtype=torch.float32)

# Create dec_attention_mask: (B, T)
# 0 for PAD (left side), 1 for real tokens (right side)
# Example: [0, 0, 1, 1, 1] means 2 PADs, 3 real tokens
dec_attention_mask = torch.tensor([
    [0, 0, 1, 1, 1],
    [0, 1, 1, 1, 1]
], dtype=torch.long)

# Create prompt_embeds: (B, K, H) where K is fixed prompt length
prompt_embeds = torch.randn(batch_size, prompt_length, hidden_dim, dtype=torch.float32)

# Create labels: (B, T)
# -100 is typically used to ignore certain positions in loss computation
labels = torch.randint(-100, 100, (batch_size, seq_length), dtype=torch.long)

ARGS = {
    "tok_embeds": tok_embeds,
    "dec_attention_mask": dec_attention_mask,
    "prompt_embeds": prompt_embeds,
    "labels": labels,
}
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 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
safe_load_config Ran
ran; our contract draft was wrong, not the code
McGill-NLP/llm2vec-gen/llm2vec_gen/models/modeling_encoder_decoder.py
code served (permissive licence) · get_code("2d28f2510ec94d25")
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 yaml
import tempfile
import os

# Create a temporary YAML config file
temp_dir = tempfile.mkdtemp()
config_path = os.path.join(temp_dir, "test_config.yaml")

# Write a simple valid YAML config
config_content = """
model:
  name: test_model
  layers: 3
  hidden_dim: 64
training:
  batch_size: 32
  epochs: 10
  learning_rate: 0.001
"""

with open(config_path, 'w') as f:
    f.write(config_content)

ARGS = {
    'config_path': config_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
EncoderDecoderModel Not yet run
unverified (harvested, no recorded run)
McGill-NLP/llm2vec-gen/llm2vec_gen/models/modeling_encoder_decoder.py
code served (permissive licence) · get_code("4f5fca7e6d82b118")
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-23.

Repositories linked to this paper

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

Abstract

Fine-tuning LLM-based text embedders via contrastive learning maps inputs and outputs into a new representational space, discarding the LLM's output semantics. We propose LLM2VEC-GEN, a self-supervised alternative that instead produces embeddings directly in the LLM's output space by learning to represent the model's potential response. Specifically, trainable special tokens are appended to the input and optimized to compress the LLM's own response into a fixed-length embedding, guided by an unsupervised embedding teacher and a reconstruction objective. Crucially, the LLM backbone remains frozen and training requires only unlabeled queries. LLM2VEC-GEN achieves state-of-the-art self-supervised performance on the Massive Text Embedding Benchmark (MTEB), improving by 8.8% over the unsupervised embedding teacher. Since the embeddings preserve the LLM's response-space semantics, they inherit capabilities such as safety alignment (up to 22.6% reduction in harmful content retrieval) and reasoning (up to 35.6% improvement on reasoning-intensive retrieval). Finally, the learned embeddings are also interpretable: they can be decoded back into text to reveal their semantic content. Our code, data, and pretrained models are publicly available at github.com/McGill-NLP/llm2vec-gen.

For agents

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

get_harvested_code_for_paper("2603.10913")
get_code_for_paper("2603.10913")
have("2603.10913")

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

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

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

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

Connect an agent — have() is free.