SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2404.00152 · NAACL · 2024

On-the-fly Definition Augmentation of LLMs for Biomedical NER

Tom Hope, Sergey Feldman, Aakanksha Naik, Silvio Amir, Monica Munnangi, Byron C. Wallace

arXiv · PDF · Open in the Atlas

Code that ran

4 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; 0 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 3 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2404.00152.json · badge: /api/ran/2404.00152.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
allenai/beacon canonical (classifier label)
classifier basis: census
4 ran · 3 no recorded run
FunctionStatusWhere it lives
convert_dict_to_list_of_dicts Ran
ran; our contract draft was wrong, not the code
allenai/beacon/finetuning_data/conll_formatting.py
code served (permissive licence) · get_code("7e25397694232c4d")
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

torch.manual_seed(0)

# The function convert_dict_to_list_of_dicts takes a dictionary where each value is a sequence/list
# and converts it to a list of dictionaries where each dict contains one element from each sequence.
# 
# The function:
# 1. Gets the keys from the dictionary
# 2. Gets the values from the dictionary
# 3. Gets the length from the first value (assumes all values have same length)
# 4. Constructs a list of dicts by iterating through indices

# We need a dictionary where values are sequences of the same length
dictionary = {
    'name': ['alice', 'bob', 'charlie'],
    'age': [25, 30, 35],
    'score': [0.8, 0.9, 0.7]
}

ARGS = {
    'dictionary': dictionary
}
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
generate_text Ran
ran; our contract draft was wrong, not the code
allenai/beacon/calls/openai_call.py
code served (permissive licence) · get_code("85b409d4935c8b83")
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 time
import openai

# Mock the openai module since we can't make real API calls
class MockMessage:
    def __init__(self, content):
        self.content = content

class MockChoice:
    def __init__(self, content):
        self.message = MockMessage(content)

class MockResponse:
    def __init__(self):
        self.choices = [MockChoice("This is a generated response.")]

# Mock openai.ChatCompletion.create to return a valid response
def mock_create(**kwargs):
    return {
        'choices': [
            {
                'message': {
                    'content': 'This is a generated response.'
                }
            }
        ]
    }

# Replace the actual API call with our mock
openai.ChatCompletion.create = mock_create

# Define valid arguments for the generate_text function
ARGS = {
    'user_input': 'What is machine learning?',
    'temperature': 0.7,
    'max_tokens': 150
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
openai — 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
jsonNotFormattedCorrectly Ran
ran, violated the contract we drafted
allenai/beacon/calls/openai_call.py
code served (permissive licence) · get_code("9df10872433e5698")
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 bool, 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 ast

def jsonNotFormattedCorrectly(response):
    try:
        extraction = ast.literal_eval(response)
    except SyntaxError as e:
        print(e)
        print('This is a Syntax error')
        return True

# Test case 1: Valid Python literal (valid dict)
response_valid = "{'key': 'value', 'number': 42}"

# Test case 2: Invalid syntax (malformed string)
response_invalid = "{'key': 'value', invalid syntax here}"

ARGS = {
    'response': response_invalid
}
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 bool, 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
take Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
allenai/beacon/finetuning_data/conll_formatting.py
code served (permissive licence) · get_code("93075ac4da9d7fb7")
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 int; 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
from itertools import islice

torch.manual_seed(0)

# The function take(n, iterable) returns the first n items of an iterable as a list
# It needs:
# - n: an integer specifying how many items to take
# - iterable: any iterable object (list, generator, etc.)

# Create a simple iterable - a list of numbers
simple_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# Create a generator as an alternative iterable
def number_generator():
    for i in range(1, 11):
        yield i

ARGS = {
    "n": 3,
    "iterable": simple_list
}
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 int — 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
convert_offsets_to_word_level Not yet run
unverified (harvested, no recorded run)
allenai/beacon/finetuning_data/conll_formatting.py
code served (permissive licence) · get_code("a76a469ab43921fd")
How it ran

no invocation recorded.

jsonNotFormattedCorrectly Not yet run
unverified (harvested, no recorded run)
allenai/beacon/calls/claude_call.py
code served (permissive licence) · get_code("e2271ea9bc72c3cd")
How it ran

no invocation recorded.

jsonNotFormattedCorrectly Not yet run
unverified (harvested, no recorded run)
allenai/beacon/calls/llama_call.py
code served (permissive licence) · get_code("d6230ab1c41b1c09")
How it ran

no invocation recorded.

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 (0 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
take 1 other paper
1 later
2605.18959 (2026-05)
Hyrax: An Extensible Framework for Rapid ML Experimentation and Unsupervised Discovery in the Era of Rubin, Roman, and Euclid

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

Despite their general capabilities, LLMs still struggle on biomedical NER tasks, which are difficult due to the presence of specialized terminology and lack of training data. In this work we set out to improve LLM performance on biomedical NER in limited data settings via a new knowledge augmentation approach which incorporates definitions of relevant concepts on-the-fly. During this process, to provide a test bed for knowledge augmentation, we perform a comprehensive exploration of prompting strategies. Our experiments show that definition augmentation is useful for both open source and closed LLMs. For example, it leads to a relative improvement of 15% (on average) in GPT-4 performance (F1) across all (six) of our test datasets. We conduct extensive ablations and analyses to demonstrate that our performance improvements stem from adding relevant definitional knowledge. We find that careful prompting strategies also improve LLM performance, allowing them to outperform fine-tuned language models in fewshot settings. To facilitate future research in this direction, we release our code at https: //github.com/allenai/beacon. for zero-shot knowledge graph question answering. arXiv preprint arXiv:2306.04136. Olivier Bodenreider. 2004. The unified medical language system (umls): integrating biomedical terminology. Nucleic acids research, 32(suppl_1):D267-D270.

For agents

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

get_harvested_code_for_paper("2404.00152")
get_code_for_paper("2404.00152")
have("2404.00152")

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

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

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

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

Connect an agent — have() is free.