Papers › TokenFormer: Rethinking Transformer Scaling with Tokenized Model Parameters

TokenFormer: Rethinking Transformer Scaling with Tokenized Model Parameters

30 Oct 2024arXiv:2410.23168archive 2025-07-28

Haiyang Wang, Yue Fan, Muhammad Ferjad Naeem, Yongqin Xian, Jan Eric Lenssen, LiWei Wang, Federico Tombari, Bernt Schiele

Transformers have become the predominant architecture in foundation models due to their excellent performance across various domains. However, the substantial cost of scaling these models remains a significant concern. This problem arises primarily from their dependence on a fixed number of parameters within linear projections. When architectural modifications (e.g., channel dimensions) are introduced, the entire model typically requires retraining from scratch. As model sizes continue growing, this strategy results in increasingly high computational costs and becomes unsustainable. To overcome this problem, we introduce TokenFormer, a natively scalable architecture that leverages the attention mechanism not only for computations among input tokens but also for interactions between tokens and model parameters, thereby enhancing architectural flexibility. By treating model parameters as tokens, we replace all the linear projections in Transformers with our token-parameter attention layer, where input tokens act as queries and model parameters as keys and values. This reformulation allows for progressive and efficient scaling without necessitating retraining from scratch. Our model scales from 124M to 1.4B parameters by incrementally adding new key-value parameter pairs, achieving performance comparable to Transformers trained from scratch while greatly reducing training costs. Code and models are available at https://github.com/Haiyang-W/TokenFormer.

PaperPDFCodeCode Syntology ran

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 11 code samples harvested from 1 repository linked to this paper: 7 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 5 where Syntology's instrument failed) · 4 unverified. Where Syntology's instrument failed: 5 where our contract draft was wrong; failures of Syntology's instrument, not of the code.

By repository: official repository: 11 samples from 1 repository, 7 ran (2 with no instrument failure; 5 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

haiyang-w/tokenformer officialmentioned in papermentioned on GitHubpytorchApache-2.0Syntology: 11 samples, 7 ran (5 instrument-failed) · 4 unverified report
zhaoolee/garss mentioned on GitHubpytorchSyntology: not harvested report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested: 7 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 5 where Syntology's instrument failed) · 4 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

5ran · our draft was wrong
2ran
4unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from haiyang-w/tokenformer. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

haiyang-w/tokenformer official repository 11 samples, 7 ran (5 instrument-failed) · 4 unverified
filter_instances tokenformer-tpu/multihost_runner.py ran · our draft was wrong Apache-2.0 (permissive) · d0d48b0ed10415a4 · report fixture: signature instance_list:list/1/str, tpu_prefix:str/0/str · returned list · level recorded 2026-09-25
fmt_size tokenformer-tpu/MaxText/convert_gpt3_ckpt_from_paxml.py ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 9deb7b7f6b8bd358 · report fixture: signature num_bytes:int/0/int · returned str · level recorded 2026-09-25
gpt2_attention_mask_func megatron/model/tokenformer_model.py ran · our draft was wrong Apache-2.0 (permissive) · 835e9eaf895dece7 · report fixture: signature attention_scores:Tensor/3/float, ltor_mask:Tensor/3/bool · returned Tensor · level recorded 2026-09-25
nest_params tokenformer-tpu/MaxText/convert_gemma_chkpt.py ran · our draft was wrong Apache-2.0 (permissive) · f6a22c8bbef18283 · report fixture: signature params:dict/0/? · returned dict · level recorded 2026-09-25
normalize_gcs_bucket_name tokenformer-tpu/multihost_job.py ran · our draft was wrong Apache-2.0 (permissive) · 2530c27eb1db0abd · report fixture: signature args:Args/0/? · returned Args · level recorded 2026-09-25
prefill_benchmark_loop tokenformer-tpu/MaxText/inference_microbenchmark.py ran Apache-2.0 (permissive) · 5ce28e5d7146e8ad · report fixture: signature engine:MockEngine/0/?, params:dict/0/?, tokens:ArrayImpl/2/int, true_length:ArrayImpl/1/int, iters:int/0/int · returned float · level recorded 2026-09-25
run_create_resources tokenformer-tpu/multihost_job.py ran Apache-2.0 (permissive) · 9ff16fbb932de037 · report fixture: signature startup_script_file:str/0/str, args:Namespace/0/? · returned CompletedProcess · level recorded 2026-09-25
execute_main_command tokenformer-tpu/multihost_runner.py unverified Apache-2.0 (permissive) · 4ec6a8b213a8a8ab · report
get_system_characteristics tokenformer-tpu/MaxText/accelerator_to_spec_map.py unverified Apache-2.0 (permissive) · 87c57735e68651cc · report
move_script_dir_to_gcs tokenformer-tpu/multihost_job.py unverified Apache-2.0 (permissive) · 6a8c33a4bc4cad79 · report
scps tokenformer-tpu/multihost_runner.py unverified Apache-2.0 (permissive) · 669c3270deb52aa2 · report

Tasks

model

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

AttentionSoftmax

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections