In one line: The causal mask is needed for generation but not, in principle, for reading a prompt that is already complete. Bitune reads the prompt twice (causal and bidirectional, each with its own adapter), mixes the two sets of keys and values per block with learned weights, and generates causally as usual: on five 2B to 8B models, +0.1 to +4.0 points over LoRA on a 5-task zero-shot average (3 seeds; largest on the smallest model), for about 3 times the finetuning time.
How far to trust it: Believe the direction: the gains are measured over 3 seeds, survive the noise on most models and in a parameter-matched baseline, and the learning rate was tuned for the baseline, not for Bitune. Treat the size as model-dependent (from +4.0 points on Gemma-2B to +0.1 on Gemma-7B), the claim that every component is needed as not shown (two of the ten ablation gaps are inside the noise), and the cost as larger than "negligible" whenever prompts are long and answers short. The evidence, judged.
The idea in one sentence: a decoder reads its prompt through the causal mask although the whole prompt is already there, so Bitune prefills the prompt twice, once causally and once bidirectionally with its own adapter, mixes the two sets of keys and values in every block with learned weights, and then generates causally from that mixed cache as usual; on five 2B to 8B models this adds +0.1 to +4.0 points over LoRA on a 5-task zero-shot average, for about 3 times the finetuning time.
You need: the causal and bidirectional masks and the prefix LM (Families and objectives), why a KV cache exists (The transformer from zero, section 9), and LoRA (PEFT); this page is the paper. New terms: instruction features (the paper's name for the prompt's keys and values in every block); causal and bidirectional pass (the two prefills, each with its own adapter); αk, αv (the learned share of bidirectional keys and values in each block); LoRA16 (the rank-16 baseline with Bitune's parameter count); Naive Bidir. (the mask simply switched off over the prompt: a prefix LM made from a pretrained decoder).
Dawid J. Kopiczko, Tijmen Blankevoort, Yuki M. Asano. arXiv 2405.14862: v1 on 23 May 2024 as "Bitune: Bidirectional Instruction-Tuning" (Vrije Universiteit Amsterdam, Meta, University of Amsterdam); v2 on 28 August 2025 under the current title (Fundamental AI Lab, University of Technology Nuremberg; Blankevoort at Meta). Published at EMNLP 2025, main conference, pages 9510 to 9536. Project page. Added to this knowledge base on 2026-09-01 from a blog entry. Topics: llm-architecture, llm-training-and-post-training.

An instruction-tuned model prefills the whole instruction at once, storing every token's keys and values in every block (the instruction features), then decodes the answer token by token against that cache: p(a|q) = Πi p(ai | a1, ..., ai−1, q) (§2). Decoder-only models apply the causal mask to both phases. It exists for generation, but the prefilled prompt is already fully available, so every prompt token's features are computed from the tokens to its left only. Click a token in the explorer beside this to see what it can attend to, in the paper's own prompt template.
An instruction-tuned model answers in two phases (§2). Prefilling runs the whole instruction through the model at once and stores, for every token and every block, its key and value vectors (the KV cache; the paper calls them instruction features). Decoding then generates the answer one token at a time, each new token attending to that cache and to the answer so far. The answer is conditional on the instruction from its very first token. Decoder-only models apply the causal mask everywhere, prompt included. The mask exists for generation: a token being predicted must not see the future. When the prompt is prefilled it is already fully available, so masking it throws information away.
All of it: the answer comes after the whole prompt, so the causal mask hides nothing from it. What the mask costs is elsewhere. The answer reads the prompt through its keys and values, and those were computed, block by block, before any prompt token could see the tokens after it: "George" and "warm" were encoded without knowing that the question is about friction, the question was encoded without knowing the choices. The answer can only combine features that were built with half the context. That is the narrower claim the paper tests.
Bidirectional encoders (BERT, T5's encoder) and decoders turned into embedding models (LLM2Vec, NV-Embed) already read their input both ways (§1; the masks and families compared: Families and objectives). Bitune asks a narrower question: can a pretrained decoder get that benefit for ordinary instruction following, without changing the pretrained model or the way it generates?
BERTBASE was sized to match OpenAI's GPT and scored 79.6 against GPT's 75.1 on the GLUE average (BERT Table 1), and T5 and BERT both use bidirectional attention over the input (§1). Work that turns decoder LLMs into text encoders switches the mask off: LLM2Vec enables bidirectional attention as its first step (LLM2Vec), and NV-Embed removes "the causal attention mask of LLMs during contrastive training" (NV-Embed).
The ARC template of Appendix A.10 filled with the ARC example of Appendix A.9; one word per token for readability (a real tokenizer splits finer).
The figure at the top is the whole method (Figure 1, Algorithm 1). The one design choice it does not show is why the two passes have different weights: so the model can learn to produce and read bidirectional features differently, instead of pushing them through weights trained on causal ones (the ablations below test exactly this).
Fig. 2 runs it on this page's trained toy (a 3-block decoder with 4 heads, explained below), with the shipped seed-0 models computing every bar in your browser. The prompt is "<bos> Eve Max Ada Xan Ivy ? chess"; only Ada is in the chess club, and the toy learned each membership with the club named first. A glass plate is one pass's attention in block 1, averaged over the 4 heads: rows are the query tokens (back to front), columns the tokens they read, bar height the weight. Orange is causal and blue bidirectional, as in the paper's Figure 1.
Computed live by the toy in your browser (the same forward pass as Run Bitune, checked against PyTorch). Block evaluations are tokens × blocks per pass. Drag the figure to turn it.
Two sets of features per block (Eq. 1, 2): causal Kc = XcWkc, Vc = XcWvc, and bidirectional Kb = XbWkb, Vb = XbWvb. Xc and Xb are each pass's own input to the block: the token embeddings in the first block, then the previous block's output of the same pass. So the two passes run through the whole network side by side; they meet only in the cache. One consequence: in the first block the keys and values are projections of the token embeddings, computed before any attention, so the mask cannot change them there; bidirectional context first reaches the cache in the second block's keys and values (with separate adapters, the first block's still differ by the adapters). Attention is the usual softmax(QKT/√dk + M)V (Eq. 3) with Mc(i, j) = −∞ for future tokens and Mb = 0 everywhere (Eq. 4, 5).
pass_scale_k, pass_scale_v; repository). θinit = 0.01 (Table 9).Two details of Eq. 8 that the paper leaves implicit (the code initialises θ to θinit, in PassScale, variant 607): α starts at exactly 0.5, an even mix, whatever θinit is, and θinit sets only how fast α can move. Try it in the explorer beside this.
In the experiments the bidirectional pass has its own LoRA adapter on every linear layer of attention and MLP, not only on the key and value projections that Eqs. 1 and 2 name; training back-propagates the answer's loss through both caches into both adapters and the θs, three forward passes where standard instruction tuning needs one (§2, Limitations).
Which weights are separate. Eqs. 1 and 2 name only the key and value projections, but "the components of the model, other than the key and value projections, can have their own separate sets of weights as well" (§2), and in the experiments they do: the bidirectional pass runs with its own LoRA adapter on every linear layer of attention and MLP (the code's prefill adapter), the causal pass and the answer with the other (default). With full weights that would mean a second copy of the model, impractical for large models, so the default is LoRA (§2, Parameter Efficient Fine-tuning); full finetuning with two full weight sets is tested too (Table 7).
Training (Algorithm 2): the causal pass and the bidirectional pass over the instruction, the mix, then the answer through the causal weights over the mixed cache; the loss on the answer back-propagates through both caches into both adapters and the θs. Standard instruction tuning does this in one forward pass; Bitune's needs three (Limitations).
Starting generation. Decoding needs at least one query token after the cache. The paper moves the last token of the instruction template (the ":" of "Answer:") to the start of the answer, rather than adding a new learnable separator (§3.1). The mixing runs in 32-bit floating point while the rest is bfloat16, because "minor numerical inaccuracies in the learnable coefficients ... may lead to significant deviations in the model's behavior".
Several turns (Appendix A.8, not tested): either recompute the whole history's cache bidirectionally every round, or alternate: prefill each new instruction with both masks and append it, generate with causal features only, repeat.
AdamW, linear schedule, no weight decay, batch 10 (10 accumulation steps), 10% warmup; 3 epochs (3,000 updates) on UltraFeedback; seeds 42, 43, 44 (Tables 9 to 12).
Instruction tuning (Table 1). Over LoRA, the 5-task average rises by +4.0 points on Gemma-2B (and +9.3 over the pretrained model), +2.3 on Llama3-8B, +1.4 on Llama2-7B, +0.9 on Phi-2, and only +0.1 on Gemma-7B, the one model where every finetuning method lowered MMLU below the pretrained model's 59.0. Against the parameter-matched LoRA16 the gains are similar (+4.3, +1.8, +1.4, +1.0, +0.5): extra parameters alone do not explain them, because LoRA16 lands within half a point of LoRA on every model. Averages, with ±1 standard error from the three seeds:
Trained on each task (Table 2): smaller average gains (+1.4 Gemma-2B, +0.6 Llama3-8B and Phi-2, +0.1 Gemma-7B and Llama2-7B), and on SIQA Bitune trails the better of the two LoRA baselines on all five models. The consistent win is GSM8K, the one generative task: +2.8 (Gemma-2B), +3.0 (Llama3-8B), +0.9, +0.6, +0.3. Chain of thought (Table 3): +2.4 on Gemma-2B and +1.3 on Llama3-8B, ahead on every task, with the largest step on GSM8K (+3.4 and +3.2). Codestral-22B on GSM8K: 69.3 to 73.6, +4.3, "even for larger models, which already have strong performance" (Table 17; one task, one model). Alpaca: +3.4 and +1.0 (Table 16).
Other ways to update the weights (Table 6, Table 7): with DoRA +4.0 and +1.6, with IA3 +2.4 and +1.0 (Gemma-2B and Llama3-8B), and with full finetuning of two full weight sets on Gemma-2B 47.5 to 49.3 (+1.8). The paper writes "gains ranging from +1.6% to +4.0%"; recomputed from its own table, the range is +1.0 to +4.0 (checks).
From Table 1, Table 2 and the seed spreads in Tables 21 and 22 (the error bar of an average treats the 5 tasks as independent: an approximation). Per task, and against LoRA16 or the pretrained model: the tables tab.
Four variants, each answering one question (§3.5), on Gemma-2B and Llama3-8B:
It helps on UltraFeedback: 45.7 to 47.9 on Gemma-2B and 70.4 to 71.9 on Llama3-8B (Table 5). Every ablated variant beats LoRA. But it is not robust: on Alpaca, Naive Bidir. scores 66.9 against LoRA's 67.2 on Llama3-8B (Table 16), while Bitune stays ahead (68.2). The full method wins every comparison, but some by little:
The second pass's mask (Table 8): causal 46.9 / 71.1, anti-causal (each token sees only what follows it) 46.7 / 71.4, bidirectional 49.7 / 72.7 (Gemma-2B / Llama3-8B). "Combining causal and anti-causal features independently does not lead to the same high performance": each token has to see both sides in the same pass.
The mixing coefficient's start (Table 15): θinit 0.1, 0.01, 0.001 give 49.4, 49.7, 47.2 on Gemma-2B and 72.7, 72.7, 72.3 on Llama3-8B. Read from the vector data of Figures 2 and 3, the trained Llama3-8B ends at α ≈ 0.32 on average with θinit 0.01: about two thirds causal, one third bidirectional, every block between 0.06 and 0.55 (rebuilt). The trained model does not abandon its causal features; it adds some bidirectional ones.
The 5-task averages of Table 5, with ±1 standard deviation of the average from Table 23 (tasks treated as independent). Bitune's lead over the best ablation is 0.8 points (No Mixing, 1.6 standard errors) on Gemma-2B and 0.4 (Shared Weights, 1.5 standard errors) on Llama3-8B. The toy's panel (axis from 80%): the same variants on this page's toy task, mean ± SD of 3 seeds (Run Bitune).
Training (Table 14): 3.1 times the time (1.0 to 3.1 hours on Gemma-2B, 1.7 to 5.3 on Llama3-8B, one A100) and 16% to 33% more peak memory (14.9 to 19.8 GB, 26.6 to 30.8 GB). The implementation runs the two prompt passes one after the other and "has not been optimized".
Inference: the prompt is processed twice, so prefill does two passes' work; the cache that decoding reads is one mixed cache of the usual size, so decoding costs the same. Measured on Gemma-2B with a 2,000-token instruction (Table 4): prefill 0.03 s against 0.28 s, 9.3 times longer, then 2,000 generated tokens in about 62 s either way.
0.6% (62.18 s to 62.56 s). Generation is 31 ms per token, prefill well under a millisecond per token, so the prefill hardly counts, and the paper concludes the extra latency is "negligible". That holds for long answers. Move the sliders to a short answer after a long prompt (classification, retrieval-augmented question answering, a judge) and it stops holding:
Two more costs follow from the design, though the paper does not discuss them (beyond the paper; our reasoning): a bidirectional prompt cache cannot be shared between requests that start with the same text, because every token's keys and values now depend on what comes after it, so serving engines' prefix caching (vLLM's automatic prefix caching; how prefix caching works: Batching, KV cache and scheduling in depth) no longer applies to it; and LoRA can usually be merged into the base weights for free serving (PEFT), while Bitune needs two different weight sets at prefill time, so it keeps one adapter live or holds two merged copies.
Illustrative: a straight-line extension of the one measurement in Table 4 (Gemma-2B, one A100; 0.015 ms per prompt token for LoRA, 0.14 for Bitune, 31.1 ms per generated token, assumed the same for both; measured, Bitune's 2,000 tokens took 62.28 s against 62.15 s). Real prefill cost grows faster than linearly at long context, so long prompts are, if anything, underestimated. Measured, in the v1 paper's appendix: a 200-token prompt with a 50-token answer took 11.5% longer on Gemma-2B and 14.2% on Llama3-8B; a 50-token prompt with a 200-token answer 6.5% and 1.5% (v1 Appendix 6.4; all cost tables).
The paper reports benchmark averages; it does not show when bidirectional prompt features should matter. This page's toy is built to make that visible (Run Bitune has all of it). 48 people and 32 clubs, with a fixed random membership table. A tiny decoder (3 blocks, width 32, 4 heads, 41,472 parameters) is pretrained causally on two kinds of text: facts stated club first ("chess Ada yes"), and questions asked before the list ("? chess Ada Ben Cy : Ben"). Then it is instruction-tuned, with rank-4 LoRA on every linear layer, on a new template that asks the question after the list, the way a document followed by a question does:
What holds up. Every number is the mean of three seeds, and the appendix prints their standard deviations, which most finetuning papers do not (Tables 21 to 25). Against LoRA, 14 of the 25 task-level gains in Table 1 are more than 2 standard errors, and the 5-task average gains are 2.99 to 7.6 standard errors on four of five models (the tasks treated as independent; gains with noise). The baselines are fair or better than fair: LoRA16 matches the parameter count, and the learning rate was tuned for LoRA and reused for Bitune, a disadvantage the authors state. The direction repeats across five models, three settings (instruction tuning, per-task, chain of thought), three PEFT methods, full finetuning, a second dataset and a 22B model. The authors state the training cost themselves (Limitations, Table 14), which counts in their favour.
What is weaker, concretely:
Verdict. Believe the direction: reading the prompt bidirectionally, with separate weights, makes instruction-tuned decoders measurably better on short-prompt reasoning and multiple-choice tasks, and the evidence is better controlled than most finetuning papers'. Treat the size as model-dependent and mostly a small-model effect in these experiments, the necessity of every component as unproven, and "negligible" cost as true only when the answer is much longer than the prompt.
The useful idea is smaller than "bidirectional attention is back": the causal mask over the prompt is a legacy of the generation objective, not a requirement of it, and its cost is measurable after pretraining. Prefix LMs made the same observation years earlier, as a pretraining choice (Families and objectives owns them). Bitune's contribution is doing it to an already-pretrained decoder without retraining it, and showing that the bidirectional features need their own weights and a mix with the causal ones: simply converting to a prefix-LM ("Naive Bidir.") gains less and, on Alpaca, can hurt.
The same diagnosis drives a line of work that repurposes decoders: echo embeddings repeat the input so the second copy sees all of the first, with no training (Springer et al. 2024); LLM2Vec and NV-Embed switch the mask off to make embedding models; Encoder-Decoder Gemma adapts a pretrained decoder into a bidirectional encoder plus a causal decoder (Zhang et al. 2025; KB page). Caveats: the gains are consistent in direction but not transformational; the two-pass design doubles prompt-processing work, a real cost at long context, while the paper's setting is short instructions. Read it for the diagnosis more than the recipe.
A real model, trained offline with PyTorch and running here in plain JavaScript (the same arithmetic, checked against PyTorch: ). It is built to answer one question the paper's benchmarks cannot: when does reading the prompt bidirectionally matter? Everything below is computed in your browser unless it says "from training".
Green: the member; orange: other listed people; grey: anyone not in the list. The probability each finetuned model (seed 0, 6-bit weights) gives each listed person as the answer, computed live. "Question first" is plain LoRA trained and asked with the question before the list: the format the pretrained model already knows.
Rows are query tokens, columns the tokens they read; darker is more attention. The answer row is the ":" token reading the cache (mixed, for the two-pass models). The mixing chart shows the learned α = |θ| / (0.01 + |θ|) of each block for keys and values, against the paper's Llama3-8B (its Figure 3 averages, decoded).
The accuracy axis starts at 80%. From training (train.py, model/results.json, model/finetune.log): held-out accuracy every 250 steps on 500 prompts, as logged, for the 3 seeds; the dots above are the final 2,000-prompt test of each seed.
Fresh prompts drawn uniformly (club, list length, people, member's place) from your browser's random generator, answered by the shipped seed-0 model. Its PyTorch test on 2,000 prompts is shown beside it.
Every table that carries the argument, transcribed from the arXiv v2 HTML with the printed precision kept (extract_tables.py, mk_tables.py), and every derived number recomputed in recompute.py. Where the appendix gives the three seeds' standard deviations (Tables 21 to 25), the explorer shows them and the difference to LoRA in standard errors.
Bitune minus the chosen baseline, in points, per task and on the 5-task average (Table 1). Error bars: ±1 standard error of the difference from the three seeds' standard deviations in Table 21 (√(s1²/3 + s0²/3)); for the average the tasks are treated as independent, which is an approximation (the paper prints no per-seed averages). The pretrained model is one deterministic evaluation, so against it the bars carry Bitune's spread only.
Every "recomputed" value comes from the tables as printed (recompute.py). The printed averages all match the mean of their printed task scores to within 0.06 points (rounding).
Table 4 (v2: Gemma-2B, a 2,000-token instruction and 2,000 generated tokens, one A100), Table 14 (training on the instruction-tuning setup, 3,000 updates of 10 accumulated steps, one A100), and the inference table of v1's Appendix 6.4 (v1: averaged over 10 runs, prompt:answer lengths in tokens), which v2 dropped.
Appendix A.13 prints Llama3-8B's answers (instruction-tuned on UltraFeedback) to the first 20 GSM8K test questions without grading them. Graded here against the GSM8K reference answers, using the final number each response states.
Every link opens in a new tab. Reading time of the resources below: 3h 55m.
EMNLP 2025 (main, pages 9510 to 9536), the paper itself; the HTML version has the anchors this page links to. abstract page, PDF.
(40 min)
the authors' research code (README and passes.py, about 20 minutes): enough to reproduce the paper, by its own README; no licence file, and the promised clean release has not appeared (checked 3 October 2026).
(20 min)
Kopiczko, Blankevoort, Asano: the authors' one-page summary with the overview figure.
(5 min)
BehnamGhader et al., 2024: the same diagnosis applied to embeddings: switch on bidirectional attention in a decoder, then teach it to use it with masked next-token prediction.
(40 min)
Springer et al., 2024: the zero-training way around the causal mask: repeat the input so the second copy sees the whole first one.
(30 min)
Zhang et al., Google, 2025: adapts a pretrained decoder-only model into an encoder-decoder: a bidirectional encoder over the input, a causal decoder for the output.
(40 min)
Dong et al., 2019: one Transformer, three attention masks (left-to-right, bidirectional, prefix sequence-to-sequence); the clearest picture of masks as the only difference.
(30 min)
Jay Alammar: the causal (masked) self-attention this paper partly removes, drawn step by step.
(30 min)
2018: bidirectional attention over the whole input; the encoder half of what Bitune adds back.
2019: compared encoder-decoder, prefix-LM and decoder-only under one budget; the prefix-LM Bitune is compared with.
2021: the low-rank adapters Bitune uses for both of its passes, and its main baseline.
2025: a pretrained decoder turned into a bidirectional encoder plus causal decoder; the heavier version of the same idea.
adjacent in the same batch: trainable cross-attention attached to frozen pretrained models.
adjacent in the same batch: trainable memory attached to a frozen model rather than retraining it.
2017: the masked decoder self-attention whose mask Bitune lifts over the prompt.
2022: instruction tuning, the setting Bitune is built for.
decoder-only models, attention masking and prefix-LM variants.
instruction tuning and parameter-efficient finetuning.
what attention looks like in current open decoder-only models.
This page is one row of the Papers database; its properties (Paper, Takeaway, Topics, Year) live there.