            Large Language Models Can Perform Tasks Without Instruction via Selective Attention Head Masking



A. Models & Datasets

                                                                      Table 9. LLMs used in this paper. We mainly report their attention

In this section, we introduce the models and datasets used            layer configurations.

in our experiments. Models are selected from various open-            Model name                 Notation           Params   Layers   Heads   KV heads   Total heads

sourced LLMs, as listed in Table 9. For translation tasks, we         Llama-3.1-8B-Instruct      Llama3.18B-inst     8.03B    32        32       8          1024

                                                                      Llama-3.1-8B               Llama3.18B          8.03B    32        32       8          1024

use XNLI (Conneau et al., 2018) for training and main eval-           Qwen2.5-0.5B-Instruct      Qwen2.50.5B-inst    494M     24        14        2          336

                                                                      Qwen2.5-1.5B-Instruct      Qwen2.51.5B-inst    1.54B    28        12       2          336

uation, and IWSLT2017 (Cettolo et al., 2017) for additional           Qwen2.5-3B-Instruct        Qwen2.53B-inst      3.09B    36        16       2          576

evaluation in Section 5. XNLI contains 10000 samples for              Qwen2.5-7B-Instruct        Qwen2.57B-inst      7.62B    28        28       4          784

                                                                      Qwen2.5-7B                 Qwen2.57B           7.62B    28        28       4          784

each language pair, and we use 100 samples for evaluation             Qwen2.5-14B-Instruct       Qwen2.514B-inst     14.8B    48        40       8          1920

                                                                      Phi-3.5-mini-instruct      Phi3.5mini-inst     3.82B    32        32       32         1024

and the remaining 9900 for mask training. IWSLT2017                   Mistral-7B-Instruct-v0.3   Mistral7B-inst      7.25B    32        32       8          1024

contains 8549 samples for English-Chinese pair, 8597 sam-

ples for English-French pair, and 8079 samples for English-

German pair. We use all the samples for the evaluation                        alongside the context, which leads to lower ROUGE-L

reported in Table 8. For simple tasks, we choose 35 datasets                  scores. On the other hand, the translation results of

in the Function Vector work by Todd et al. (2024). In each                    masked models are more concentrated on the task and

task, we choose out 100 samples for evaluation, and the                       context words, so the w/ M scores of Qwen2.514B-inst

remaining samples are used for the fixed-step mask training.                  increase significantly compared to the w/ instruction

The details of these datasets and our instruction prompts                     scores (Table 29). This implies that attention heads

(for w/ instruction evaluations) are listed in Table 10.                      could influence the response style of the model. We

                                                                              provide a translation example in Table 36.

B. Experimental Details                                                   • For some small models, attention head mask M may

                                                                            fail on translations to relatively low-resource languages

All experiments are conducted on a NVIDIA A800 80GB                         (e.g., translating to Arabic using models smaller than

GPU. We summarize the hyper-parameters used in the mask                     Qwen2.53B-inst ). Theoretically, if a model has more

training in Table 11. In particular, for memory reasons, the                attention heads, then it can form more functional path-

batch size on translation tasks of Qwen2.514B-inst is set to                ways through their combinations. We suggest that this

8 and its training steps are 12370. Other hyper-parameters                  phenomenon of attention heads exhibiting functionality

remain the same. For the evaluation of simple tasks, we                     is better applicable to larger LLMs.

generate 10 new tokens and check whether the response                     • We also test the attention head mask on Gemma 2

contains the correct answer, in case the instruct models may                series (Team, 2024a). While on Gemma29B-inst the

generate some leading words (like “the answer is:”). But                    masked model can also directly elicit the functional-

for some tasks like capitalizing letters and extracting items,              ity, the masked model on Gemma22B-inst fails on all

we only check whether the response starts with the correct                  the translation pairs. We would ascribe this to the

answer. You may check more implementation details in our                    number of attention heads in the model (208 heads

public code repository.                                                     in total, 26 layers and 8 heads for each). Although

                                                                            the model has more parameters than Qwen2.50.5B-inst

C. More Experiment Results                                                  and Qwen2.50.5B-inst , the lack of sufficient granularity

                                                                            prevents it from acquiring a combination of attention

In this section, we provide more experiment results to sup-                 heads that can directly elicit functionalities.

port the findings in the main text.

                                                                      For the attention head masks in pre-trained models, we also

C.1. Full Evaluation Results on All Models                            provide full results (Table 37, 38) as complementary to the

As complementary to the results in Section 3, we provide the          examples in Table 5. Specifically, we calculate the math

full evaluation results on all models in Table 12-35 (transla-        expectation of Jaccard similarity on two randomly shuffled

tion PPL Table 12-21, translation ROUGE-L Table 22-31,                masks (“Random” column) as follows:

simple task accuracy Table 32-35). From these complete                                                              E [|M1 ∩ M2 |]

results, we also find some other phenomena:                           E [Jaccard(M1 , M2 )] =

                                                                                                                    E [|M1 ∪ M2 |]



   • Qwen2.514B-inst does not give the dominant ROUGE-                                                                             |1| |M 1 | |M2 |

                                                                                                                                        |1|    |1|

                                                                                                             =

     L performance in the instructed translation task, al-                                                          E [|M1 | + |M2 | − |M1 ∩ M2 |]

     though it is the largest model in our experiments. We                                                             |M1 ||M2 |

                                                                                                                         |1|

     examine the translation outputs of Qwen2.514B-inst and                                                  =

     Qwen2.57B-inst , finding that the 14B model tends to

                                                                                                                                   ||M2 |

                                                                                                               |M1 | + |M2 | − |M1|1|

     generate more explanation words than the 7B model                                                                                                         (4)



                                                                 12

