SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2602.08031 · 2026

Beyond Raw Detection Scores: Markov-Informed Calibration for Boosting Machine-Generated Text Detection

Bo Han, Defu Lian, Shuhai Zhang, Yiu-Ming Cheung, Chenwang Wu

arXiv · PDF · Open in the Atlas

Code that ran

9 of 12 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; 7 failures of our instrument; 3 no recorded run), measured 2026-11-21; 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/2602.08031.json · badge: /api/ran/2602.08031.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
tmlr-group/MRF_Calibration canonical (classifier label)
classifier basis: census
9 ran · 3 no recorded run
FunctionStatusWhere it lives
check_period Ran
ran; our contract draft was wrong, not the code
tmlr-group/MRF_Calibration/dataset_loader_sentence.py
code served (permissive licence) · get_code("f160a89ad3be6484")
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 torch

# Construct a list of text strings to pass to check_period
texts = [
    "Hello world",
    "This is a test",
    "Already has period."
]

ARGS = {
    'texts': texts
}
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 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
get_data Ran
ran, honoured the contract we drafted
tmlr-group/MRF_Calibration/improve_mrf_detectgpt.py
code served (permissive licence) · get_code("70ab95382e12e143")
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 ndarray, ndim 3, dtype family float, shape (2, 11, 1024) 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 numpy as np

# Analyze the function:
# - feature1: iterable of length N, each element is indexable with 10 items, 
#   each item is array-like with a len()
# - feature2: iterable of length N, each element is array-like with a len()

# Create feature1: list of 2 items (batch size 2)
# Each item is a list of 10 arrays
feature1 = [
    [np.array([1.0, 2.0, 3.0, 4.0]), 
     np.array([5.0, 6.0]),
     np.array([7.0, 8.0, 9.0]),
     np.array([10.0]),
     np.array([11.0, 12.0, 13.0, 14.0]),
     np.array([15.0, 16.0]),
     np.array([17.0]),
     np.array([18.0, 19.0, 20.0]),
     np.array([21.0, 22.0]),
     np.array([23.0, 24.0, 25.0, 26.0])],
    [np.array([27.0, 28.0]),
     np.array([29.0, 30.0, 31.0]),
     np.array([32.0]),
     np.array([33.0, 34.0, 35.0, 36.0]),
     np.array([37.0, 38.0]),
     np.array([39.0, 40.0, 41.0]),
     np.array([42.0]),
     np.array([43.0, 44.0, 45.0, 46.0]),
     np.array([47.0, 48.0]),
     np.array([49.0, 50.0, 51.0])]
]

# Create feature2: list of 2 arrays
feature2 = [
    np.array([52.0, 53.0, 54.0]),
    np.array([55.0, 56.0, 57.0, 58.0])
]

ARGS = {
    "feature1": feature1,
    "feature2": feature2
}
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 ndarray, ndim 3, dtype family float, shape (2, 11, 1024) — shape (2, 11, 1024) 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
get_mask Ran
ran, honoured the contract we drafted
tmlr-group/MRF_Calibration/improve_mrf.py
code served (permissive licence) · get_code("9d456e213148f63b")
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 ndarray, ndim 2, dtype family int, 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 numpy as np

# The function get_mask takes a single parameter 'x' which should be:
# - A 2D numpy array where each row represents a sequence
# - The function checks for zeros and creates a mask based on whether
#   all remaining elements after a zero are also zero

# Create a small test input with distinct dimensions
# Using shape (2, 4) - batch size 2, sequence length 4
x = np.array([
    [1, 2, 3, 0],      # Row 0: ends with single zero
    [1, 0, 0, 0]       # Row 1: has zeros that continue to end
], dtype=np.int32)

ARGS = {
    "x": x
}
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 ndarray, ndim 2, dtype family int, 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
get_mask Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tmlr-group/MRF_Calibration/improve_mrf_detectgpt.py
code served (permissive licence) · get_code("18fcf8620656547d")
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 ndarray, ndim 3, dtype family float, shape (2, 4, 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 numpy as np

# The function get_mask expects a numpy array x
# Looking at the function, it:
# - Creates a mask of zeros with same shape as x
# - Iterates through dimensions i and j (so x must be at least 2D)
# - Accesses x[i, j] which suggests x is at least 3D (indexed as [i, j, :])
# - Performs operations on x[i, j] treating it as a 1D array
# - Creates mask entries with mask[i, j] = scalar and mask[i, j, :iidx] = array slice

# So x should be a 3D array with shape (batch, sequence, features) or similar
# Let's create a simple test case

x = np.array([
    [
        [1, 2, 3, 0],  # has a zero at end
        [0, 0, 0, 0],  # all zeros
        [1, 0, 0, 0],  # has zeros from index 1 onwards
        [5, 6, 7, 8],  # no zeros
    ],
    [
        [1, 1, 1, 1],  # no zeros
        [0, 1, 0, 0],  # has zeros but not all trailing
        [2, 0, 0, 0],  # zeros from index 1 onwards
        [0, 0, 0, 1],  # not all zeros at end
    ]
], dtype=np.float32)

ARGS = {
    "x": x
}
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 ndarray, ndim 3, dtype family float, shape (2, 4, 4) — shape (2, 4, 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
prim_tree Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
tmlr-group/MRF_Calibration/methods/IntrinsicDim.py
code served (permissive licence) · get_code("595d1d025c7e692d")
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 numpy as np

# Create a small valid adjacency matrix for Prim's algorithm
# The function expects a square matrix where adj_matrix[i][j] represents edge weights
# We'll create a 4x4 symmetric adjacency matrix with positive weights
np.random.seed(0)
adj_matrix = np.array([
    [0.0, 1.5, 3.2, 2.1],
    [1.5, 0.0, 2.8, 4.5],
    [3.2, 2.8, 0.0, 1.9],
    [2.1, 4.5, 1.9, 0.0]
], dtype=np.float64)

alpha = 1.0

ARGS = {
    "adj_matrix": adj_matrix,
    "alpha": alpha
}
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 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
process_spaces Ran
ran; our contract draft was wrong, not the code
tmlr-group/MRF_Calibration/dataset_loader_sentence.py
code served (permissive licence) · get_code("c5d3444c3ea71db9")
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

torch.manual_seed(0)

# The function process_spaces takes a single parameter: text (a string)
# It performs various string replacements and transformations
# No complex objects needed - just a string

ARGS = {
    'text': "Hello , world . This is a test ! What's ( happening ) here ; it's < newline > time ."
}
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 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
process_string Ran
ran; our contract draft was wrong, not the code
tmlr-group/MRF_Calibration/methods/IntrinsicDim.py
code served (permissive licence) · get_code("ad5f00016ee9222a")
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

torch.manual_seed(0)

# Analyzing the function:
# def process_string(sss):
#     return sss.replace('\n', ' ').replace('  ', ' ')
# 
# The function takes a single parameter 'sss' which must be a string.
# It calls .replace() on it twice, so it must be a string type.

ARGS = {
    'sss': 'hello\nworld\n  test  string'
}
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
process_text_truthfulqa_adv Ran
ran; our contract draft was wrong, not the code
tmlr-group/MRF_Calibration/dataset_loader_sentence.py
code served (permissive licence) · get_code("dd7573db30a9bd4e")
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

torch.manual_seed(0)

# The function process_text_truthfulqa_adv takes a single parameter 'text' which is a string.
# It checks for specific substrings and removes text before the first period + 2 characters if found.
# Then it returns the processed text.

text_input = "I am sorry for the confusion. This is the actual response you're looking for."

ARGS = {
    "text": text_input
}
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 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
tokenize_and_mask Ran
ran; our contract draft was wrong, not the code
tmlr-group/MRF_Calibration/methods/detectgpt.py
code served (permissive licence) · get_code("e4025e69a644bfcf")
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 numpy as np

np.random.seed(0)

ARGS = {
    'text': 'the quick brown fox jumps over the lazy dog and runs through the forest with great speed today',
    'span_length': 3,
    'buffer_size': 2,
    'pct': 0.3,
    'ceil_pct': False,
}
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 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
count_masks Not yet run
unverified (harvested, no recorded run)
tmlr-group/MRF_Calibration/methods/detectgpt.py
code served (permissive licence) · get_code("23c3416429f69fee")
How it ran

no invocation recorded. this sample carries JSON test cases instead of a setup block; get_reference_implementation serves them with the level they back.

get_data Not yet run
unverified (harvested, no recorded run)
tmlr-group/MRF_Calibration/improve_mrf_dnagpt.py
code served (permissive licence) · get_code("a1b1c30a69348641")
How it ran

no invocation recorded.

replace_masks Not yet run
unverified (harvested, no recorded run)
tmlr-group/MRF_Calibration/methods/detectgpt.py
code served (permissive licence) · get_code("3b992344e4b4f98b")
How it ran

no invocation recorded.

Also present in other papers' code

Of 12 samples lifted from this paper's linked repositories, 12 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 6 are also present in other papers whose code we hold (6 with at least one paper dated earlier, 0 the same month, 0 later) and 6 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
count_masks 11 other papers
11 dated earlier
2023.emnlp-main.616 (2023 (year only))
MULTITuDE: Large-Scale Multilingual Machine-Generated Text Detection Benchmark
2303.14822 (2023-03)
MGTBench: Benchmarking Machine-Generated Text Detection
2305.18462 (2023-05)
Membership Inference Attacks against Language Models via Neighbourhood Comparison
and 8 more not named here
prim_tree 4 other papers
4 dated earlier
2023.emnlp-main.616 (2023 (year only))
MULTITuDE: Large-Scale Multilingual Machine-Generated Text Detection Benchmark
2303.14822 (2023-03)
MGTBench: Benchmarking Machine-Generated Text Detection
2306.04723 (2023-06)
Intrinsic Dimension Estimation for Robust Detection of AI-Generated Texts
and 1 more not named here
process_spaces 3 other papers
3 dated earlier
2023.emnlp-main.616 (2023 (year only))
MULTITuDE: Large-Scale Multilingual Machine-Generated Text Detection Benchmark
2303.14822 (2023-03)
MGTBench: Benchmarking Machine-Generated Text Detection
2401.05952 (2024-01)
LLM-as-a-Coauthor: Can Mixed Human-Written and Machine-Generated Text Be Detected?
process_string 3 other papers
3 dated earlier
2023.emnlp-main.616 (2023 (year only))
MULTITuDE: Large-Scale Multilingual Machine-Generated Text Detection Benchmark
2303.14822 (2023-03)
MGTBench: Benchmarking Machine-Generated Text Detection
2306.04723 (2023-06)
Intrinsic Dimension Estimation for Robust Detection of AI-Generated Texts
process_text_truthfulqa_adv 3 other papers
3 dated earlier
2023.emnlp-main.616 (2023 (year only))
MULTITuDE: Large-Scale Multilingual Machine-Generated Text Detection Benchmark
2303.14822 (2023-03)
MGTBench: Benchmarking Machine-Generated Text Detection
2401.05952 (2024-01)
LLM-as-a-Coauthor: Can Mixed Human-Written and Machine-Generated Text Be Detected?
replace_masks 3 other papers
3 dated earlier
2023.emnlp-main.616 (2023 (year only))
MULTITuDE: Large-Scale Multilingual Machine-Generated Text Detection Benchmark
2303.14822 (2023-03)
MGTBench: Benchmarking Machine-Generated Text Detection
2401.05952 (2024-01)
LLM-as-a-Coauthor: Can Mixed Human-Written and Machine-Generated Text Be Detected?

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

Repositories linked to this paper

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

Abstract

While machine-generated texts (MGTs) offer great convenience, they also pose risks such as disinformation and phishing, highlighting the need for reliable detection. Metric-based methods, which extract statistically distinguishable features of MGTs, are often more practical than complex model-based methods that are prone to overfitting. Given their diverse designs, we first place representative metric-based methods within a unified framework, enabling a clear assessment of their advantages and limitations. Our analysis identifies a core challenge across these methods: the token-level detection score is easily biased by the inherent randomness of the MGTs generation process. To address this, we theoretically and empirically reveal two relationships of context detection scores that may aid calibration: Neighbor Similarity and Initial Instability. We then propose a Markov-informed score calibration strategy that models these relationships using Markov random fields, and implements it as a lightweight component via a mean-field approximation, allowing our method to be seamlessly integrated into existing detectors. Extensive experiments in various real-world scenarios, such as cross-LLM and paraphrasing attacks, demonstrate significant gains over baselines with negligible computational overhead. The code is available at https://github.com/tmlr-group/MRF_Calibration.

For agents

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

get_harvested_code_for_paper("2602.08031")
get_code_for_paper("2602.08031")
have("2602.08031")

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

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

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

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

Connect an agent — have() is free.