SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2210.12582 · EMNLP · 2022

Language Model Pre-Training with Sparse Latent Typing

Heng Ji, Chengxiang Zhai, Han Wang, Liliang Ren, Zixuan Zhang, Clare Voss

arXiv · PDF · Open in the Atlas

Code that ran

12 of 12 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 8 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-23; 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/2210.12582.json · badge: /api/ran/2210.12582.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
renll/sparselt canonical (classifier label)
classifier basis not recorded on the link
12 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_f1 Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/scorer.py
code served (permissive licence) · get_code("fada67a6d1459131")
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, 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 numpy as np

torch.manual_seed(0)

# Analyze function usage:
# - compute_f1 takes three parameters: predicted, gold, matched
# - All three are used with > operator (compared to 0) and arithmetic operations
# - They appear to be numeric values (counts/scores)
# - safe_div performs division when denom > 0, else returns 0

# Create simple numeric arguments representing counts
predicted = 10  # number of predicted items
gold = 8        # number of gold/true items
matched = 6     # number of correctly matched items

ARGS = {
    "predicted": predicted,
    "gold": gold,
    "matched": matched
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — 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
convert_arguments Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/scorer.py
code served (permissive licence) · get_code("09b5a097f3682dd3")
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 set. 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 numpy as np

torch.manual_seed(0)

# Build triggers: list of tuples where last element is trigger_label
triggers = [
    ("trigger_0", "label_A"),
    ("trigger_1", "label_B"),
    ("trigger_2", "label_C"),
]

# Build entities: list of tuples (arg_start, arg_end, entity_info)
entities = [
    (0, 5, "entity_0"),
    (10, 15, "entity_1"),
    (20, 25, "entity_2"),
    (30, 35, "entity_3"),
]

# Build roles: list of tuples (trigger_idx, entity_idx, role)
roles = [
    (0, 0, "subject"),
    (0, 1, "object"),
    (1, 2, "agent"),
    (2, 3, "patient"),
]

ARGS = {
    "triggers": triggers,
    "entities": entities,
    "roles": roles,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
gelu Ran
ran; our contract draft was wrong, not the code
renll/sparselt/model.py
code served (permissive licence) · get_code("d9dcfb510a5e2690")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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
import math

torch.manual_seed(0)

x = torch.randn(2, 4)

ARGS = {
    'x': x
}
Setup block drafted by
a language model, Claude Sonnet 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 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
get_entity_labels Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/data.py
code served (permissive licence) · get_code("7977941eee570187")
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

# Define ARGS for get_entity_labels function
ARGS = {
    'entities': [
        {
            'start': 0,
            'end': 2,
            'entity_type': 'PERSON'
        },
        {
            'start': 3,
            'end': 5,
            'entity_type': 'LOCATION'
        }
    ],
    'token_num': 7
}
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 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_span_mention_text Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/convert.py
code served (permissive licence) · get_code("d8fb460267273049")
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, 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 numpy as np

torch.manual_seed(0)

# Analyzing the function:
# - tokens: list of strings (accessed by index with slicing)
# - token_ids: list of strings with format "doc_id:start-end" (accessed by index with slicing, split operations)
# - start: int (index into tokens and token_ids)
# - end: int (index into tokens and token_ids, used as exclusive upper bound)

# The function processes spans of tokens and reconstructs text from character positions
# stored in token_ids strings

# Create sample tokens and token_ids
# token_ids format: "doc_id:char_start-char_end"
tokens = ["The", "quick", "brown", "fox"]
token_ids = [
    "doc1:0-2",      # "The" spans chars 0-2
    "doc1:4-8",      # "quick" spans chars 4-8
    "doc1:10-14",    # "brown" spans chars 10-14
    "doc1:16-18",    # "fox" spans chars 16-18
]

# Test with a span that includes multiple tokens
start = 0
end = 3

ARGS = {
    "tokens": tokens,
    "token_ids": token_ids,
    "start": start,
    "end": end,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — 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
get_trigger_labels Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/data.py
code served (permissive licence) · get_code("c92222981e1a0a3f")
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 numpy as np

ARGS = {
    'events': [
        {
            'trigger': {'start': 0, 'end': 2},
            'event_type': 'Attack'
        },
        {
            'trigger': {'start': 3, 'end': 5},
            'event_type': 'Meeting'
        }
    ],
    'token_num': 7
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — 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
load_mapping Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/convert.py
code served (permissive licence) · get_code("422237a1d98228f2")
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 tempfile
import os

# Create a temporary mapping file
temp_dir = tempfile.mkdtemp()
mapping_file = os.path.join(temp_dir, "mapping.txt")

with open(mapping_file, 'w', encoding='utf-8') as f:
    f.write("type_a\ttype_x\n")
    f.write("type_b\ttype_y\n")
    f.write("type_c\ttype_z\n")

ARGS = {
    "mapping_file": mapping_file
}
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
log_sum_exp Ran
ran; our contract draft was wrong, not the code
renll/sparselt/evaluations/supervised-ie/model.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from PlusLabNLP/TagPrime, is pointer only (licence: NONE) · get_code("bd9ad74746bdeace")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from PlusLabNLP/TagPrime, 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.

remove_overlap_entities Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/data.py
code served (permissive licence) · get_code("006b8e682f7dfff0")
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

# Construct a list of entity mentions as dictionaries
# Each entity has 'id', 'start', and 'end' keys
entities = [
    {'id': 1, 'start': 0, 'end': 3},
    {'id': 2, 'start': 5, 'end': 8},
    {'id': 3, 'start': 2, 'end': 6},  # overlaps with entity 1
    {'id': 4, 'start': 10, 'end': 12},
]

ARGS = {
    'entities': entities,
}
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_div Ran
ran on a synthesized input
renll/sparselt/evaluations/supervised-ie/scorer.py
code served (permissive licence) · get_code("ac4edaf53cf349f7")
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 float, 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 numpy as np

torch.manual_seed(0)

# Analyze the function:
# safe_div(num, denom) performs a comparison denom > 0, then division num / denom
# Both num and denom should support > comparison and division operations
# They can be scalars, tensors, or numpy arrays

# Simple scalar case
num = 10
denom = 5

ARGS = {
    "num": num,
    "denom": denom,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, 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
sequence_mask Ran
ran; our contract draft was wrong, not the code
renll/sparselt/evaluations/supervised-ie/model.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from PlusLabNLP/TagPrime, is pointer only (licence: NONE) · get_code("f9379a80bc4cfd5a")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from PlusLabNLP/TagPrime, 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.

token_lens_to_offsets Ran
ran, honoured the contract we drafted
renll/sparselt/evaluations/supervised-ie/model.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from PlusLabNLP/TagPrime, is pointer only (licence: NONE) · get_code("c5fe6d1a240e86e5")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from PlusLabNLP/TagPrime, 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.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 8 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 1 the same month, 8 later) and 4 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
gelu 51 other papers
32 dated earlier, 1 the same month, 16 later, 2 same year, order not determinable · 8 only as an assembly brick
1706.03762 (2017-06)
Attention Is All You Need
1810.04805 (2018-10)
BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding
1901.02860 (2019-01)
Transformer-XL: Attentive Language Models Beyond a Fixed-Length Context
and 48 more not named here
safe_div 3 other papers
2 dated earlier, 1 later
2104.05919 (2021-04)
Document-Level Event Argument Extraction by Conditional Generation
2106.15838 (2021-06)
HySPA: Hybrid Span Generation for Scalable Text-to-Graph Extraction
2304.11633 (2023-04)
Evaluating ChatGPT's Information Extraction Capabilities: An Assessment of Performance, Explainability, Calibration, and Faithfulness
token_lens_to_offsets 3 other papers
2 dated earlier, 1 later
2203.08929 (2022-03)
An Analysis of Negation in Natural Language Understanding Corpora
2205.12585 (2022-05)
TAGPRIME: A Unified Framework for Relational Structure Extraction
2024.findings-acl.760 (2024 (year only))
TEXTEE: Benchmark, Reevaluation, Reflections, and Future Challenges in Event Extraction
compute_f1 2 other papers
1 dated earlier, 1 later
2106.15838 (2021-06)
HySPA: Hybrid Span Generation for Scalable Text-to-Graph Extraction
2304.11633 (2023-04)
Evaluating ChatGPT's Information Extraction Capabilities: An Assessment of Performance, Explainability, Calibration, and Faithfulness
log_sum_exp 2 other papers
1 dated earlier, 1 later
2205.12585 (2022-05)
TAGPRIME: A Unified Framework for Relational Structure Extraction
2024.findings-acl.760 (2024 (year only))
TEXTEE: Benchmark, Reevaluation, Reflections, and Future Challenges in Event Extraction
sequence_mask 2 other papers
1 dated earlier, 1 later
2205.12585 (2022-05)
TAGPRIME: A Unified Framework for Relational Structure Extraction
2024.findings-acl.760 (2024 (year only))
TEXTEE: Benchmark, Reevaluation, Reflections, and Future Challenges in Event Extraction
get_trigger_labels 1 other paper
1 later
2024.findings-acl.760 (2024 (year only))
TEXTEE: Benchmark, Reevaluation, Reflections, and Future Challenges in Event Extraction
remove_overlap_entities 1 other paper
1 later
2024.findings-acl.760 (2024 (year only))
TEXTEE: Benchmark, Reevaluation, Reflections, and Future Challenges in Event Extraction

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

Modern large-scale Pre-trained Language Models (PLMs) have achieved tremendous success on a wide range of downstream tasks. However, most of the LM pre-training objectives only focus on text reconstruction, but have not sought to learn latent-level interpretable representations of sentences. In this paper, we manage to push the language models to obtain a deeper understanding of sentences by proposing a new pre-training objective, Sparse Latent Typing, which enables the model to sparsely extract sentence-level keywords with diverse latent types. Experimental results show that our model is able to learn interpretable latent type categories in a self-supervised manner without using any external knowledge. Besides, the language model pre-trained with such an objective also significantly improves Information Extraction related downstream tasks in both supervised and few-shot settings. Our code is publicly available at https://github.com/renll/ SparseLT. * Equal contribution. Listing order is random. Liliang proposed and implemented the architecture designs and the training objectives of Sparse Latent Typing (SLT), and he also conducted extensive experiments for pre-training, few-shot evaluation and the analyses. Zixuan designed the language model pre-training pipeline for SLT, built the initial training codebase and conducted experiments for pre-training and supervised evaluation. Both of the authors initially came up with the same project goal of encouraging the model to sparsely select sentence-level key words during pre-training.

For agents

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

get_harvested_code_for_paper("2210.12582")
get_code_for_paper("2210.12582")
have("2210.12582")

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

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

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

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

Connect an agent — have() is free.