Papers › Adapting LLaMA Decoder to Vision Transformer

Adapting LLaMA Decoder to Vision Transformer

10 Apr 2024arXiv:2404.06773archive 2025-07-28

Jiahao Wang, Wenqi Shao, Mengzhao Chen, Chengyue Wu, Yong liu, Taiqiang Wu, Kaipeng Zhang, Songyang Zhang, Kai Chen, Ping Luo

This work examines whether decoder-only Transformers such as LLaMA, which were originally designed for large language models (LLMs), can be adapted to the computer vision field. We first "LLaMAfy" a standard ViT step-by-step to align with LLaMA's architecture, and find that directly applying a causal mask to the self-attention brings an attention collapse issue, resulting in the failure to the network training. We suggest to reposition the class token behind the image tokens with a post-sequence class token technique to overcome this challenge, enabling causal self-attention to efficiently capture the entire image's information. Additionally, we develop a soft mask strategy that gradually introduces a causal mask to the self-attention at the onset of training to facilitate the optimization behavior. The tailored model, dubbed as image LLaMA (iLLaMA), is akin to LLaMA in architecture and enables direct supervised learning. Its causal self-attention boosts computational efficiency and learns complex representation by elevating attention map ranks. iLLaMA rivals the performance with its encoder-only counterparts, achieving 75.1% ImageNet top-1 accuracy with only 5.7M parameters. Scaling the model to ∼310M and pre-training on ImageNet-21K further enhances the accuracy to 86.0%. Extensive experiments demonstrate iLLaMA's reliable properties: shape-texture bias, calibration, quantization compatibility, ADE20K segmentation and CIFAR transfer learning. We hope our study can kindle fresh views to visual architectures in the wave of LLMs and inspire the development of unified multimodal models. Pre-trained models and codes are available https://github.com/techmonsterwang/iLLaMA.

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 13 code samples harvested from 1 repository linked to this paper: 12 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 3 honoured, 2 violated, 4 with no contract checked; 3 where Syntology's instrument failed) · 1 unverified. Where Syntology's instrument failed: 2 where our contract draft was wrong; 1 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: official repository: 13 samples from 1 repository, 12 ran (9 with no instrument failure; 3 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 between 2026-09-22 and 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 2 of the 12 samples that ran have no recorded date.

techmonsterwang/illama officialmentioned in papermentioned on GitHubpytorchSyntology: 13 samples, 12 ran (3 instrument-failed) · 1 unverified 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

13 samples harvested: 12 ran (of which 0 constructed an object rather than computing a result; 9 with no instrument failure: 3 honoured, 2 violated, 4 with no contract checked; 3 where Syntology's instrument failed) · 1 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.

3ran · honoured contract
2ran · violated contract
2ran · our draft was wrong
1ran; the contract check could not run
4ran
1unverified

Licence: 13 of the 13 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 techmonsterwang/illama. “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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

techmonsterwang/illama official repository 13 samples, 12 ran (3 instrument-failed) · 1 unverified
apply_rotary_emb in 121 papers models/illama.py ran · our draft was wrong no licence file found · pointer only · 5412a244b5b49ca7 · report fixture: signature xq:Tensor/3/float, xk:Tensor/3/float, freqs_cis:Tensor/2/complex · returned tuple · level recorded 2026-09-24
build_transform in 170 papers datasets.py ran no licence file found · pointer only · 6a0317bfd6be9557 · report fixture: signature is_train:bool/0/bool, args:Namespace/0/? · returned Compose · level recorded 2026-09-24
cosine_scheduler in 74 papers utils.py ran · honoured contract no licence file found · pointer only · b700fb0a3496b255 · report fixture: signature base_value:float/0/float, final_value:float/0/float, epochs:int/0/int, niter_per_ep:int/0/int, warmup_epochs:int/0/int, start_warmup_value:float/0/float, warmup_steps:int/0/int · returned ndarray · level recorded 2026-09-25
drop_scheduler in 5 papers drop_scheduler.py ran · honoured contract no licence file found · pointer only · 5e1695210460b9d6 · report fixture: signature drop_rate:float/0/float, epochs:int/0/int, niter_per_ep:int/0/int, cutoff_epoch:int/0/int, mode:str/0/str, schedule:str/0/str · returned ndarray · level recorded 2026-09-22
get_num_layer_for_convnext in 13 papers optim_factory.py ran · honoured contract fingerprinted no licence file found · pointer only · 199223de2f9704cf · report fixture: signature var_name:str/0/str · returned int · level recorded 2026-09-25
get_parameter_groups in 30 papers optim_factory.py ran no licence file found · pointer only · 0ef0019514eaaa09 · report fixture: signature model:callable/0/?, weight_decay:float/0/float, skip_list:tuple/1/empty, get_num_layer:callable/0/?, get_layer_scale:callable/0/? · returned list · level recorded 2026-09-25
mask_scheduler mask_scheduler.py ran no licence file found · pointer only · d26194ed53c706da · report fixture: signature soft_mask_rate:float/0/float, epochs:int/0/int, niter_per_ep:int/0/int, cutoff_epoch:int/0/int, mode:str/0/str, schedule:str/0/str · returned ndarray · level recorded 2026-09-24
precompute_freqs_cis in 112 papers models/illama.py ran · violated contract no licence file found · pointer only · 14a84c2cbfebc413 · report fixture: signature dim:int/0/int, end:int/0/int, theta:float/0/float · returned Tensor · level recorded 2026-09-22
reg_scheduler utils.py ran no licence file found · pointer only · 1d7e5aed37e593e4 · report fixture: signature base_value:float/0/float, final_value:float/0/float, epochs:int/0/int, niter_per_ep:int/0/int, early_epochs:int/0/int, early_value:float/0/float, mode:str/0/str, early_mode:str/0/str · returned ndarray · level recorded 2026-09-24
reshape_for_broadcast in 90 papers
census: 6 implementations from 10 papers, 1 distinct output on one shared input
models/illama.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted no licence file found · pointer only · 70bf6ebaafd266c4 · report fixture: signature freqs_cis:Tensor/2/float, x:Tensor/4/float · returned Tensor · level recorded, date not recorded
str2bool in 533 papers main_soft.py ran · violated contract no licence file found · pointer only · ecf287c12bb06741 · report fixture: signature v:str/0/str · returned bool · level recorded, date not recorded
uniform_element_selection llama2/weight_selection.py ran · our draft was wrong no licence file found · pointer only · 7d05bb3d813045ba · report fixture: signature wt:Tensor/4/float, s_shape:tuple/1/int · returned Tensor · level recorded 2026-09-24
build_dataset in 151 papers datasets.py unverified no licence file found · pointer only · 9f7ea37592e1e7c7 · report

Tasks

Computational EfficiencyDecoderQuantizationTransfer Learning

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

ALIGNLLaMA

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