SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1311.2540 · 2013

Asymmetric numeral systems: entropy coding combining speed of Huffman coding with compression rate of arithmetic coding

arXiv · PDF · Open in the Atlas

Code that ran

4 of 4 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 3 have no contract verdict; 1 failure 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/1311.2540.json · badge: /api/ran/1311.2540.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
FGlazov/Python-rANSCoder community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
GarethCa/Py-tANS reimplementation (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
argmax Ran
ran on a synthesized input
FGlazov/Python-rANSCoder/src/rans/rANSCoder.py
code served (permissive licence) · get_code("53b7d4919589f88e")
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 numba
import numpy as np

@numba.jit(nopython=True)
def argmax(values):
    if not values:
        return -1
    current_max = values[0]
    current_max_index = 0
    for i in range(1, len(values)):
        if values[i] > current_max:
            current_max = values[i]
            current_max_index = i
    return current_max_index

# Create a list of numeric values to pass to argmax
values = [3.2, 1.5, 7.8, 2.1, 5.4]

ARGS = {
    "values": values
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — 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
find_in_int_dist Ran
ran on a synthesized input
FGlazov/Python-rANSCoder/src/rans/rANSCoder.py
code served (permissive licence) · get_code("31055cf1e3342780")
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 numba
import numpy as np

@numba.jit(nopython=True)
def find_in_int_dist(cdf, to_find):
    for i in range(len(cdf) - 1):
        if cdf[i] <= to_find and cdf[i + 1] > to_find:
            return i
    print('Error: Could not find symbol in integer-dist')

# The function expects:
# - cdf: a 1D array-like of cumulative distribution function values (floats or ints)
# - to_find: a scalar value to search for within the cdf

# Create a small CDF array (monotonically increasing)
cdf = np.array([0.0, 0.2, 0.5, 0.8, 1.0], dtype=np.float64)

# Create a value to find that falls within the CDF range
to_find = 0.6

ARGS = {
    'cdf': cdf,
    'to_find': to_find
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — 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
float_to_int_probs Ran
ran on a synthesized input
FGlazov/Python-rANSCoder/src/rans/rANSCoder.py
code served (permissive licence) · get_code("9810adc1ca05d0a5")
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 numba
import numpy as np

MIN_PROB = 8
prob_bits = 14
prob_scale = 1 << prob_bits

@numba.jit(nopython=True)
def argmax(values):
    if not values:
        return -1
    current_max = values[0]
    current_max_index = 0
    for i in range(1, len(values)):
        if values[i] > current_max:
            current_max = values[i]
            current_max_index = i
    return current_max_index

@numba.jit(nopython=True)
def float_to_int_probs(float_probs):
    pdf = []
    cdf = [0]
    for prob in float_probs:
        next_prob = round(prob * prob_scale)
        if prob > 0 and next_prob < MIN_PROB:
            next_prob = MIN_PROB
        pdf.append(next_prob)
        cdf.append(cdf[-1] + next_prob)
    to_correct = prob_scale - cdf[-1]
    largest_index = argmax(pdf)
    pdf[largest_index] += to_correct
    for i in range(largest_index + 1, len(cdf)):
        cdf[i] += to_correct
    return (pdf, cdf)

# Create valid test arguments
# float_probs should be a list or array-like of floating point probabilities
float_probs_list = [0.1, 0.2, 0.3, 0.4]

ARGS = {
    "float_probs": float_probs_list
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numba, numpy — 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
make_data Ran
ran; our contract draft was wrong, not the code
GarethCa/Py-tANS/tests/test_coder.py
pointer only (licence: NONE) · get_code("fe80544ff5c379e8")
How it ran

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

Also present in other papers' code

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

The modern data compression is mainly based on two approaches to entropy coding: Huffman (HC) and arithmetic/range coding (AC). The former is much faster, but approximates probabilities with powers of 2, usually leading to relatively low compression rates. The latter uses nearly exact probabilities - easily approaching theoretical compression rate limit (Shannon entropy), but at cost of much larger computational cost. Asymmetric numeral systems (ANS) is a new approach to accurate entropy coding, which allows to end this trade-off between speed and rate: the recent implementation [1] provides about $50\%$ faster decoding than HC for 256 size alphabet, with compression rate similar to provided by AC. This advantage is due to being simpler than AC: using single natural number as the state, instead of two to represent a range. Beside simplifying renormalization, it allows to put the entire behavior for given probability distribution into a relatively small table: defining entropy coding automaton. The memory cost of such table for 256 size alphabet is a few kilobytes. There is a large freedom while choosing a specific table - using pseudorandom number generator initialized with cryptographic key for this purpose allows to simultaneously encrypt the data. This article also introduces and discusses many other variants of this new entropy coding approach, which can provide direct alternatives for standard AC, for large alphabet range coding, or for approximated quasi arithmetic coding.

For agents

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

get_harvested_code_for_paper("1311.2540")
get_code_for_paper("1311.2540")
have("1311.2540")

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

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

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

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

Connect an agent — have() is free.