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





Table 39. Case study of failed translations in the query-head re-        Table 40. XNLI translation perplexity (PPL) on Llama3.18B-inst

moval scenario.                                                          when taking FFN layers (32 in total) in the mask. Translation pairs

                                                                         with yellow background use 31 FFN layers in M, others use all

 Case 1: Fail to translate                                               32 FFN layers. Attention heads are also selected in M.

 Input       Lots of people from England speak more than                          To

             one language.                                                              en      zh      fr      es      de      ru      ar

                                                                         From

 Output      Many people from England speak more than                        en          −     1.700   1.130   1.221   1.330   1.915   1.869

             one language.                                                   zh        1.990     −     1.537   1.701   4.143   1.828   2.523

                                                                             fr        1.698   1.934     −     1.437   1.543   1.936   2.042

 Case 2: Low quality translation

                                                                             es        1.509   1.970   1.283     −     1.479   1.868   2.315

 Input       Niceness is not solely owned by Western tra-                    de        3.650   4.709   1.359   1.531     −     2.026   5.121

             dition.                                                         ru        2.047   2.077   1.469   3.915   4.315     −     2.494

                                                                             ar        2.201   2.211   1.643   4.488   5.089   1.949     −

 Output      西方传统并不是唯一的好客。(Western tra-

             dition is not solely hospitable.)

                                                                         We take ml in each layer into the whole mask M, train it

 Case 3: Mix with other languages                                        together with attention heads on Llama3.18B-inst for XNLI

 Input       Due to our population, there are few virgin                 translation tasks, and results are shown in Table 40. After

             forests still left in the United States.                    training, most translation tasks still use all the FFN layers.

 Output      En realidad, debido a nuestra población, to-                Only 8 tasks remove only one FFN layer in M, and their

             davía quedan pocos bosques virgenes en los                  performance severely degrade compared to the head-only

             Estados Unidos.                                             mask in Table 12. Since taking FFN into the mask does not

                                                                         contribute to the study of model functionality, and the model

 Input       Japan and Sweden are members of the Auld                    itself tends to utilize all FFN layers, we do not remove the

             Alliance.                                                   FFN layers in the main experiments.

 Output      日本とスウェ デンはオ ル アライアンス

             のメンバです。                                                     C.4. A Probe of Layer Outputs

                                                                         For Figure 4, we provide a probing example of layer out-

From these cases, we discover an interesting phenomenon

                                                                         put logits in the vocabulary space in Table 41. We prompt

that the model may occasionally output translations in other

                                                                         Llama3.18B-inst with “I see a llama sleeping in my back-

languages (Spanish and Japanese in Case 3), even though

                                                                         yard.”, and check the layer outputs in different settings.

it has never encountered these languages during the mask

                                                                         From the table, we can observe that model outputs w/ in-

training. This suggests that merely unifying the distribution

                                                                         struction and w/ M exhibit a high degree of overlap in the

of attention scores is insufficient for the model to accurately

                                                                         top-5 tokens in the latter layers of the model (Layer 22–30),

elicit the corresponding functionality. In addition, Section

                                                                         reflecting the similarity in information flow when execut-

C.2 mentions that the functionality of attention heads is not

                                                                         ing the functionality. At the output layer (Layer 31), the

likely to be concentrated in the KV heads. Combined with

                                                                         masked model produces translations in the target language,

the results of query-head removal, we infer that the func-

                                                                         as well as semantically aligns other top tokens with the in-

tionality of attention heads is more likely to be distributed

                                                                         put text. This also demonstrates the semantic preservation

in the output projection matrix WO , which may serve as a

                                                                         characteristic of the translation task.

role similar to the FFN layer in the model.



C.3.3. FFN L AYER R EMOVAL                                               C.5. IWSLT2017 Evaluation Examples



This section mainly explains that removing FFN layers is not             In Section 5, we evaluate the BLEU scores of the model

necessary for triggering functionalities. In our experiments,            with α-scaled M on the IWSLT2017 translation dataset.

we only apply the mask M on the attention heads, but the                 Considering the style difference between the models shown

mask can also be applied to FFN layers by removing their                 in Table 36, in the evaluation, we clean up the generated

contributions to the residual stream. Similar to Equation (2),           outputs so that they contain no explanation words or punctu-

for the input X at the decoder layer l, if we use a binary               ation marks. Therefore, the BLEU scores reported in Table

mask ml ∈ {0, 1} to indicate whether the FFN layer is                    8 are more reliable in reflecting the translation quality of

selected in the model, then the decoder layer output can be              the model. We provide some examples of the model outputs

written as:                                                              in Table 42. Overall, whether the instructed model includes

                                                                         scaled M does not make too much difference in the gener-

Decoderl (X) = X+MHA(X)+ml FFN (X + MHA(X)) .                            ated sentences. However, the model w/ scaled M generally

                                        (5)                              provides responses that better align with the labels.



                                                                    24

