SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1508.01991 · 2015

Bidirectional LSTM-CRF Models for Sequence Tagging

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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 8 have no contract verdict; 0 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/1508.01991.json · badge: /api/ran/1508.01991.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
jidasheng/bi-lstm-crf community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
ngoquanghuy99/POS-Tagging-BiLSTM-CRF community (classifier label)
classifier basis not recorded on the link
4 ran · 0 no recorded run
FunctionStatusWhere it lives
arguments_filepath Ran
ran on a synthesized input
jidasheng/bi-lstm-crf/bi_lstm_crf/app/utils.py
code served (permissive licence) · get_code("37cca9481c5cf8bc")
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 torch
import torch.nn as nn
from os.path import exists, join

torch.manual_seed(0)

# The function takes a single parameter: model_dir
# It constructs a filepath by joining model_dir with FILE_ARGUMENTS
# The function only uses string operations (join) on model_dir
# So model_dir should be a string representing a directory path

model_dir = "/tmp/test_model"

ARGS = {
    "model_dir": model_dir,
}
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 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
build_vocab Ran
ran on a synthesized input
ngoquanghuy99/POS-Tagging-BiLSTM-CRF/build_vocabulary.py
code served (permissive licence) · get_code("fb8b6b45dbfda514")
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 tempfile
import os

# Create a temporary corpus file with sample data
temp_dir = tempfile.mkdtemp()
corpus_path = os.path.join(temp_dir, 'corpus.txt')

# Write sample corpus data
with open(corpus_path, 'w') as f:
    f.write("hello\texample\n")
    f.write("world\texample\n")
    f.write("hello\texample\n")
    f.write("test\texample\n")
    f.write("word\texample\n")

ARGS = {
    'corpus_path': corpus_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 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_word_tag Ran
ran on a synthesized input
ngoquanghuy99/POS-Tagging-BiLSTM-CRF/utils.py
code served (permissive licence) · get_code("04343636ba9e4577")
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 string

punct = set(string.punctuation)

noun_suffix = ['action', 'age', 'ance', 'cy', 'dom', 'ee', 'ence', 'er', 'hood', 'ion', 'ism', 'ist', 'ity', 'ling', 'ment', 'ness', 'or', 'ry', 'scape', 'ship', 'ty']

verb_suffix = ['ate', 'ify', 'ise', 'ize']

adj_suffix = ['able', 'ese', 'ful', 'i', 'ian', 'ible', 'ic', 'ish', 'ive', 'less', 'ly', 'ous']

adv_suffix = ['ward', 'wards', 'wise']

def assign_unk(tok):
    if any((char.isdigit() for char in tok)):
        return '--unk_digit--'
    elif any((char in punct for char in tok)):
        return '--unk_punct--'
    elif any((char.isupper() for char in tok)):
        return '--unk_upper--'
    elif any((tok.endswith(suffix) for suffix in noun_suffix)):
        return '--unk_noun--'
    elif any((tok.endswith(suffix) for suffix in verb_suffix)):
        return '--unk_verb--'
    elif any((tok.endswith(suffix) for suffix in adj_suffix)):
        return '--unk_adj--'
    elif any((tok.endswith(suffix) for suffix in adv_suffix)):
        return '--unk_adv--'
    return '--unk--'

def get_word_tag(line, vocab):
    if not line.split():
        word = '--n--'
        tag = '--s--'
        return (word, tag)
    else:
        word, tag = line.split()
        if word not in vocab:
            word = assign_unk(word)
        return (word, tag)
    return None

# Create test arguments
line_with_content = "running VBG"
line_empty = ""

vocab = {"running", "cat", "dog", "walked", "beautiful"}

ARGS = {
    "line": line_with_content,
    "vocab": vocab
}
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 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
load_json_file Ran
ran on a synthesized input
jidasheng/bi-lstm-crf/bi_lstm_crf/app/preprocessing/utils.py
code served (permissive licence) · get_code("4224c7914f484bfc")
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 with valid content
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test.json")

test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(temp_file, 'w', encoding='utf8') as f:
    json.dump(test_data, f)

ARGS = {
    "file_path": temp_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 on a synthesized input
jidasheng/bi-lstm-crf/bi_lstm_crf/model/crf.py
code served (permissive licence) · get_code("270d6bd48a51f2ae")
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

torch.manual_seed(0)

# The function expects a tensor x with shape that allows:
# - x.max(-1)[0] to work (get max along last dimension)
# - x - max_score.unsqueeze(-1) to work (broadcasting)
# - .exp().sum(-1).log() to work (sum along last dimension)
# This suggests x should be at least 2D

x = torch.randn(2, 4)

ARGS = {
    "x": x
}
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
model_filepath Ran
ran on a synthesized input
jidasheng/bi-lstm-crf/bi_lstm_crf/app/utils.py
code served (permissive licence) · get_code("2b53a6f0ec5f47e8")
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 torch
import torch.nn as nn
from os.path import exists, join

torch.manual_seed(0)

# The function model_filepath takes model_dir as a parameter
# and joins it with FILE_MODEL ('model.pth')
# It simply returns a string path, so model_dir should be a string

model_dir = "/tmp/models"

ARGS = {
    "model_dir": model_dir
}
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 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
preprocess Ran
ran on a synthesized input
ngoquanghuy99/POS-Tagging-BiLSTM-CRF/utils.py
code served (permissive licence) · get_code("763097a5a92e92d6")
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 2, 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 string

punct = set(string.punctuation)

noun_suffix = ['action', 'age', 'ance', 'cy', 'dom', 'ee', 'ence', 'er', 'hood', 'ion', 'ism', 'ist', 'ity', 'ling', 'ment', 'ness', 'or', 'ry', 'scape', 'ship', 'ty']

verb_suffix = ['ate', 'ify', 'ise', 'ize']

adj_suffix = ['able', 'ese', 'ful', 'i', 'ian', 'ible', 'ic', 'ish', 'ive', 'less', 'ly', 'ous']

adv_suffix = ['ward', 'wards', 'wise']

def assign_unk(tok):
    if any((char.isdigit() for char in tok)):
        return '--unk_digit--'
    elif any((char in punct for char in tok)):
        return '--unk_punct--'
    elif any((char.isupper() for char in tok)):
        return '--unk_upper--'
    elif any((tok.endswith(suffix) for suffix in noun_suffix)):
        return '--unk_noun--'
    elif any((tok.endswith(suffix) for suffix in verb_suffix)):
        return '--unk_verb--'
    elif any((tok.endswith(suffix) for suffix in adj_suffix)):
        return '--unk_adj--'
    elif any((tok.endswith(suffix) for suffix in adv_suffix)):
        return '--unk_adv--'
    return '--unk--'

def preprocess(vocab, tokens):
    orig = []
    prep = []
    for cnt, word in enumerate(tokens):
        if not word.split():
            orig.append(word.strip())
            word = '--n--'
            prep.append(word)
            continue
        elif word.strip() not in vocab:
            orig.append(word.strip())
            word = assign_unk(word)
            prep.append(word)
            continue
        else:
            orig.append(word.strip())
            prep.append(word.strip())
    assert len(orig) == len(tokens)
    assert len(prep) == len(tokens)
    return (orig, prep)

vocab = {'hello', 'world', 'the', 'quick', 'brown', 'fox'}

tokens = ['hello', 'world', 'unknown123', 'the', 'CAPITAL', 'running', '']

ARGS = {
    'vocab': vocab,
    'tokens': tokens
}
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 tuple, ndim 2, 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
processing Ran
ran on a synthesized input
ngoquanghuy99/POS-Tagging-BiLSTM-CRF/utils.py
code served (permissive licence) · get_code("112daf6361c8290f")
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 string

punct = set(string.punctuation)

noun_suffix = ['action', 'age', 'ance', 'cy', 'dom', 'ee', 'ence', 'er', 'hood', 'ion', 'ism', 'ist', 'ity', 'ling', 'ment', 'ness', 'or', 'ry', 'scape', 'ship', 'ty']

verb_suffix = ['ate', 'ify', 'ise', 'ize']

adj_suffix = ['able', 'ese', 'ful', 'i', 'ian', 'ible', 'ic', 'ish', 'ive', 'less', 'ly', 'ous']

adv_suffix = ['ward', 'wards', 'wise']

def assign_unk(tok):
    if any((char.isdigit() for char in tok)):
        return '--unk_digit--'
    elif any((char in punct for char in tok)):
        return '--unk_punct--'
    elif any((char.isupper() for char in tok)):
        return '--unk_upper--'
    elif any((tok.endswith(suffix) for suffix in noun_suffix)):
        return '--unk_noun--'
    elif any((tok.endswith(suffix) for suffix in verb_suffix)):
        return '--unk_verb--'
    elif any((tok.endswith(suffix) for suffix in adj_suffix)):
        return '--unk_adj--'
    elif any((tok.endswith(suffix) for suffix in adv_suffix)):
        return '--unk_adv--'
    return '--unk--'

def processing(vocab, text):
    prep_sentence = []
    for word in text:
        if not word.split():
            word = '--n--'
            prep_sentence.append(word)
            continue
        elif word.strip() not in vocab:
            word = assign_unk(word)
            prep_sentence.append(word)
            continue
        else:
            prep_sentence.append(word.strip())
    assert len(prep_sentence) == len(text)
    return prep_sentence

vocab = {'hello', 'world', 'the', 'cat', 'sat', 'on', 'mat'}
text = ['hello', 'world', 'xyz123', 'jumped', 'beautiful', '  ', 'the']

ARGS = {
    'vocab': vocab,
    'text': text
}
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 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

Also present in other papers' code

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

In this paper, we propose a variety of Long Short-Term Memory (LSTM) based models for sequence tagging. These models include LSTM networks, bidirectional LSTM (BI-LSTM) networks, LSTM with a Conditional Random Field (CRF) layer (LSTM-CRF) and bidirectional LSTM with a CRF layer (BI-LSTM-CRF). Our work is the first to apply a bidirectional LSTM CRF (denoted as BI-LSTM-CRF) model to NLP benchmark sequence tagging data sets. We show that the BI-LSTM-CRF model can efficiently use both past and future input features thanks to a bidirectional LSTM component. It can also use sentence level tag information thanks to a CRF layer. The BI-LSTM-CRF model can produce state of the art (or close to) accuracy on POS, chunking and NER data sets. In addition, it is robust and has less dependence on word embedding as compared to previous observations.

For agents

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

get_harvested_code_for_paper("1508.01991")
get_code_for_paper("1508.01991")
have("1508.01991")

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

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

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

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

Connect an agent — have() is free.