SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2606.03739 · 2026

Entropy Gate: Entropy Quenching for Near-Lossless Token Compression in LLM Pipelines

Owusu Agyemang, Jerry Kponyo, Kwame Opuni-Boachie, Obour Agyekum, Francisca Acheampong, Agyeman-Prempeh Kwame, Agyekum, James Gadze

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (4 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 3 failures of our instrument; 1 no recorded run), measured 2026-11-23; 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/2606.03739.json · badge: /api/ran/2606.03739.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
jayluxferro/entropy-gate community
Papers with Code archive
9 ran · 1 no recorded run
FunctionStatusWhere it lives
CompressionResult Ran
ran on a synthesized input · constructed an object; no result was computed
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("5e7e835d7f61bd3d")
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 an instance of its own class, CompressionResult: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from dataclasses import dataclass, field

torch.manual_seed(0)

ARGS = {
    "compressed_text": "The quick brown fox jumps over the lazy dog",
    "tokens_kept": 8,
    "tokens_total": 12,
    "compression_ratio": 0.667,
    "similarity_score": 0.92,
    "schedule_steps": 5,
}
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 CompressionResult — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a CompressionResult 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
EnergyWeights Ran
ran on a synthesized input · constructed an object; no result was computed
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("1411a28a9a188efc")
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 an instance of its own class, EnergyWeights: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from dataclasses import dataclass

torch.manual_seed(0)

ARGS = {
    "w_statistical": 0.5,
    "w_structural": 0.3,
    "w_positional": 0.2,
}
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 EnergyWeights — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a EnergyWeights 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
QuenchingConfig Ran
ran on a synthesized input · constructed an object; no result was computed
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("4cfc1fcddaa75526")
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 an instance of its own class, QuenchingConfig: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from dataclasses import dataclass, field

torch.manual_seed(0)

@dataclass
class EnergyWeights:
    """Weights for the multi-factor energy decomposition.

    E(t) = w_statistical * E_statistical(t)
         + w_structural  * E_structural(t)
         + w_positional  * E_positional(t)
    """
    w_statistical: float = 0.5
    w_structural: float = 0.3
    w_positional: float = 0.2

ARGS = {
    'temperature_initial': 1.0,
    'cooling_rate': 0.25,
    'similarity_threshold': 0.85,
    'frozen_patterns': [r'\[REDACTED_[a-f0-9]{8}\]'],
    'energy_weights': EnergyWeights(
        w_statistical=0.5,
        w_structural=0.3,
        w_positional=0.2
    ),
    'output_cooling': True,
    'dedup_enabled': True,
    'memory_enabled': False,
    'min_tokens': 30,
    'use_model_energy': False,
    'model_path': '',
    'llama_server_port': 8081,
    'survival_mode': 'deterministic',
    'boltzmann_k': 1.0,
    'embedding_model': 'nomic-embed-text',
    'ollama_base_url': 'http://localhost:11434',
    'multi_turn_enabled': True,
    'protected_recent_turns': 2,
    'turn_decay': 0.7,
    'block_min_chars': 80,
    'cross_turn_freeze_chars': 400,
}
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 QuenchingConfig — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a QuenchingConfig 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
TokenEnergy Ran
ran on a synthesized input · constructed an object; no result was computed
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("5511588bb6420af9")
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 an instance of its own class, TokenEnergy: the run constructed the object and did not call it, so no result was computed. 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 numpy as np
from dataclasses import dataclass, field

torch.manual_seed(0)

ARGS = {
    "index": 0,
    "token": "hello",
    "energy": 0.5,
    "frozen": False,
    "energy_statistical": 0.1,
    "energy_structural": 0.2,
    "energy_positional": 0.15,
}
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 TokenEnergy — the run constructed an instance of its own class and did not call it; no shape is stated — the instrument coerces any output to an array; for a TokenEnergy 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
_boltzmann_survival Ran
ran; our contract draft was wrong, not the code
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("6a86d74f2f0d3626")
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 math
import random
from dataclasses import dataclass

@dataclass
class TokenEnergy:
    """Energy + metadata for a single token in the prompt."""
    index: int
    token: str
    energy: float
    frozen: bool = False
    energy_statistical: float = 0.0
    energy_structural: float = 0.0
    energy_positional: float = 0.0

# Construct token energies list
token_energies = [
    TokenEnergy(index=0, token="hello", energy=0.5, frozen=False),
    TokenEnergy(index=1, token="world", energy=1.5, frozen=False),
    TokenEnergy(index=2, token="test", energy=0.2, frozen=True),
    TokenEnergy(index=3, token="data", energy=2.0, frozen=False),
]

# Set random seed for reproducibility
random.seed(42)

# Create arguments
ARGS = {
    "token_energies": token_energies,
    "temperature": 1.0,
    "k": 1.0,
}
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
_energy_cutoff Ran
ran; our contract draft was wrong, not the code
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("84dd104a39dd29d2")
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 math
from dataclasses import dataclass, field

@dataclass
class TokenEnergy:
    """Energy + metadata for a single token in the prompt."""
    index: int
    token: str
    energy: float
    frozen: bool = False
    energy_statistical: float = 0.0
    energy_structural: float = 0.0
    energy_positional: float = 0.0

def _energy_cutoff(token_energies: list[TokenEnergy], temperature: float, T0: float) -> list[TokenEnergy]:
    """Deterministic energy-threshold filtering.

    At temperature T, the fraction of surviving tokens is T / T0.
    Tokens with the highest energy survive; frozen tokens always survive.
    """
    non_frozen = [te for te in token_energies if not te.frozen]
    frozen = [te for te in token_energies if te.frozen]
    if not non_frozen:
        return frozen
    frac = max(0.0, min(1.0, temperature / T0))
    sorted_by_energy = sorted(non_frozen, key=lambda te: te.energy, reverse=True)
    keep_count = max(1, int(math.ceil(len(sorted_by_energy) * frac)))
    kept = sorted_by_energy[:keep_count]
    all_kept = frozen + kept
    all_kept.sort(key=lambda te: te.index)
    return all_kept

# Construct valid arguments for _energy_cutoff
token_energies = [
    TokenEnergy(index=0, token="hello", energy=0.9, frozen=False, energy_statistical=0.3, energy_structural=0.4, energy_positional=0.2),
    TokenEnergy(index=1, token="world", energy=0.7, frozen=False, energy_statistical=0.2, energy_structural=0.3, energy_positional=0.2),
    TokenEnergy(index=2, token="!", energy=0.5, frozen=True, energy_statistical=0.1, energy_structural=0.2, energy_positional=0.2),
    TokenEnergy(index=3, token="test", energy=0.6, frozen=False, energy_statistical=0.25, energy_structural=0.25, energy_positional=0.1),
]

temperature = 0.8
T0 = 1.0

ARGS = {
    "token_energies": token_energies,
    "temperature": temperature,
    "T0": T0,
}
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
_reconstruct_text Ran
ran; our contract draft was wrong, not the code
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("0eb561749082bcb8")
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 torch
import numpy as np
from dataclasses import dataclass

torch.manual_seed(0)

@dataclass
class TokenEnergy:
    """Energy + metadata for a single token in the prompt."""
    index: int
    token: str
    energy: float
    frozen: bool = False
    energy_statistical: float = 0.0
    energy_structural: float = 0.0
    energy_positional: float = 0.0

# Create a list of TokenEnergy objects with various tokens
token_energies = [
    TokenEnergy(index=0, token="Hello", energy=0.5),
    TokenEnergy(index=1, token=" ", energy=0.0),
    TokenEnergy(index=2, token="world", energy=0.7),
    TokenEnergy(index=3, token=",", energy=0.2),
    TokenEnergy(index=4, token=" ", energy=0.0),
    TokenEnergy(index=5, token="how", energy=0.6),
    TokenEnergy(index=6, token=" ", energy=0.0),
    TokenEnergy(index=7, token="are", energy=0.8),
    TokenEnergy(index=8, token=" ", energy=0.0),
    TokenEnergy(index=9, token="you", energy=0.9),
    TokenEnergy(index=10, token="?", energy=0.3),
]

ARGS = {
    "token_energies": token_energies,
}
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 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
cosine_similarity Ran
ran, honoured the contract we drafted
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("b44b433d4c82f3b9")
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
from collections import Counter

# Construct minimal valid arguments for cosine_similarity

# The function takes two lists of strings and computes token-frequency overlap
# original: list of tokens from original sequence
# compressed: list of tokens from compressed sequence

original = ["the", "quick", "brown", "fox", "jumps", "over", "the", "lazy", "dog"]
compressed = ["quick", "brown", "fox", "the", "dog"]

ARGS = {
    "original": original,
    "compressed": compressed,
}
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 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
energy_weighted_similarity Ran
ran, honoured the contract we drafted
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("09b0039c5f02b5ab")
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 collections import Counter

# Construct valid arguments for energy_weighted_similarity
original = ["hello", "world", "hello", "test", "world", "hello"]
compressed = ["hello", "world", "hello"]
energies = {
    "hello": 0.8,
    "world": 0.6,
    "test": 0.5,
    "unknown": 0.3
}

ARGS = {
    "original": original,
    "compressed": compressed,
    "energies": energies
}
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 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
quench Not yet run
unverified (harvested, no recorded run)
jayluxferro/entropy-gate/src/entropy_gate/quenching.py
code served (permissive licence) · get_code("8ffab7a35346076e")
How it ran

no invocation recorded.

Also present in other papers' code

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

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-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

LLM pipelines waste substantial token budgets on low-information content: repeated context, verbose responses, and redundant boilerplate. We introduce Entropy Gate, a token compression framework applying entropy quenching-a thermodynamic process that progressively freezes out low-energy tokens while preserving semantic fidelity. Each token receives a multi-factor information energy E(t) combining statistical, structural, and positional components. An adaptive quenching schedule T (τ ) = T 0 /(1 + ατ ) removes tokens whose Boltzmann survival probability p i = exp(-E i /kT ) falls below threshold, with a fidelity gate halting compression when energy-weighted similarity drops below θ. We prove token selection by descending E(t) maximizes expected semantic preservation, that quenching produces nested survival sets, and that achievable compression approaches the information-theoretic limit CR → 1 -I(P ; T )/H(P ). A Phase 1 heuristic achieves 40-60% compression across five prompt categories while maintaining S E > 0.80, with energy-squared amplification E → E 2 adding 10-25 percentage points. Context deduplication adds 50-70% savings on repeated blocks. Output-side quenching, motivated by findings that brevity improves accuracy [4], further reduces response overhead. Combined with external memory, reduction composes multiplicatively to 88-96% for agentic workloads. The framework is stateless, model-agnostic, and deploys as an OpenAI-compatible HTTP proxy.

For agents

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

get_harvested_code_for_paper("2606.03739")
get_code_for_paper("2606.03739")
have("2606.03739")

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

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

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

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

Connect an agent — have() is free.