SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2502.16060 · ICLR · 2025

Tokenizing Single-Channel EEG with Time-Frequency Motif Learning

Jimeng Sun, Zheng Chen, Jathurshan Pradeepkumar, Xihao Piao

arXiv · PDF · Open in the Atlas

Code that ran

8 of 8 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 7 have no contract verdict; 1 failure of our instrument; 0 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/2502.16060.json · badge: /api/ran/2502.16060.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
Jathurshan0330/TFM-Tokenizer canonical (classifier label)
classifier basis not recorded on the link
8 ran · 0 no recorded run
FunctionStatusWhere it lives
BCE Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/utils/utils.py
code served (permissive licence) · get_code("88ceb990f4b4ac35")
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 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

torch.manual_seed(0)

# Create small tensors for y_hat and y
# y_hat: predicted probabilities (batch_size=2, single output)
y_hat = torch.randn(2, 1)

# y: binary labels (batch_size=2, single label)
y = torch.randint(0, 2, (2, 1)).float()

ARGS = {
    "y_hat": y_hat,
    "y": y
}
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 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
collate_fn_unsupervised_pretrain Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/datasets/data_loaders.py
code served (permissive licence) · get_code("374324616b0617af")
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, ndim 4, 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

torch.manual_seed(0)

# Create sample data: each item is (samples, labels, dataset_idx)
# samples should be a tensor, labels can be anything, dataset_idx is 0-3
batch = [
    (torch.randn(4, 3), torch.tensor([0, 1, 0, 1]), 0),  # TUAB dataset
    (torch.randn(4, 3), torch.tensor([1, 0, 1, 0]), 1),  # TUEV dataset
    (torch.randn(4, 3), torch.tensor([0, 0, 1, 1]), 2),  # CHBMIT dataset
    (torch.randn(4, 3), torch.tensor([1, 1, 0, 0]), 3),  # IIIC dataset
]

ARGS = {
    "batch": batch,
}
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 tuple, ndim 4, dtype family float — a tuple 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
focal_loss Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/utils/utils.py
code served (permissive licence) · get_code("4156bae98d1b1972")
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 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

torch.manual_seed(0)

# Create small tensors for the focal loss function
# y_hat: logits (predictions before sigmoid)
# y: binary labels (0 or 1)
y_hat = torch.randn(2, 1, dtype=torch.float32)
y = torch.randint(0, 2, (2, 1), dtype=torch.float32)

ARGS = {
    "y_hat": y_hat,
    "y": y,
    "alpha": 0.8,
    "gamma": 0.7,
}
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 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
freq_bin_temporal_masking Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/models/tfm_token.py
code served (permissive licence) · get_code("10e428f98b559617")
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, ndim 4, 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

torch.manual_seed(0)

# The function expects:
# X: tensor of shape (B, F, T) where:
#   - B is batch size
#   - F is frequency dimension (must be divisible by freq_bin_size)
#   - T is time dimension (must be divisible by time_bin_size)
# freq_mask_ratio: float between 0 and 1
# freq_bin_size: int that divides F
# time_mask_ratio: float between 0 and 1
# time_bin_size: int that divides T

# Create a tensor with compatible dimensions
# F=20 (divisible by freq_bin_size=5)
# T=30 (divisible by time_bin_size=10)
B = 2
F = 20
T = 30

X = torch.randn(B, F, T)

ARGS = {
    "X": X,
    "freq_mask_ratio": 0.5,
    "freq_bin_size": 5,
    "time_mask_ratio": 0.5,
    "time_bin_size": 10,
}
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 tuple, ndim 4, dtype family float — a tuple 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_finetuned_path Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/push_to_hub.py
code served (permissive licence) · get_code("fdc79b98f54b0725")
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 os
import tempfile

CODE_BOOK_SIZE = 8192
EMB_SIZE = 64

# Create a temporary directory to act as results_root
results_root = tempfile.mkdtemp()

# Create the directory structure for one of the expected paths
dataset = "test_dataset"
seed = 42

# Create path_a structure
dir_path_a = os.path.join(results_root, f'Downstream_Finetuned_{dataset}_{CODE_BOOK_SIZE}_{EMB_SIZE}_seed_{seed}')
os.makedirs(dir_path_a, exist_ok=True)
open(os.path.join(dir_path_a, 'best_model.pth'), 'w').close()

ARGS = {
    "results_root": results_root,
    "dataset": dataset,
    "seed": seed,
}
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 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
l2norm Ran
ran; our contract draft was wrong, not the code
Jathurshan0330/TFM-Tokenizer/models/tfm_token.py
pointer only (licence: MIT); the stored copy get_code serves, from jy0205/LaVIT, is pointer only (licence: NOASSERTION) · get_code("eca6cdf05972a95e")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from jy0205/LaVIT, and GitHub could not classify the licence of that repository (NOASSERTION). 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.

process_metadata Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/datasets_processing/CHB-MIT/process_1.py
code served (permissive licence) · get_code("734b478c6fc895d2")
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 dict. 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 tempfile
import os

# Create temporary files to serve as summary and metadata
temp_dir = tempfile.mkdtemp()
summary_file = os.path.join(temp_dir, "summary.txt")

# Write a sample summary file that matches the expected format
summary_content = """Patient 001 File 001
Number of seizures: 2
Seizure Start Time: 10 256
Seizure End Time: 20 256
Seizure Start Time: 30 256
Seizure End Time: 40 256
Patient 002 File 002
Number of seizures: 1
Seizure Start Time: 50 256
Seizure End Time: 60 256
Patient 003 File 003
Number of seizures: 0
"""

with open(summary_file, 'w') as f:
    f.write(summary_content)

ARGS = {
    "summary": summary_file,
    "filename": "File 001"
}
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 dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
read_hyp_params Ran
ran on a synthesized input
Jathurshan0330/TFM-Tokenizer/utils/utils.py
code served (permissive licence) · get_code("8d43078a11ac49b4")
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 Hyp. 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 tempfile
import os

# Create a temporary hyperparameter file
with tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt') as f:
    f.write("learning_rate: 0.001\n")
    f.write("epochs: 100\n")
    f.write("batch_size: 32\n")
    f.write("use_dropout: true\n")
    f.write("use_batch_norm: false\n")
    f.write("momentum: 0.9\n")
    f.write("weight_decay: 1e-5\n")
    f.write("model_name: resnet50\n")
    hyp_file_path = f.name

ARGS = {
    "hyp_path": hyp_file_path
}
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 Hyp — a Hyp output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Hyp 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

Also present in other papers' code

Of 8 samples lifted from this paper's linked repositories, 8 carry a function identity and 0 do not. Of the 8 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, 1 later) and 7 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
l2norm 24 other papers
19 dated earlier, 4 later, 1 same year, order not determinable · 6 only as an assembly brick
2212.09058 (2022-12)
BEATs: Audio Pre-Training with Acoustic Tokenizers
2303.04341 (2023-03)
Neural Vector Fields: Implicit Representation by Explicit Learning
2303.04743 (2023-03)
Vector Quantized Time Series Generation with a Bidirectional Prior Model
and 21 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-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

Foundation models are reshaping EEG analysis, yet an important problem of EEG tokenization remains a challenge. This paper presents TFM-Tokenizer, a novel tokenization framework that learns a vocabulary of time-frequency motifs from single-channel EEG signals and encodes them into discrete tokens. We propose a dual-path architecture with time-frequency masking to capture robust motif representations, and it is model-agnostic, supporting both lightweight transformers and existing foundation models for downstream tasks. Our study demonstrates three key benefits: Accuracy: Experiments on four diverse EEG benchmarks demonstrate consistent performance gains across both single-and multi-dataset pretraining settings, achieving up to 11% improvement in Cohen's Kappa over strong baselines. Generalization: Moreover, as a plug-and-play component, it consistently boosts the performance of diverse foundation models, including BIOT and LaBraM. Scalability: By operating at the single-channel level rather than relying on the strict 10-20 EEG system, our method has the potential to be deviceagnostic. Experiments on ear-EEG sleep staging, which differs from the pretraining data in signal format, channel configuration, recording device, and task, show that our tokenizer outperforms baselines by 14%. A comprehensive token analysis reveals strong class-discriminative, frequency-aware, and consistent structure, enabling improved representation quality and interpretability. Code is available at https://github.com/Jathurshan0330/TFM-Tokenizer.

For agents

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

get_harvested_code_for_paper("2502.16060")
get_code_for_paper("2502.16060")
have("2502.16060")

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

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

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

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

Connect an agent — have() is free.