SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1909.05357 · 2019

Out-of-Domain Detection for Low-Resource Text Classification Tasks

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-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/1909.05357.json · badge: /api/ran/1909.05357.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
SLAD-ml/few-shot-ood canonical (classifier label)
classifier basis: census
8 ran · 0 no recorded run
FunctionStatusWhere it lives
compute_values Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/utils.py
code served (permissive licence) · get_code("b3ca93083dfdf5fb")
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
import torch.nn as nn
import math

torch.manual_seed(0)

# Stand-in classes and minimal implementations

class MockWorkspace:
    def __init__(self, idx):
        self.idx = idx
        self.target_sets_files = [f"file_{i}.txt" for i in range(3)]

class MockExperiment:
    def run_testing_epoch(self, epoch, test_workspace):
        # Returns (metric1, metric2, test_output_info)
        # test_output_info is a list of (pred, gt, conf) tuples
        num_samples = 10
        test_output_info = []
        for i in range(num_samples):
            pred = i % 3  # domain label 0, 1, or 2
            gt = i % 3 if i < 7 else -1  # -1 is offtopic_label for last 3 samples
            conf = 0.1 + (i * 0.08)  # confidence scores between 0.1 and 0.9
            test_output_info.append((pred, gt, conf))
        return (0.0, 0.0, test_output_info)

# Build parameters dict
params = {
    'offtopic_label': -1
}

# Build experiment
experiment = MockExperiment()

# Build result_data - list of workspaces
result_data = [
    MockWorkspace(0),
    MockWorkspace(1)
]

# Epoch parameter
epoch = 0

# Define ARGS
ARGS = {
    'params': params,
    'experiment': experiment,
    'result_data': result_data,
    '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 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
get_all_parameters Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/all_parameters.py
code served (permissive licence) · get_code("6768286c9533263b")
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 configparser
from io import StringIO

# Create a minimal config parser with test values
config_string = """
[test_section]
total_epoch = 100
single_workspace = False
w2vfile = /tmp/test.vectors
mnet_training_dir = /tmp/train
mnet_training_list = /tmp/train_list.txt
mnet_dev_dir = /tmp/dev
mnet_dev_list = /tmp/dev_list.txt
testing_dir = /tmp/test
testing_list = /tmp/test_list.txt
model_string = test_model
model_dir = /tmp/models
batch_size = 32
max_length = 50
emb_size = 100
min_ss_size = 200
hidden_size = 128
softmax_factor = 5.0
learning_rate = 0.001
remove_target_from_support_set = True
dropout_keep_prob = 0.8
vocabulary = None
wordvectors = None
offtopic_label = OUT_OF_DOMAIN
sampling_classes = 5
topk_ss = 10
layer_num = 2
enable_batchnorm = True
mtl_num_tasks = 3
filter_size = 5
ood_threshold = 0.7
ood_threshold_margin = 0.1
ood_example_size = 10
alpha_pos = 1.5
alpha_neg = 0.5
alpha_indomain = 1.0
seed = 42
"""

config_parser = configparser.ConfigParser()
config_parser.read_string(config_string)

ARGS = {
    'config_parser': config_parser,
    'section': 'test_section',
    'print_params': False
}
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
get_results Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/utils.py
code served (permissive licence) · get_code("d3ebec56ea182bca")
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

torch.manual_seed(0)

# Construct params dict
params = {
    'offtopic_label': 'offtopic'
}

# Construct output_info as list of (pred, gt, conf) tuples
# Mix of on-topic and off-topic utterances with various confidence scores
output_info = [
    ('domain_a', 'domain_a', 0.95),      # correct prediction, high confidence
    ('domain_b', 'domain_b', 0.87),      # correct prediction, high confidence
    ('offtopic', 'domain_a', 0.45),      # rejected on-topic (low confidence)
    ('domain_a', 'offtopic', 0.92),      # accepted off-topic (high confidence, wrong pred)
    ('domain_b', 'domain_c', 0.78),      # wrong domain prediction
    ('offtopic', 'offtopic', 0.32),      # correct off-topic prediction
    ('domain_c', 'domain_c', 0.88),      # correct prediction, high confidence
    ('domain_a', 'domain_b', 0.65),      # wrong domain prediction
]

threshold = 0.5

ARGS = {
    'params': params,
    'output_info': output_info,
    'threshold': threshold
}
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, 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
read_word2idx Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/vocabulary.py
code served (permissive licence) · get_code("181200b5b05fce13")
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 file with word-to-index mappings
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt')
temp_file.write("apple\t0\n")
temp_file.write("banana\t1\n")
temp_file.write("cherry\t2\n")
temp_file.write("date\t3\n")
temp_file.close()

ARGS = {
    'infile': temp_file.name
}
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
read_word_vectors Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/vocabulary.py
code served (permissive licence) · get_code("52455bb98c4df8d5")
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 tempfile
import os

# Create a temporary file with word vectors in the expected format
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', encoding='utf-8')
temp_filename = temp_file.name

# Write sample word vector data in tab-separated format
# Format: word\tvector_values (space-separated floats)
temp_file.write("hello\t0.1 0.2 0.3 0.4\n")
temp_file.write("world\t0.5 0.6 0.7 0.8\n")
temp_file.write("test\t0.9 1.0 1.1 1.2\n")
# Duplicate word to test the "not in wdmap" condition
temp_file.write("hello\t1.3 1.4 1.5 1.6\n")
temp_file.close()

ARGS = {
    'filename': temp_filename
}
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 — 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
search_best_threshold Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/utils.py
code served (permissive licence) · get_code("2255a716c61d5b5f")
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 math

# Define params dict with offtopic_label key
params = {
    'offtopic_label': 0
}

# Create valid_output_info_list with tuples of (pred, gt, conf)
# Format: list of datasets, each containing list of (prediction, ground_truth, confidence) tuples
# offtopic_label = 0, so gt != 0 means in-topic
valid_output_info_list = [
    # First dataset
    [
        (1, 0, 0.1),      # pred=1, gt=0 (offtopic), conf=0.1
        (1, 1, 0.3),      # pred=1, gt=1 (in-topic), conf=0.3
        (0, 0, 0.2),      # pred=0, gt=0 (offtopic), conf=0.2
        (1, 1, 0.5),      # pred=1, gt=1 (in-topic), conf=0.5
        (0, 0, 0.15),     # pred=0, gt=0 (offtopic), conf=0.15
        (1, 2, 0.6),      # pred=1, gt=2 (in-topic), conf=0.6
    ],
    # Second dataset
    [
        (1, 0, 0.05),     # pred=1, gt=0 (offtopic), conf=0.05
        (1, 1, 0.25),     # pred=1, gt=1 (in-topic), conf=0.25
        (0, 0, 0.12),     # pred=0, gt=0 (offtopic), conf=0.12
        (1, 2, 0.55),     # pred=1, gt=2 (in-topic), conf=0.55
    ]
]

ARGS = {
    'params': params,
    'valid_output_info_list': valid_output_info_list
}
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
str2bool Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/all_parameters.py
code served (permissive licence) · get_code("9e7bc58b5a573d9e")
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 torch

def str2bool(v):
    if v == 'True':
        return True
    elif v == 'False':
        return False
    else:
        raise Exception('bad string for boolean')

ARGS = {
    'v': 'True'
}
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 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
tokenizeSimple Ran
ran on a synthesized input
SLAD-ml/few-shot-ood/src/simple_tokenizer.py
code served (permissive licence) · get_code("0e48864a463490b9")
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 re

def tokenizeSimple(sent, max_token_size=100000):
    ret = sent.lower()
    ret = ret.replace('"', ' " ')
    ret = ret.replace(',', ' , ')
    ret = ret.replace('.', ' . ')
    ret = ret.replace('(', ' ( ')
    ret = ret.replace(')', ' ) ')
    ret = ret.replace('/', ' / ')
    ret = ret.replace('?', ' ? ')
    ret = ret.replace('!', ' ! ')
    ret = ret.replace("n't", " n't ")
    ret = ret.replace("'ve ", " 've ")
    ret = ret.replace("'ll ", " 'll ")
    ret = ret.replace("'re ", " 're ")
    ret = ret.replace("'s ", " 's ")
    ret = ret.replace("'m ", " 'm ")
    ret = ret.replace("'d ", " 'd ")
    ret = re.sub(' +', ' ', ret)
    ret = ret.strip()
    ret = ret.split(' ')[:max_token_size]
    while len(ret) < max_token_size:
        ret.append('</s>')
    return ret

ARGS = {
    'sent': "Hello, world! This is a test sentence with various punctuation marks (isn't it?). It won't hurt to check if we're handling contractions correctly. I've got some n't cases here. What's happening? I'd like to see.",
    'max_token_size': 100
}
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, 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 7 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
str2bool 1 other paper
1 later
2021.findings-emnlp.138 (2021 (year only))
ProtoInfoMax: Prototypical Networks with Mutual Information Maximization for Out-of-Domain Detection

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

Out-of-domain (OOD) detection for low-resource text classification is a realistic but understudied task. The goal is to detect the OOD cases with limited in-domain (ID) training data, since we observe that training data is often insufficient in machine learning applications. In this work, we propose an OOD-resistant Prototypical Network to tackle this zero-shot OOD detection and few-shot ID classification task. Evaluation on real-world datasets show that the proposed solution outperforms state-of-the-art methods in zero-shot OOD detection task, while maintaining a competitive performance on ID classification task.

For agents

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

get_harvested_code_for_paper("1909.05357")
get_code_for_paper("1909.05357")
have("1909.05357")

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

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

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

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

Connect an agent — have() is free.