SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.14627 · ICLR · 2023

An Equal-Size Hard EM Algorithm for Diverse Dialogue Generation

Lili Mou, Yuqiao Wen, Yongchang Hao, Yanshuai Cao

arXiv · PDF · Open in the Atlas

Code that ran

8 of 11 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 6 have no contract verdict; 2 failures of our instrument; 3 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/2209.14627.json · badge: /api/ran/2209.14627.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
anonymous-1759/eqhard-em canonical (classifier label)
classifier basis not recorded on the link
6 ran · 3 no recorded run
manga-uofa/eqhard-em canonical (classifier label)
classifier basis: classifier_2025
2 ran · 0 no recorded run
FunctionStatusWhere it lives
get_dfs Ran
ran; our contract draft was wrong, not the code
manga-uofa/eqhard-em/evaluate_generations.py
code served (permissive licence) · get_code("8d6510bd380e626b")
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) and returned list. 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 pandas as pd
import tempfile
import os

# Create temporary CSV files for testing
temp_dir = tempfile.mkdtemp()

# Create first CSV file
csv_path_1 = os.path.join(temp_dir, "data1.csv")
df1 = pd.DataFrame({
    'col1': [1, 2, 3],
    'col2': ['a', 'b', 'c']
})
df1.to_csv(csv_path_1, index=False)

# Create second CSV file
csv_path_2 = os.path.join(temp_dir, "data2.csv")
df2 = pd.DataFrame({
    'col1': [4, 5],
    'col2': ['d', 'e']
})
df2.to_csv(csv_path_2, index=False)

# Define ARGS with list of CSV file paths
ARGS = {
    'df_paths': [csv_path_1, csv_path_2]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list — a list 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_inputs_and_references Ran
ran on a synthesized input
anonymous-1759/eqhard-em/default_dataset.py
code served (permissive licence) · get_code("74a1f2d91eae3032")
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 pandas as pd
import tempfile
import os
from collections import OrderedDict

# Create a temporary CSV file with test data
temp_dir = tempfile.mkdtemp()
csv_path = os.path.join(temp_dir, "test_data.csv")

# Write test data to CSV
test_data = {
    'context': ['hello world', 'how are you', 'hello world', 'goodbye'],
    'response': ['hi there', 'i am fine', 'hey there', 'see you']
}
df = pd.DataFrame(test_data)
df.to_csv(csv_path, index=False)

ARGS = {
    'path': csv_path,
    'multi_ref': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — 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
i_corpus_bleu Ran
ran on a synthesized input
anonymous-1759/eqhard-em/metrics/bleus.py
code served (permissive licence) · get_code("d18af1916bba14be")
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
from nltk.translate.bleu_score import sentence_bleu, corpus_bleu

torch.manual_seed(0)

# Build minimal arguments for i_corpus_bleu
# The function expects:
# - list_of_references: list of reference translations (each reference is a list of tokenized sentences)
# - hypotheses: list of hypothesis translations (tokenized)
# - inputs: list of input sequences
# - alpha: float weight parameter
# - weights: tuple of n-gram weights
# - smoothing_function: optional smoothing function
# - auto_reweigh: boolean flag

# Create minimal tokenized references (list of references, each containing sentences)
list_of_references = [
    [['the', 'cat', 'sat', 'on', 'the', 'mat'],
     ['a', 'cat', 'is', 'sitting']],
    [['the', 'dog', 'ran', 'fast'],
     ['a', 'dog', 'is', 'running']]
]

# Create minimal hypotheses (tokenized sentences)
hypotheses = [
    ['the', 'cat', 'sat', 'on', 'mat'],
    ['the', 'dog', 'ran', 'quickly']
]

# Create minimal inputs (sequences)
inputs = [
    ['input', 'one'],
    ['input', 'two']
]

# Optional smoothing function
smoothing_function = None

# Weights for unigram, bigram, trigram, 4-gram
weights = (0.25, 0.25, 0.25, 0.25)

# Alpha parameter
alpha = 0.9

# Auto reweigh flag
auto_reweigh = False

ARGS = {
    'list_of_references': list_of_references,
    'hypotheses': hypotheses,
    'inputs': inputs,
    'alpha': alpha,
    'weights': weights,
    'smoothing_function': smoothing_function,
    'auto_reweigh': auto_reweigh
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk, 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
list_drop_indices Ran
ran on a synthesized input
anonymous-1759/eqhard-em/evaluate.py
code served (permissive licence) · get_code("d1439abee99db03f")
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 3, 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)

# Construct arguments for list_drop_indices
input_list = [
    torch.randn(2, 4),
    torch.randn(2, 4),
    torch.randn(2, 4),
    torch.randn(2, 4),
    torch.randn(2, 4),
]

drop_indices = {1, 3}

ARGS = {
    "input_list": input_list,
    "drop_indices": drop_indices,
}
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 3, 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
max_corpus_bleu Ran
ran on a synthesized input
anonymous-1759/eqhard-em/metrics/bleus.py
code served (permissive licence) · get_code("df188885fa732d25")
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
from nltk.translate.bleu_score import sentence_bleu, corpus_bleu

torch.manual_seed(0)

# Construct valid arguments for max_corpus_bleu
# The function expects:
# - list_of_references: list of list of references (tokenized)
# - hypotheses: list of hypotheses (tokenized)
# - weights: tuple of weights for n-gram precisions
# - smoothing_function: optional smoothing function
# - auto_reweigh: boolean for auto-reweighting

# Create tokenized references and hypotheses
# Each reference/hypothesis is a list of tokens (strings)
reference_1 = [['the', 'cat', 'is', 'on', 'the', 'mat'],
               ['there', 'is', 'a', 'cat', 'on', 'the', 'mat']]
reference_2 = [['the', 'dog', 'is', 'in', 'the', 'house'],
               ['a', 'dog', 'is', 'inside', 'the', 'house']]

list_of_references = [reference_1, reference_2]

hypotheses = [['the', 'cat', 'on', 'the', 'mat'],
              ['the', 'dog', 'in', 'house']]

weights = (0.25, 0.25, 0.25, 0.25)
smoothing_function = None
auto_reweigh = False

ARGS = {
    'list_of_references': list_of_references,
    'hypotheses': hypotheses,
    'weights': weights,
    'smoothing_function': smoothing_function,
    'auto_reweigh': auto_reweigh
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk, 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
max_sentence_bleu Ran
ran on a synthesized input
anonymous-1759/eqhard-em/metrics/bleus.py
code served (permissive licence) · get_code("93e75c549a18cf89")
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.

from nltk.translate.bleu_score import SmoothingFunction

# The function expects:
# - references: list of reference translations (each is a list of tokens)
# - hypothesis: a hypothesis translation (list of tokens)
# - weights: tuple of weights for n-gram precisions
# - smoothing_function: optional smoothing function
# - auto_reweigh: boolean flag

# Create sample tokenized sentences (lists of tokens)
reference_1 = ['the', 'cat', 'sat', 'on', 'the', 'mat']
reference_2 = ['a', 'cat', 'is', 'sitting', 'on', 'the', 'mat']
reference_3 = ['the', 'cat', 'is', 'on', 'mat']

hypothesis = ['the', 'cat', 'sat', 'on', 'mat']

references = [reference_1, reference_2, reference_3]

# Create a smoothing function (optional but good to test)
smoothing_func = SmoothingFunction().method1

ARGS = {
    'references': references,
    'hypothesis': hypothesis,
    'weights': (0.25, 0.25, 0.25, 0.25),
    'smoothing_function': smoothing_func,
    'auto_reweigh': False
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — 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
str_tokenize Ran
ran on a synthesized input
anonymous-1759/eqhard-em/evaluate.py
code served (permissive licence) · get_code("eaff4242ef22c474")
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 nltk
from nltk import word_tokenize, wordpunct_tokenize

# Download required NLTK data
try:
    nltk.data.find('tokenizers/punkt')
except LookupError:
    nltk.download('punkt', quiet=True)

# The function takes a single parameter: sent (a string)
# It calls wordpunct_tokenize(sent) which expects a string
sent = "Hello, world! How are you?"

ARGS = {
    "sent": sent
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
nltk — 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
time_profile Ran
ran; our contract draft was wrong, not the code
manga-uofa/eqhard-em/evaluate_generations.py
code served (permissive licence) · get_code("19180322b4557a21")
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) and returned function. 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 time

def time_profile(f):
    def timed(*args, **kw):
        ts = time.time()
        result = f(*args, **kw)
        te = time.time()
        print('Function [{}] took {:.2f} seconds.'.format(f.__name__, te - ts))
        return result
    return timed

# Create a simple function to be decorated
@time_profile
def sample_function(x, y):
    """A simple function that does some computation."""
    time.sleep(0.01)  # Simulate some work
    return x + y

# Set up arguments for time_profile
# time_profile takes a single parameter 'f' which is a function
def dummy_function(a, b):
    """A dummy function to be profiled."""
    return a * b

ARGS = {
    'f': dummy_function
}
Setup block drafted by
a language model, Claude Haiku 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
generate_fn Not yet run
unverified (harvested, no recorded run)
anonymous-1759/eqhard-em/evaluate.py
code served (permissive licence) · get_code("b0bb3c3089d7edda")
How it ran

no invocation recorded.

get_tokenizer Not yet run
unverified (harvested, no recorded run)
anonymous-1759/eqhard-em/util.py
code served (permissive licence) · get_code("99808cb1227bd7b3")
How it ran

no invocation recorded.

load_tf_weights_in_t5 Not yet run
unverified (harvested, no recorded run)
anonymous-1759/eqhard-em/model/adapter_t5.py
pointer only (licence: MIT); the stored copy get_code serves, from suntea233/DualLoRA, is pointer only (licence: NONE) · get_code("136abfa3e8ce028d")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from suntea233/DualLoRA, 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. No invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 10 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
load_tf_weights_in_t5 20 other papers
3 dated earlier, 17 later
2201.05966 (2022-01)
UNIFIEDSKG: Unifying and Multi-Tasking Structured Knowledge Grounding with Text-to-Text Language Models
2204.07705 (2022-04)
SUPER-NATURALINSTRUCTIONS: Generalization via Declarative Instructions on 1600+ NLP Tasks
2205.06983 (2022-05)
RASAT: Integrating Relational Structures into Pretrained Seq2Seq Model for Text-to-SQL
and 17 more not named here

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

Open-domain dialogue systems aim to interact with humans through natural language texts in an open-ended fashion. Despite the recent success of super large dialogue systems such as ChatGPT, using medium-to-small-sized dialogue systems remains the common practice as they are more lightweight and accessible; however, generating diverse dialogue responses is challenging, especially with smaller models. In this work, we propose an Equal-size Hard Expectation-Maximization (EqHard-EM) algorithm to train a multi-decoder model for diverse dialogue generation. Our algorithm assigns a sample to a decoder in a hard manner and additionally imposes an equal-assignment constraint to ensure that all decoders are well-trained. We provide detailed theoretical analysis to justify our approach. Further, experiments on two large-scale open-domain dialogue datasets verify that our EqHard-EM algorithm generates high-quality diverse responses 1 .

For agents

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

get_harvested_code_for_paper("2209.14627")
get_code_for_paper("2209.14627")
have("2209.14627")

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

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

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

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

Connect an agent — have() is free.