SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1904.03971 · 2019

Jointly Measuring Diversity and Quality in Text Generation Models

arXiv · PDF · Open in the Atlas

Code that ran

3 of 6 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 2 have no contract verdict; 1 failure 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/1904.03971.json · badge: /api/ran/1904.03971.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
IAmS4n/TextGenerationEvaluationMetrics canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
Danial-Alh/fast-bleu community (classifier label)
classifier basis not recorded on the link
2 ran · 3 no recorded run
FunctionStatusWhere it lives
calculate_frechet_distance Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
IAmS4n/TextGenerationEvaluationMetrics/bert_distances.py
pointer only (licence: NONE) · get_code("82fe049dd2f0dc47")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, IAmS4n/TextGenerationEvaluationMetrics 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.

closest_ref_length Ran
ran on a synthesized input
Danial-Alh/fast-bleu/old_metrics/bleu-old.py
code served (permissive licence) · get_code("ca5608be70a5b972")
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 int, ndim 0, dtype family int, 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)

# Analyzing the function:
# - ref_lens: a list/iterable of reference lengths (integers)
# - hyp_len: an integer representing hypothesis length
# The function uses min() with a key function that accesses each ref_len
# and compares it to hyp_len, so ref_lens should be a list of integers

ARGS = {
    "ref_lens": [10, 15, 12, 8, 14],
    "hyp_len": 13
}
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 int, ndim 0, dtype family int, 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
modified_precision Ran
ran on a synthesized input
Danial-Alh/fast-bleu/old_metrics/bleu-old.py
code served (permissive licence) · get_code("30fb058c70150725")
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 Fraction. 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.

from collections import Counter
from fractions import Fraction
from nltk import ngrams

# Build reference_max_counts: a list of Counter objects for each n-gram order
# This represents the maximum counts of n-grams across all references
reference1 = 'the cat is on the mat'.split()
reference2 = 'there is a cat on the mat'.split()

# For n=1 (unigrams)
unigrams_ref1 = list(ngrams(reference1, 1))
unigrams_ref2 = list(ngrams(reference2, 1))
max_counts_1 = Counter(unigrams_ref1) | Counter(unigrams_ref2)

# For n=2 (bigrams)
bigrams_ref1 = list(ngrams(reference1, 2))
bigrams_ref2 = list(ngrams(reference2, 2))
max_counts_2 = Counter(bigrams_ref1) | Counter(bigrams_ref2)

reference_max_counts = [max_counts_1, max_counts_2]

# Build hypothesis
hypothesis = 'the the the the the the the'.split()

# n-gram order
n = 1

ARGS = {
    'reference_max_counts': reference_max_counts,
    'hypothesis': hypothesis,
    'n': n
}
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 Fraction — a Fraction output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Fraction 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
corpus_bleu Not yet run
unverified (harvested, no recorded run)
Danial-Alh/fast-bleu/old_metrics/bleu-old.py
code served (permissive licence) · get_code("8b5bec45d74d3206")
How it ran

no invocation recorded.

get_ngrams Not yet run
unverified (harvested, no recorded run)
Danial-Alh/fast-bleu/old_metrics/utils.py
code served (permissive licence) · get_code("6b596e04b33971a0")
How it ran

no invocation recorded.

tokenize Not yet run
unverified (harvested, no recorded run)
Danial-Alh/fast-bleu/old_metrics/utils.py
code served (permissive licence) · get_code("ba61bc7fc6c3ca92")
How it ran

no invocation recorded.

Also present in other papers' code

Of 6 samples lifted from this paper's linked repositories, 6 carry a function identity and 0 do not. Of the 6 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 1 the same month, 1 later) and 5 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
calculate_frechet_distance 74 other papers
4 dated earlier, 2 the same month, 68 later
1610.09585 (2016-10)
Conditional Image Synthesis With Auxiliary Classifier GANs
1706.08500 (2017-06)
GANs Trained by a Two Time-Scale Update Rule Converge to a Local Nash Equilibrium
1807.11458 (2018-07)
To learn image super-resolution, use a GAN to learn how to do image degradation first
and 71 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

Text generation is an important Natural Language Processing task with various applications. Although several metrics have already been introduced to evaluate the text generation methods, each of them has its own shortcomings. The most widely used metrics such as BLEU only consider the quality of generated sentences and neglect their diversity. For example, repeatedly generation of only one high quality sentence would result in a high BLEU score. On the other hand, the more recent metric introduced to evaluate the diversity of generated texts known as Self-BLEU ignores the quality of generated texts. In this paper, we propose metrics to evaluate both the quality and diversity simultaneously by approximating the distance of the learned generative model and the real data distribution. For this purpose, we first introduce a metric that approximates this distance using n-gram based measures. Then, a feature-based measure which is based on a recent highly deep model trained on a large text corpus called BERT is introduced. Finally, for oracle training mode in which the generator's density can also be calculated, we propose to use the distance measures between the corresponding explicit distributions. Eventually, the most popular and recent text generation models are evaluated using both the existing and the proposed metrics and the preferences of the proposed metrics are determined.

For agents

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

get_harvested_code_for_paper("1904.03971")
get_code_for_paper("1904.03971")
have("1904.03971")

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

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

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

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

Connect an agent — have() is free.