SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2407.10833 · ECCV · 2024

MoE-DiffIR: Task-customized Diffusion Priors for Universal Compressed Image Restoration

Xin Li, Zhibo Chen, Li Zhang, Shijie Zhao, Xingrui Wang, Mengxi Guo, Yulin Ren, Bingchen Li

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; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 3 no recorded run), measured 2026-11-22; 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/2407.10833.json · badge: /api/ran/2407.10833.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
Justin-Tan/high-fidelity-generative-compression canonical (classifier label)
classifier basis: census
8 ran · 3 no recorded run
FunctionStatusWhere it lives
empty_message Ran
ran; our contract draft was wrong, not the code
Justin-Tan/high-fidelity-generative-compression/src/compression/ans.py
code served (permissive licence) · get_code("cdd42fd1996f0d00")
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 numpy as np

RANS_L = 1 << 31

def empty_message(shape):
    return (np.full(shape, RANS_L, 'uint64'), ())

# The function takes a shape parameter and returns a tuple containing:
# - A numpy array filled with RANS_L value of dtype uint64
# - An empty tuple

# Valid shapes can be tuples of integers representing array dimensions
ARGS = {
    'shape': (2, 4)
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
pmf_to_quantized_cdf Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
Justin-Tan/high-fidelity-generative-compression/src/helpers/maths.py
code served (permissive licence) · get_code("8169fb353c1eddce")
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 Tensor, ndim 1, dtype family int, shape (5,) 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

torch.manual_seed(0)

# Create a small PMF tensor
# The function expects pmf to have shape where last dimension >= 2
# It will create a CDF of shape [pmf.shape[0] + 1]
pmf = torch.tensor([0.2, 0.3, 0.25, 0.25], dtype=torch.float32)

precision = 16
careful = True

ARGS = {
    "pmf": pmf,
    "precision": precision,
    "careful": careful,
}
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 Tensor, ndim 1, dtype family int, shape (5,) — shape (5,) 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
prior_scale_table Ran
ran, honoured the contract we drafted
Justin-Tan/high-fidelity-generative-compression/src/compression/prior_model.py
code served (permissive licence) · get_code("db553ee9f96641cd")
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 Tensor, ndim 1, dtype family float, shape (64,) 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)

ARGS = {
    "scales_min": 0.11,
    "scales_max": 256,
    "levels": 64
}
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 Tensor, ndim 1, dtype family float, shape (64,) — shape (64,) 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
stack_extend Ran
ran, honoured the contract we drafted
Justin-Tan/high-fidelity-generative-compression/src/compression/ans.py
code served (permissive licence) · get_code("be6081790a78bd00")
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 numpy as np

torch.manual_seed(0)

# The function stack_extend takes two parameters: stack and arr
# It simply returns a tuple of (arr, stack)
# Both parameters can be any type since the function just rearranges them

# Create simple test values
stack_value = [1, 2, 3]  # A simple list as stack
arr_value = torch.tensor([[1.0, 2.0, 3.0, 4.0],
                          [5.0, 6.0, 7.0, 8.0]])  # Small 2x4 tensor as arr

ARGS = {
    'stack': stack_value,
    'arr': arr_value
}
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 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
stack_slice Ran
ran; our contract draft was wrong, not the code
Justin-Tan/high-fidelity-generative-compression/src/compression/ans.py
code served (permissive licence) · get_code("c2290958ec105f86")
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 numpy as np

def stack_slice(stack, n):
    slc = []
    while n > 0:
        arr, stack = stack
        if n >= len(arr):
            slc.append(arr)
            n -= len(arr)
        else:
            slc.append(arr[:n])
            stack = (arr[n:], stack)
            break
    return (stack, np.concatenate(slc))

# Construct a nested stack structure
# Stack is a tuple of (array, remaining_stack)
# We build: (arr1, (arr2, (arr3, None)))
arr1 = np.array([1, 2, 3, 4, 5])
arr2 = np.array([6, 7, 8])
arr3 = np.array([9, 10])

stack = (arr1, (arr2, (arr3, None)))

# n is the number of elements to slice
n = 7

ARGS = {
    "stack": stack,
    "n": n
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
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
standardized_CDF_gaussian Ran
ran; our contract draft was wrong, not the code
Justin-Tan/high-fidelity-generative-compression/src/helpers/maths.py
code served (permissive licence) · get_code("3bc31588e9eaef4f")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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)

# The function takes a single parameter 'value' which is used in:
# - multiplication with a scalar (-1.0 / np.sqrt(2))
# - passed to torch.erfc()
# This suggests 'value' should be a torch tensor

value = torch.randn(2, 4)

ARGS = {
    "value": value
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
standardized_CDF_logistic Ran
ran; our contract draft was wrong, not the code
Justin-Tan/high-fidelity-generative-compression/src/helpers/maths.py
code served (permissive licence) · get_code("aa2e81dea4597c5e")
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 Tensor, ndim 2, dtype family float, shape (2, 4) 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

torch.manual_seed(0)

# The function standardized_CDF_logistic takes a single parameter 'value'
# and applies torch.sigmoid to it. We need to provide a tensor.
# Creating a small tensor with shape (2, 4) as per requirements.

value = torch.randn(2, 4)

ARGS = {
    "value": value
}
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 Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
view_update Ran
ran; our contract draft was wrong, not the code
Justin-Tan/high-fidelity-generative-compression/src/compression/compression_utils.py
code served (permissive licence) · get_code("0b12296531c3532e")
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 autograd.numpy as np
from autograd import make_vjp
from autograd.extend import vspace, VSpace

# Create a simple data object - a numpy array
data = np.array([1.0, 2.0, 3.0, 4.0])

# Create a view function that extracts/transforms part of the data
def view_fun(x):
    # Simple view: square the first two elements
    return x[:2] ** 2

ARGS = {
    'data': data,
    'view_fun': view_fun,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
autograd — 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_background Not yet run
unverified (harvested, no recorded run)
Justin-Tan/high-fidelity-generative-compression/src/helpers/datasets.py
code served (permissive licence) · get_code("839001b755552a0b")
How it ran

no invocation recorded.

get_dataset Not yet run
unverified (harvested, no recorded run)
Justin-Tan/high-fidelity-generative-compression/src/helpers/datasets.py
code served (permissive licence) · get_code("4bde06f8d5798cfa")
How it ran

no invocation recorded.

get_img_size Not yet run
unverified (harvested, no recorded run)
Justin-Tan/high-fidelity-generative-compression/src/helpers/datasets.py
code served (permissive licence) · get_code("bc54c1e183c90aa3")
How it ran

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

FunctionAlso present inEarliest-datedOthers named
stack_extend 1 other paper
1 dated earlier
2107.09202 (2021-07)
Compressing Multisets with Large Alphabets using Bits-Back Coding

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

We present MoE-DiffIR, an innovative universal compressed image restoration (CIR) method with task-customized diffusion priors. This intends to handle two pivotal challenges in the existing CIR methods: (i) lacking adaptability and universality for different image codecs, e.g., JPEG and WebP; (ii) poor texture generation capability, particularly at low bitrates. Specifically, our MoE-DiffIR develops the powerful mixture-of-experts (MoE) prompt module, where some basic prompts cooperate to excavate the task-customized diffusion priors from Stable Diffusion (SD) for each compression task. Moreover, the degradation-aware routing mechanism is proposed to enable the flexible assignment of basic prompts. To activate and reuse the cross-modality generation prior of SD, we design the visual-to-text adapter for MoE-DiffIR, which aims to adapt the embedding of low-quality images from the visual domain to the textual domain as the textual guidance for SD, enabling more consistent and reasonable texture generation. We also construct one comprehensive benchmark dataset for universal CIR, covering 21 types of degradations from 7 popular traditional and learned codecs. Extensive experiments on universal CIR have demonstrated the excellent robustness and texture restoration capability of our proposed MoE-DiffIR. The project can be found at https://renyulin-f.github.io/MoE-DiffIR.github.io/.

For agents

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

get_harvested_code_for_paper("2407.10833")
get_code_for_paper("2407.10833")
have("2407.10833")

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

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

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

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

Connect an agent — have() is free.