Paper deep dive
Locating and Editing Factual Associations in Mamba
Arnab Sen Sharma, David Atkinson, David Bau
Models: Mamba
Intelligence
Status: succeeded | Model: google/gemini-3.1-flash-lite-preview | Prompt: intel-v1 | Confidence: 94%
Last extracted: 3/12/2026, 7:26:33 PM
Summary
This paper investigates factual recall mechanisms in the Mamba state space model by adapting interpretability techniques originally developed for autoregressive transformer language models. The authors demonstrate that Mamba exhibits localized factual recall patterns similar to transformers, despite architectural differences, and successfully apply causal tracing, rank-one model editing, and information flow analysis to Mamba-2.8b.
Entities (6)
Relation Signals (3)
Causal Tracing â appliedto â Mamba
confidence 100% ¡ First, we apply causal tracing or interchange interventions to localize key components inside Mamba
Mamba-2.8b â comparedto â Pythia-2.8b
confidence 100% ¡ We compare Mamba directly to a similar-sized autoregressive transformer LM
Mamba â exhibitssimilarfactualrecallto â Transformer
confidence 90% ¡ we conclude that despite significant differences in architectural approach, when it comes to factual recall, the two architectures share many similarities.
Cypher Suggestions (0)
No Cypher suggestions yet.
Abstract
Abstract:We investigate the mechanisms of factual recall in the Mamba state space model. Our work is inspired by previous findings in autoregressive transformer language models suggesting that their knowledge recall is localized to particular modules at specific token locations; we therefore ask whether factual recall in Mamba can be similarly localized. To investigate this, we conduct four lines of experiments on Mamba. First, we apply causal tracing or interchange interventions to localize key components inside Mamba that are responsible for recalling facts, revealing that specific components within middle layers show strong causal effects at the last token of the subject, while the causal effect of intervening on later layers is most pronounced at the last token of the prompt, matching previous findings on autoregressive transformers. Second, we show that rank-one model editing methods can successfully insert facts at specific locations, again resembling findings on transformer LMs. Third, we examine the linearity of Mamba's representations of factual relations. Finally we adapt attention-knockout techniques to Mamba in order to dissect information flow during factual recall. We compare Mamba directly to a similar-sized autoregressive transformer LM and conclude that despite significant differences in architectural approach, when it comes to factual recall, the two architectures share many similarities.
Tags
Links
- Source: https://arxiv.org/abs/2404.03646
- Canonical: https://arxiv.org/abs/2404.03646
- Code: https://github.com/arnab-api/romba
Trouble viewing inline? Open PDF directly â
Full Text
99,014 characters extracted from source content.
Expand or collapse full text
Locating and Editing Factual Associations in Mamba Arnab Sen Sharma, David Atkinson, and David Bau Khoury College of Computer Sciences, Northeastern University Correspondence to sensharma.a@northeastern.edu, Code available at romba.baulab.info Abstract We investigate the mechanisms of factual recall in the Mamba state space model. Our work is inspired by previous findings in autoregressive transformer language models suggesting that their knowledge recall is localized to particular modules at specific token locations; we therefore ask whether factual recall in Mamba can be similarly localized. To investigate this, we conduct four lines of experiments on Mamba. First, we apply causal tracing or interchange interventions to localize key components inside Mamba that are responsible for recalling facts, revealing that specific components within middle layers show strong causal effects at the last token of the subject, while the causal effect of intervening on later layers is most pronounced at the last token of the prompt, matching previous findings on autoregressive transformers. Second, we show that rank-one model editing methods can successfully insert facts at specific locations, again resembling findings on transformer LMs. Third, we examine the linearity of Mambaâs representations of factual relations. Finally we adapt attention-knockout techniques to Mamba in order to dissect information flow during factual recall. We compare Mamba directly to a similar-sized autoregressive transformer LM and conclude that despite significant differences in architectural approach, when it comes to factual recall, the two architectures share many similarities. 1 Introduction Studies of autoregressive transformer language modelsâ (LMs) processing of factual statements such as The Eiffel Tower is located in Paris, have identified a localized pattern of internal computations when recalling facts (Meng et al., 2022a; b; Geva et al., 2023; Hernandez et al., 2023; Nanda et al., 2023), and have further found that those LMs can be edited by making single-layer rank-one changes in model parameters to alter a specific fact. Although these localized phenomena appear to generalize across autoregressive transformer LMs, the extent to which similar locality might appear in very different architecturesâsuch as recurrent networks (RNNs)âhas not yet been investigated. In this paper we investigate the internal mechanisms of Mamba (Gu & Dao, 2023), a recently-proposed state-space language model, a type of RNN that achieves per-parameter performance that is competitive with transformers. Specifically, we ask whether factual recall within Mamba exhibits locality similar to the patterns observed in autoregressive transformer language models. Our paper is a case study confronting a key methodological challenge that broadly faces interpretability researchers: as state-of-the-art neural network architectures evolve, we must ask, can the detailed analytical methods and tools developed for one neural architecture, such as transformer LMs, be generalized and applied to a different neural architecture, such as Mamba? In this paper we are able to answer the question with a qualified âyesâ: we find that many of the methods used to analyze transformers can also provide insights on Mamba. We also discuss mismatchesâthat is, interpretation methods (such as path-dependent attention patching) that do not transfer to Mamba as easily due to architectural constraints. We begin by studying whether activation patching (Wang et al., 2022) can be successfully applied to Mamba. Known variously as causal mediation analysis (Vig et al., 2020), causal tracing (Meng et al., 2022a), and interchange interventions (Geiger et al., 2021), activation patching techniques can successfully identify specific model components in transformer LMs that play crucial roles in performing a task. We ask whether Mamba can be productively studied the same way, even though the architectural components of Mamba are very different: for example, instead of attention heads and MLP modules, Mamba is composed of convolutions, gates, and state-space modules. To answer, we adapt activation patching to Mamba, and ask if any sparsity patterns emerge which provide insights into the respective roles of its components. We also study whether rank-one model editing can be applied to Mamba. While studies of transformers (Meng et al., 2022a; b; Hase et al., 2024) have found that there are a range of MLP modules within which factual knowledge can be inserted by making a single rank-one change in parameters, Mamba does not have MLP modules, so we ask if there are any other modules that can be similarly edited to insert knowledge. As with previous studies of transformers, the key question is whether factual associations can be edited with both specificity (without interfering with unrelated facts) and generalization (while remaining robust to rewordings of the edited fact). Finally, we apply methods for understanding the overall information flows in Mamba. Inspired by the findings of Hernandez et al. (2023), we measure the linearity of the relations between subject and object embeddings. And inspired by Geva et al. (2023), we examine information flow by adapting attention-blocking methods to the attention-free Mamba architecture. In this work we conduct our experiments on Mamba-2.8b, the largest available LM in Mamba family, and for comparison we conduct the same experiments on the similarly sized Pythia-2.8b (Biderman et al., 2023) autoregressive transformer LM. 2 Background on Mamba Mamba, introduced in Gu & Dao (2023), is a recent family of language models based on state space models (SSMs). SSMs are designed to model the evolution of a hidden state across time with a first-order differential equation (Koopman et al., 1999; Durbin & Koopman, 2012), and when they are used as the recurrent state of an RNN, they can enable highly efficient parallelized training (Gu et al., 2021). To achieve good performance in language modeling, the Mamba SSM introduces input-dependent parameterization or selective-SSM instead of the traditional time-invariant SSMs. Mamba uses a special architecture called MambaBlock111In their paper, Gu & Dao (2023) call this component Mambaâthe same name as the LM family., which is stacked homogeneously, replacing both attention and MLP blocks used in transformer layers. Here, we focus on the different operations performed inside a MambaBlock. Figure 1: Architecture of a MambaBlock. Projection matrices WaâsuperscriptsubscriptWâW_a Waroman_â and WgâsuperscriptsubscriptWâW_g Wgroman_â have the shape 2â˘dĂd22dĂ d2 d Ă d, while WoâsuperscriptsubscriptWâW_o Woroman_â has the shape dĂ2â˘d2dĂ 2d Ă 2 d. h,a,g,s,andâ˘oâandh,a,g,s,\;and\;oh , a , g , s , and o are intermediate states of a token representation. Ď is SiLU activation and âtensor-product â is elementwise multiplication. Conv + SSM operation abstracts the Conv1D and selective-SSM operations. Formally, Mamba is an autoregressive language model: M:â:âM:X : X â Y over a vocabulary VV that maps a sequence of tokens x=[x1,x2,âŚ,xT]â,xiâformulae-sequencesubscript1subscript2âŚsubscriptsubscriptx=[x_1,x_2,âŚ,x_T] ,\;x_i = [ x1 , x2 , ⌠, xitalic_T ] â X , xitalic_i â V to yâââ||superscriptây ^|V|y â Y â blackboard_R| V | which is a probability distribution over the next token continuations of x. Similar to other deep LMs, in Mamba, a token xisubscriptx_ixitalic_i is first embedded to a hidden state of size d as hi(0)=eâ˘mâ˘bâ˘(xi)superscriptsubscriptâ0subscripth_i^(0)=emb(x_i)hitalic_i( 0 ) = e m b ( xitalic_i ). Then hi(0)superscriptsubscriptâ0h_i^(0)hitalic_i( 0 ) is transformed sequentially by a series of MambaBlocks. The hidden state hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) after the âtâ˘hsuperscriptââ ^thâitalic_t h (1-indexed) MambaBlock is computed as follows: hi(â)=hi(ââ1)+oi(â)superscriptsubscriptââsuperscriptsubscriptââ1superscriptsubscriptâ h_i^( )=h_i^( -1)+o_i^( )hitalic_i( â ) = hitalic_i( â - 1 ) + oitalic_i( â ) (1) where oi(â)superscriptsubscriptâo_i^( )oitalic_i( â ) is the output of âtâ˘hsuperscriptââ ^thâitalic_t h MambaBlock for the itâ˘hsuperscriptâi^thiitalic_t h token oi(â)superscriptsubscriptâ o_i^( )oitalic_i( â ) =MambaBlock(â)â˘(h1(ââ1),h2(ââ1),âŚ,hi(ââ1))=Wo(â)â˘(si(â)âgi(â))absentsuperscriptMambaBlockâsuperscriptsubscriptâ1â1superscriptsubscriptâ2â1âŚsuperscriptsubscriptââ1superscriptsubscriptWâtensor-productsuperscriptsubscriptâsuperscriptsubscriptâ =MambaBlock^( ) (h_1^( -1),h_2^( -1% ),âŚ,h_i^( -1) )=W_o^( )\, (s_i^( )% g_i^( ) )= MambaBlock( â ) ( h1( â - 1 ) , h2( â - 1 ) , ⌠, hitalic_i( â - 1 ) ) = Wo( â ) ( sitalic_i( â ) â gitalic_i( â ) ) (2) Here, âtensor-product â represents element-wise multiplication or Hadamard product. si(â)superscriptsubscriptâs_i^( )sitalic_i( â ) is calculated as: ai(â)superscriptsubscriptâ a_i^( )aitalic_i( â ) =Wa(â)â˘hi(â)absentsuperscriptsubscriptWâsuperscriptsubscriptââ =W_a^( )h_i^( )= Wa( â ) hitalic_i( â ) (3) c1(â),c2(â),âŚ,ci(â)superscriptsubscript1âsuperscriptsubscript2ââŚsuperscriptsubscriptâ c_1^( ),c_2^( ),âŚ,c_i^( )c1( â ) , c2( â ) , ⌠, citalic_i( â ) =SiLUâ˘(Conv1Dâ˘(a1(â),a2(â),âŚ,ai(â)))absentSiLUConv1Dsuperscriptsubscript1âsuperscriptsubscript2ââŚsuperscriptsubscriptâ =SiLU (Conv1D (a_1^( ),a_2^(% ),âŚ,a_i^( ) ) )= SiLU ( Conv1D ( a1( â ) , a2( â ) , ⌠, aitalic_i( â ) ) ) (4) si(â)superscriptsubscriptâ s_i^( )sitalic_i( â ) =selective-SSMâ˘(c1(â),c2(â),âŚ,ci(â))absentselective-SSMsuperscriptsubscript1âsuperscriptsubscript2ââŚsuperscriptsubscriptâ =selective-SSM (c_1^( ),c_2^( ),âŚ% ,c_i^( ) )= selective -SSM ( c1( â ) , c2( â ) , ⌠, citalic_i( â ) ) (5) We abstract the operations in Equations 4 and 5 as the Conv + SSM operation in Figure 1. At a high level, Conv + SSM brings information from the past token representations to the current token representation. The purpose is similar to the attention blocks in transformer LMs. But, unlike attention operation, Conv + SSM scales linearly with the context length and thereby enjoys faster inference speed and longer context limits. See Gu & Dao (2023) for details. The output of the other path gi(â)superscriptsubscriptâg_i^( )gitalic_i( â ) (that does not pass through Conv + SSM operation) is a gating mechanism that regulates the information flow. This gating mechanism resemble parts of LSTM (Hochreiter & Schmidhuber, 1997) and GRU (Cho et al., 2014) networks, where similar gates control selective updates of recurrent state. gi(â)=SiLUâ˘(Wg(â)â˘hi(ââ1))superscriptsubscriptâSiLUsuperscriptsubscriptWâsuperscriptsubscriptââ1 g_i^( )=SiLU (W_g^( )h_i^(% -1) )gitalic_i( â ) = SiLU ( Wg( â ) hitalic_i( â - 1 ) ) (6) In the remainder of the paper, we aim to characterize the role of the components of Mamba in factual recall by adapting tools that have previously been used to analyze transformers. In Section 3, we apply activation patching to localize factual recall as in Meng et al. (2022a), testing the roles of states sisubscripts_isitalic_i, gisubscriptg_igitalic_i, and oisubscripto_ioitalic_i at all layers. In Section 4, following Meng et al. (2022a); Hase et al. (2024), we test rank-one edits of facts across components WasubscriptWW_aWa, WgsubscriptWW_gWg, and WosubscriptWW_oWo at each layer. In Section 5, we collect Jacobians within Mamba to test the linearity of relational encodings as done by Hernandez et al. (2023). And in Section 6 we address the challenge of applying attention patching in Mamba, as used in Geva et al. (2023) to isolate information flow in GPT LMs. 3 Locating Key States for Factual Recall (a) Activation patching (b) Tracing the residual states, hi(l)superscriptsubscriptâh_i^(l)hitalic_i( l ) Figure 2: (a) Activation patching. A state from the clean run G is patched into its corresponding position in the corrupted run GâsuperscriptG^*Gâ. This has a downstream effect of potentially changing all the states that depend on the patched state in Gâ[âhi(â)]annotatedsuperscriptdelimited-[]âabsentsuperscriptsubscriptââG^*[â h_i^( )]Gâ [ â hitalic_i( â ) ]. (b) Average indirect effect of applying causal tracing on residual stream states (hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) in Figure 1) across 400 different facts from the Relations dataset (see Section A.2). We begin with activation patching, seeking to understand if there are specific hidden states which play important roles during factual recall. We select a fact (s,r,o)(s,r,o)( s , r , o ) that the LM knows, where r is a relation that associates a subject entity s with an object entity o. To estimate each stateâs contribution towards a correct factual prediction (s=Michael Jordan,r=professionally played,o=basketball)formulae-sequenceMichael Jordanformulae-sequenceprofessionally playedbasketball(s=Michael Jordan,\ r=professionally played,\ o=% basketball)( s = Michael Jordan , r = professionally played , o = basketball ), we collect model activations across three different runs: clean run G: In the clean run, we simply run the model on a prompt specifying the fact we are interested in. For example, x=(s,r)=Michael Jordan professionally playedMichael Jordan professionally playedx=(s,r)=Michael Jordan professionally playedx = ( s , r ) = Michael Jordan professionally played. We cache all the hidden states during the clean run to be used later: hi(â),ai(â),si(â),gi(â)|iâ[1,T],ââ[1,L]conditional-setsuperscriptsubscriptââsuperscriptsubscriptâsuperscriptsubscriptâsuperscriptsubscriptâformulae-sequence1â1 \h_i^( ),a_i^( ),s_i^( ),g_i^( )|\;iâ[1,T% ],\; â[1,L] \ hitalic_i( â ) , aitalic_i( â ) , sitalic_i( â ) , gitalic_i( â ) | i â [ 1 , T ] , â â [ 1 , L ] . corrupted run GâsuperscriptG^*Gâ: In the corrupted run, we swap s with a different subject sââ˘(PelĂŠ)superscriptPelĂŠs^*(Pel\'e)sâ ( PelĂŠ ) such that the LM gives a different answer oââ˘(soccer)superscriptsoccero^*(soccer)oâ ( soccer ) to the modified prompt xâ=(sâ,r)superscriptsuperscriptx^*=(s^*,r)xâ = ( sâ , r ) (i.e., oââ osuperscripto^*â oâ â o). This subject-swapping approach follows the recommendation of Zhang & Nanda (2023) and has the advantage of using natural text perturbations to avoid introducing out-of-domain states to the modelâs computation, as may happen when corrupting s embeddings with Gaussian noise (the method used in Meng et al. (2022a)). patched run Gâ[âhi(â)]annotatedsuperscriptdelimited-[]âabsentsuperscriptsubscriptââG^*[â h_i^( )]Gâ [ â hitalic_i( â ) ]: In the patched run, we run the model on the corrupted prompt xâsuperscriptx^*xâ, but intervene on hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) by replacing its value with the corresponding state cached from the clean run G. The remainder of the computation is run normally, meaning that the patched state can have a downstream effect of potentially changing all the states that depend on it. See Figure 2(a). Let pâ˘(o)p(o)p ( o ), pââ˘(o)superscriptp^*(o)pâ ( o ), and pâ[âhi(â)](o)p^*[â h_i^( )](o)pâ [ â hitalic_i( â ) ] ( o ) denote the probability assigned to the correct answer o in G, GâsuperscriptG^*Gâ, and Gâ[âhi(â)]annotatedsuperscriptdelimited-[]âabsentsuperscriptsubscriptââG^*[â h_i^( )]Gâ [ â hitalic_i( â ) ] respectively. To measure the contribution of hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) in recalling the fact (s,r,o)(s,r,o)( s , r , o ), we define its indirect effect (IE) as: IEhi(â)=pâ[âhi(â)](o)âpâ(o)pâ˘(o)âpââ˘(o) _h_i^( )= p^*[â h_i^( )% ](o)-p^*(o)p(o)-p^*(o)IEh start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT = divide start_ARG pâ [ â hitalic_i( â ) ] ( o ) - pâ ( o ) end_ARG start_ARG p ( o ) - pâ ( o ) end_ARG (7) In Figure 2(b) we plot the average indirect effect of restoring the residual states hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) across different layer-token positions over 400 facts from the Relations dataset (Hernandez et al., 2023). The high IE observed at the late site (later layers at the last token) position is natural, as restoring a clean hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) there will restore most of the model computation from G. However, Mamba also shows high causality at the early site (early-middle layers at the last subject token position). This is consistent with what Meng et al. (2022a) observed in the GPT family of language models. Figure 3: Average indirect effect of different states oi(â)superscriptsubscriptâo_i^( )oitalic_i( â ), gi(â)superscriptsubscriptâg_i^( )gitalic_i( â ), and si(â)superscriptsubscriptâs_i^( )sitalic_i( â ) over 400 facts from the Relations dataset (see Section A.2). For each layer â â, states for a window of 10 layers around â â are restored from the clean run G. Figure 4: To probe for path-specific effects, (a) hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) is restored from the clean run G as in Figure 2(a). (b) Then, to reveal the role of the Conv + SSM contributions, sisubscripts_isitalic_i states from the corrupted run GâsuperscriptG^*Gâ are also patched to block the contributions from those paths. In Figure 3 we plot the average IE for oi(â)superscriptsubscriptâo_i^( )oitalic_i( â ), gi(â)superscriptsubscriptâg_i^( )gitalic_i( â ), and si(â)superscriptsubscriptâs_i^( )sitalic_i( â ). The plot for oi(â)superscriptsubscriptâo_i^( )oitalic_i( â ) (Figure 3a) looks very similar to Figure 2(b), confirming that the output from MambaBlock has strong causal effects at both early and late sites. Interestingly, Figure 3c shows that the selective-SSM outputs si(â)superscriptsubscriptâs_i^( )sitalic_i( â ) have high IE only at the late site, resembling the behavior of attention modules in GPT models (Meng et al., 2022a). However, there is no state that appears to do the opposite; in other words, there is no state with strong effects at the early site and not at the late site (The gate output gi(â)superscriptsubscriptâg_i^( )gitalic_i( â ) does have stronger IE at the early site, but these effects are very weak). To compare with autoregressive transformer LMs, activation patching results for Pythia-2.8b is shown in Figure 10 in Appendix D. This comparison reveals a key way how Mamba differs from transformers: while transformer MLP outputs have effects in the early site and not the late site, in Mamba there is no similar state that specializes only at the early site, at which factual recall would be expected to occur. This presents the question: which parameters in Mamba mediate factual recall? To investigate this question, we replicate an experiment from Meng et al. (2022a) to probe path-specific effects (Pearl, 2022) by severing a path from the causal graph and monitoring its effect. Here, we are interested in understanding the effect of the contributions from gisubscriptg_igitalic_i, sisubscripts_isitalic_i, and oisubscripto_ioitalic_i (i.e. states that are processed by WgsubscriptWW_gWg, Conv + SSM, and WosubscriptWW_oWo respectively) while recalling a fact. First, in the corrupted run GâsuperscriptG^*Gâ, at token position i, we cache all the contributions from the sisubscripts_isitalic_i paths as siâ=siâ(â)|ââ[1,L]superscriptsubscriptconditional-setsuperscriptsubscriptabsentâ1s_i^*=\s_i^*( )|\; â[1,L]\sitalic_iâ = sitalic_iâ ( â ) | â â [ 1 , L ] . Then in the patched run Gâ[âhi(â)]annotatedsuperscriptdelimited-[]âabsentsuperscriptsubscriptââG^*[â h_i^( )]Gâ [ â hitalic_i( â ) ], we restore hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) that was cached from the clean run G into its corresponding state (as in Figure 2(a)), but with an additional modification: to understand the contribution from the sisubscripts_isitalic_i paths, we sever those paths by also patching siâsuperscriptsubscripts_i^*sitalic_iâ (cached from the corrupted run GâsuperscriptG^*Gâ) to their corresponding locations (see Figure 4). The same experiment is replicated to understand the contributions of gisubscriptg_igitalic_i and oisubscripto_ioitalic_i states. We note that severing the oi(â)superscriptsubscriptâo_i^( )oitalic_i( â ) will sever si(â)superscriptsubscriptâs_i^( )sitalic_i( â ) and gi(â)superscriptsubscriptâg_i^( )gitalic_i( â ) as well (see Figure 1). Figure 5: Impact of ablating sisubscripts_isitalic_i, gisubscriptg_igitalic_i, and oisubscripto_ioitalic_i on IEhi(â)subscriptIEsuperscriptsubscriptââIE_h_i^( )IEh start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT for (a) subject last and (b) prompt last token positions. Taken together (a) and (b) show a clear separation roles between early-mid and later layers in Mamba-2.8b. hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) up to layer 46464646 only show strong IE at the subject last token position and have negligible impact after that. Whereas IE of hi(â)superscriptsubscriptââh_i^( )hitalic_i( â ) jumps to 1.01.01.01.0 after layer 46464646. (a) also shows that, at the subject last token, before layer 27â28272827-2827 - 28, IEhi(â)subscriptIEsuperscriptsubscriptââIE_h_i^( )IEh start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT is significantly reduced by blocking either oisubscripto_ioitalic_i, gisubscriptg_igitalic_i, or sisubscripts_isitalic_i paths (sorted in descending order of damaging IEhi(â)subscriptIEsuperscriptsubscriptââIE_h_i^( )IEh start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT). (b) At the prompt last token, ablating oisubscripto_ioitalic_i or sisubscripts_isitalic_i paths can significantly reduce IEhi(â)subscriptIEsuperscriptsubscriptââIE_h_i^( )IEh start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT in layers 47â50475047-5047 - 50. In Figure 5 we plot the average results of this experiment for token positions (a) i=subject lastsubject lasti=subject lasti = subject last and (b) i=prompt lastprompt lasti=prompt lasti = prompt last over 400 examples randomly sampled from the Relations dataset. The key findings can be understood by examining the gap between the purple bars and the green, red, and blue bars: a large gap indicates a strong mediating role for Conv + SSM, WgsubscriptWW_gWg, or WosubscriptWW_oWo parameters, respectively. At the early site at the subject last token, both the Conv + SSM and WgsubscriptWW_gWg have a strong role, but WosubscriptWW_oWo plays an even larger role than either. Yet the strongest mediator at the late site is also WosubscriptWW_oWo. This experiment highlights the importance of WosubscriptWW_oWo in both stages of predicting a fact. But it also suggests that Mamba does not separate early-site factual recall between these groups of parameters as cleanly as transformers. However, Figure 5 reveals a clean separation of roles between early to mid and later layers, analogous to the findings of Hernandez et al. (2023) in transformer LMs. We also note that this division of responsibilities between layers can be more sharply noticed in Mamba when compared to transformers LMs (compare Figure 5 with Figure 11). 4 Editing Facts With ROME Having begun to characterize the locations of important states for factual recall, we now investigate whether factual recall behavior can be edited. In particular, we apply the ROME (Rank One Model Editing, Meng et al., 2022a) technique to Mamba. ROME begins with the observation that any linear transformation can be considered as an associative memory (Anderson, 1972; Kohonen, 1972), mapping a set of keys K=[k1â˘|k2|â˘âŚ]delimited-[]subscript1subscript2âŚK=[k_1|k_2|âŚ]K = [ k1 | k2 | ⌠] to their corresponding values V=[v1â˘|v2|â˘âŚ]delimited-[]subscript1subscript2âŚV=[v_1|v_2|âŚ]V = [ v1 | v2 | ⌠], and uses this to edit factual associations in transformer LMs. Here, we apply the technique to a particular set of linear transformations within Mamba, and report our editing success on each.222Further motivating these experiments, previous work has shown that the locations identified by activation patching techniques are not necessarily those which have the strongest edit performance (Hase et al., 2024). The input to ROME is a prompt x=(s,r)x=(s,r)x = ( s , r ), where s (Emmanuel Macron) is a subject entity and r (is the President of) is a relation. ROME also takes a counterfactual object oâsuperscripto^*oâ (England), meant to replace the correct object o (France) in the modelâs output. To effect that change, ROME generates a rank-one update to W(â)superscriptsubscriptWâW_down^( )Wdown( â ), the down-projection matrix of the MLP module for the last token of the subject at layer â ââwhich plays the role of the associative memory. In generating the rank-one update, ROME considers the input to W(â)superscriptsubscriptWâW_down^( )Wdown( â ) as the key (kâsubscriptk_*kâ). Then, with gradient descent ROME calculates a value (vâsubscriptv_*vâ) such that, when vâsubscriptv_*vâ is inserted as the output of W(â)superscriptsubscriptWâW_down^( )Wdown( â ), the model will output oâsuperscripto^*oâ. Importantly, while optimizing vâsubscriptv_*vâ, ROME attempts to minimize unrelated changes in model outputs (Joe Biden, for example, should still be mapped to the United States post-edit). Finally, ROME adds a rank-1 matrix Î Î to W(â)superscriptsubscriptWâW_down^( )Wdown( â ) such that (W(â)+Î)â˘kââvâsuperscriptsubscriptWâÎsubscriptsubscript (W_down^( )+ )k_*â v_*( Wdown( â ) + Î ) kâ â vâ. (See Meng et al. (2022a) for details.) 4.1 Applying ROME in Mamba We apply ROME on the three different projection matrices of Mamba: Wa(â)superscriptsubscriptWâW_a^( )Wa( â ) which affects only the Conv + SSM path, Wg(â)superscriptsubscriptWâW_g^( )Wg( â ) which affects only the gating path, and Wo(â)superscriptsubscriptWâW_o^( )Wo( â ), the final output of the MambaBlock, which is added to the residual state. We plot ROME performance on different projection matrices (Wa(â)superscriptsubscriptWâW_a^( )Wa( â ), Wg(â)superscriptsubscriptWâW_g^( )Wg( â ), and Wo(â)superscriptsubscriptWâW_o^( )Wo( â )) across all the layers in Figure 6a. Figure 6: ROME performance in editing facts across different layers (a) by modifying Wa(â)superscriptsubscriptWâW_a^( )Wa( â ), Wg(â)superscriptsubscriptWâW_g^( )Wg( â ), Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) in Mamba-2.8b, and (b) modifying Wdâ˘oâ˘wâ˘n(â)superscriptsubscriptWâW_down^( )Wd o w n( â ) in Pythia-2.8b. Results are reported on the first 2000 examples in the CounterFact dataset. To evaluate editing performance, we use the CounterFact dataset from Meng et al. (2022a). CounterFact contains 20K counterfactual examples in the form (s,r,oâoâ)âsuperscript(s,r,oâ o^*)( s , r , o â oâ ), where o is the correct answer to the prompt x=(s,r)x=(s,r)x = ( s , r ), and oâsuperscripto^*oâ is the object which is to be inserted as the new answer to the prompt (See Section A.1 for details). We select the first 2000 examples from this dataset for our module-layer sweep. We use the original evaluation matrices in Meng et al. (2022a) to measure ROME edit performance. The final score (S) in the ROME evaluation suite is the harmonic mean of three different scores: 1. Efficacy (ES): For an edit request (s,r,oâoâ)âsuperscript(s,r,oâ o^*)( s , r , o â oâ ), we say the edit is effective if, post-edit, the LM assigns pâ˘(oâ)>pâ˘(o)superscriptp(o^*)>p(o)p ( oâ ) > p ( o ) in response to the prompt x=(s,r)x=(s,r)x = ( s , r ). Efficacy reflects the portion of the examples where the edit was effective. 2. Generalization (PS): A successful edit should be persistent across different paraphrases of (s,r)(s,r)( s , r ). For each of the request instances (s,r,oâoâ)âsuperscript(s,r,oâ o^*)( s , r , o â oâ ), pâ˘(oâ)>pâ˘(o)superscriptp(o^*)>p(o)p ( oâ ) > p ( o ) is checked post-edit with a set of different rephrasings xpâźrâ˘(s)similar-tosubscriptsubscriptx_p _r(s)xitalic_p âź Pitalic_r ( s ) of the prompt x=(s,r)x=(s,r)x = ( s , r ), where rsubscriptP_rPitalic_r denotes a set of paraphrased templates for the relation r. 3. Specificity (NS): Finally, the edit should be specific to râ˘(s)subscriptP_r(s)Pitalic_r ( s ) and should not additionally change the mapping of some nearby subject snsubscripts_nsitalic_n to oâsuperscripto^*oâ. To evaluate the specificity of an edit we measure pâ˘(on)>pâ˘(oâ)subscriptsuperscriptp(o_n)>p(o^*)p ( oitalic_n ) > p ( oâ ) with râ˘(sn)subscriptsubscriptP_r(s_n)Pitalic_r ( sitalic_n ) for a set of nearby factual associations (sn,r,on)|onâ oâconditional-setsubscriptsubscriptsubscriptsuperscript\(s_n,r,o_n)\,|\,o_nâ o^*\ ( sitalic_n , r , oitalic_n ) | oitalic_n â oâ . Figure 6a shows that ROME can achieve high scores (S) for a range of early to middle layers by modifying any one of the projection matrices Wa(â)superscriptsubscriptWâW_a^( )Wa( â ), Wg(â)superscriptsubscriptWâW_g^( )Wg( â ), or Wo(â)superscriptsubscriptWâW_o^( )Wo( â ), matching observations made by Hase et al. (2024) regarding transformer LMs. However, we found that performance does depend on the location of the edit. For example, in the case of Wg(â)superscriptsubscriptWâW_g^( )Wg( â ) and Wo(â)superscriptsubscriptWâW_o^( )Wo( â ), the score (S) and generalization (PS) drops after around layer 43. This is consistent with our findings from the path-blocking experiment in Figure 5a. We also find that edits to Wa(â)superscriptsubscriptWâW_a^( )Wa( â ) have poor generalization (PS) in early layers, whereas high PS can be achieved at early layers by modifying either Wg(â)superscriptsubscriptWâW_g^( )Wg( â ) or Wo(â)superscriptsubscriptWâW_o^( )Wo( â ), consistent with their higher indirect effects as seen in Figure 5a. Where is the right place to apply ROME on Mamba? Figure 3 could suggest Wg(â)superscriptsubscriptWâW_g^( )Wg( â ), since the causal effect of gisubscriptg_igitalic_i states is mostly concentrated at the subject last token, similar to the behavior of MLPs in transformers (Meng et al., 2022a). Consistent with this is the architectural fact that, just as transformersâ Wdâ˘oâ˘wâ˘n(â)superscriptsubscriptWâW_down^( )Wd o w n( â ) connects to attention modules only through the residual stream, the output of Wg(â)superscriptsubscriptWâW_g^( )Wg( â ) does not flow through the Conv + SSM moduleâa module that other work has suggested might play a role similar to that played by attention heads in transformers (Grazzi et al., 2024). And, indeed, we find that ROME can successfully insert facts by modifying Wg(â)superscriptsubscriptWâW_g^( )Wg( â ). On the other hand Figure 6a reveals sudden drops in efficacy and generalization at middle layer gates, suggesting that Wg(â)superscriptsubscriptWâW_g^( )Wg( â ) may be an unreliable mediator at some layers. Our experiments further show that the best performance for ROME is empirically achieved by modifying Wo(â)superscriptsubscriptWâW_o^( )Wo( â ). This is consistent with the fact that oisubscripto_ioitalic_i states show a stronger causal effect at the subject last token than gisubscriptg_igitalic_i states do (see Figures 3a and 5a). Additionally, ROME achieves better generalization (PS), competitive specificity (NS), and an overall better score (S) with Wo(â)superscriptsubscriptWâW_o^( )Wo( â ). We hypothesize that the strong performance of Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) may be due to the the separation of roles between early-mid and later layers observed in Figures 2(b), 3a, and 5. Also see Appendix C where we isolate the contribution of Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) by subtracting IEsi(â)+IEgi(â)subscriptIEsuperscriptsubscriptâsubscriptIEsuperscriptsubscriptâIE_s_i^( )+IE_g_i^( )IEs start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT + IEg start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT from IEoi(â)subscriptIEsuperscriptsubscriptâIE_o_i^( )IEo start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT, which reveal a critical role of Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) in early-mid layers at subject last token position while mediating a fact. We plot ROME performance for a similar sized Pythia model on Figure 6b for comparison. 5 Linearity of Relation Embedding (LRE) With activation patching we can identify where facts are located inside a LM. We are also interested in understanding how LMs extract this information given x=(s,r)x=(s,r)x = ( s , r ). Figures 2(b) and 5 show a clear separation of roles in early-mid and later layers in Mamba. We observe a similar phenomenon in autoregressive transformer LMs (Meng et al., 2022a; b; Geva et al., 2023). According to Geva et al. (2023), in transformer LMs, the subject entity representation ss, at the subject last token position, goes through an enrichment process, mediated by the MLP in the early-mid layers, where ss is populated with different facts/attributes relevant to the subject entity s. Then, at the last token position, attention modules perform a query on the enriched ss to extract the answer to the prompt x=(s,r)x=(s,r)x = ( s , r ). Hernandez et al. (2023) approximate the query operation performed on the enriched ss for a specific relation r by taking the first order Taylor series approximation (Lre) of the LM computation F as Fâ˘(,r) F(s,r)F ( s , r ) âβâ˘JĎâ˘+babsentsubscriptJ âβ\,J_Ďs+bâ β JĎ s + b where J=i,râ˘[âFâ|(i,r)]where Jsubscriptsubscriptdelimited-[]evaluated-atsubscript J=E_s_i,r [ .% â F |_(s_i,r) ]where J = blackboard_Es start_POSTSUBSCRIPT i , r end_POSTSUBSCRIPT [ divide start_ARG â F end_ARG start_ARG â s end_ARG |( s start_POSTSUBSCRIPT i , r ) end_POSTSUBSCRIPT ] , â˘b=i,râ˘[Fâ˘(,r)ââFââ˘|(i,r)]⢠, , subscriptsubscriptdelimited-[]evaluated-atsubscript , \;, \;\;\;b=E_s_i,r [ .F(% s,r)- â F \;s |_(% s_i,r) ]\;, \;\;\;, b = blackboard_Es start_POSTSUBSCRIPT i , r end_POSTSUBSCRIPT [ F ( s , r ) - divide start_ARG â F end_ARG start_ARG â s end_ARG s |( s start_POSTSUBSCRIPT i , r ) end_POSTSUBSCRIPT ] , (8) βâ˘is a scalaris a scalar β\;is a scalarβ is a scalar , and â˘Ďâ˘is the rank of J , and is the rank of J \;, and \;\;\;Ď\;is the rank of $ J$, and Ď is the rank of J Hernandez et al. (2023) show that for a range of different relations it is possible to achieve a Lre that is faithful to the model computation F by averaging the approximations of J and b calculated on just n=55n=5n = 5 examples. We utilize Lre to understand the complexity of decoding factual relations in Mamba. We find the hyperparameters β, Ď and the layer â â (where to extract the enriched ss from) using grid search. For mathematical and implementation details, see Hernandez et al. (2023). We plot the faithfulness of Lre with n=55n=5n = 5 samples on Figure 7. The metric faithfulness represents the portion of facts (s,r,o)(s,r,o)( s , r , o ) that can be correctly retrieved if the LM computation Fâ˘(,r)F(s,r)F ( s , r ) is replaced with Lreâ˘()Lre Lre(s)Lre ( s ), a simple affine transformation. Figure 7: Lre faithfulness with n=55n=5n = 5 samples for all the factual relations. Horizontal red lines indicate random choice baseline (in the Relations dataset). We only calculate Lre for the factual relations in the Relations dataset. Figure 7 shows that only for 10101010 out of 26262626 factual relations can a linear Lre achieve more than 50%percent5050\%50 % faithfulness. For comparison, in the same sized Pythia-2.8b Lre achives >50%absentpercent50>50\%> 50 % faithfulness for 11111111 factual relations (see Appendix E). And, in both Mamba and Pythia, Lre fails to achieve good faithfulness for the relations where the range (the number of unique answers) is large. These findings align with what Hernandez et al. (2023) observed on GPT and LLaMA models; suggesting that, similar to transformer LMs, factual knowledge might be heterogeneously represented for different relations in Mamba. 6 Attention Knock-out in Mamba? Attention modules mediate the flow of information across different token positions in transformer LMs. In attention âknock-outâ experiments the information that flows through a specific edge (from ktâ˘hsuperscriptâk^thkitalic_t h token to qtâ˘hsuperscriptâq^thqitalic_t h token) via a certain attention head is blocked to understand if critical information flows through that edge. This is also a form of causal mediation analysis and it has been effective in understanding the information flow in transformer LMs (Geva et al., 2023; Wang et al., 2022; Todd et al., 2023). In Mamba, information from past tokens is retained in the sisubscripts_isitalic_i states, with the Conv + SSM operations (see Figure 1 and Equations 3â5). We ask, can we perform experiments similar to attention knock-out experiments in Mamba in order to understand how it moves factual information? We find that performing similar experiments in Mamba can be difficult. The use of Conv with a non-linearity in conjunction with selective-SSM make it challenging to remove the information retained in the qtâ˘hsuperscriptâq^thqitalic_t h token from the ktâ˘hsuperscriptâk^thkitalic_t h token (see Appendix B for details). However, it is possible to block the propagation of information from the ktâ˘hsuperscriptâk^thkitalic_t h token to all the future tokens via Conv + SSM operation by mean-ablation. Specifically, for a layer â â, we set ak(â):=â˘[a(â)]assignsuperscriptsubscriptâdelimited-[]superscriptâa_k^( ):=E [a^( ) ]aitalic_k( â ) := blackboard_E [ a( â ) ], where â˘[a(â)]delimited-[]superscriptâE [a^( ) ]blackboard_E [ a( â ) ] is the mean of a(â)superscriptâa^( )a( â ) states collected with 10,000 tokens from WikiText-103 by Merity et al. (2016). We recognize that this intervention may not be as surgical as cutting a specific edge. However, with some caveats, this experiment suggests that the factual information flow in Mamba is similar to what Geva et al. (2023) observed in GPT LMs. We randomly sample 700 facts across 6 factual relations from the Relations dataset. For each of those examples we block-out information propagation of the subject, non-subject, and the prompt-last token positions for a window of 10101010 layers around a specific layer â â. The effect of blocking out Conv + SSM information flow for certain layer-token (ââkâ -kâ - k) positions is measured as the relative change in pâ˘(o)p(o)p ( o ) with (pâ˘(o|ak(â):=â˘[a(â)])âpâ˘(o))/pâ˘(o)assignconditionalsuperscriptsubscriptâdelimited-[]superscriptâ (p (o\,|\,a_k^( ):=E [a^( )% ] )-p(o) )p(o)/ start_ARG ( p ( o | aitalic_k( â ) := blackboard_E [ a( â ) ] ) - p ( o ) ) end_ARG start_ARG p ( o ) end_ARG. Figure 8 shows the averaged result and it leads us to draw the following conclusions about how factual information flows in Mamba: Figure 8: Relative change in pâ˘(o)p(o)p ( o ) when information flow from ak(â)superscriptsubscriptâa_k^( )aitalic_k( â ) to future tokens via sisubscripts_isitalic_i paths is blocked, with k taking the value of either subject, non-subject, or the prompt_last token positions. For each layer â â, sisubscripts_isitalic_i paths were blocked for a window of 10 layers around â â. (a) The purple lines show that blocking out non-subject information flow in early middle layers can bring down pâ˘(o)p(o)p ( o ) by up to 50%percent5050\%50 %. Non-subject tokens are used to specify the relation r. This observation leads us to believe that Mamba propagates relation specific information to future tokens using Conv+SSM operations in early-middle layers. (b) Interestingly, the green lines (blocking the subject information flow) shows two valleys: 1. The first valley at the early layers is not surprising as Mamba needs to collate information from all the subject tokens in early layers to recognize a subject entity s consisting of multiple tokens. 2. However, the valley at layers 43-48 suggest that Mamba uses Conv + SSM paths in those layers to propagate critical information from the subject to later tokens. This aligns with Figures 5b and 3c, where sisubscripts_isitalic_i states in those layers show high indirect effects, indicating their crucial role while recalling a fact. (c) The blue dashed lines indicate the effect of blocking the information of only the subject last token. If the ablation is performed in very early layers, later layers can start to compensate for that. However, the valley around layers 20-21 suggests that Mamba expects to recognize the full subject entity by then in order to recall relevant associations (enrichment). Notably, activation patching results for oisubscripto_ioitalic_i and sisubscripts_isitalic_iâstates that we hypothesize take crucial part in the enrichment processâalso show strong indirect effect around that region (Figures 3a, 3b, and 5a). The blue line follows the green line after layer 30. The weaker effect observed might be because ablating subject last token is not always enough to remove all the subject information. For example, in Eiffel Tower, Eiffel (tokenized as E, iff, el) is more informative than the last token Tower. These findings align with how factual information flows through attention modules in autoregressive transformer LMs, as observed by Geva et al. (2023) in GPT. However, unlike Geva et al. (2023), we cannot make strong claims about the unique role of the final token position (prompt-last) with this experiment. As we block out information flow to all future tokens, the intermediate states in between the ablated ktâ˘hsuperscriptâk^thkitalic_t h token and the last token are affected as well. 7 Related Works Mamba. Mamba is a recent family of language models that are based on state space models (SSMs). Neural SSM-based models have achieved good performance across different modalities, including vision (Nguyen et al., 2022), audio (Goel et al., 2022), and genomic sequences (Nguyen et al., 2023). Only recently, however, with Mamba, have they become competitive with the language modeling performance of transformers (Gu & Dao, 2023). Like transformers, Mamba contains factual knowledge about real world entities (Grazzi et al., 2024). However, knowledge representation in Mamba (and other LMs based on SSMs) has up to now remained unexplored. There are few works focused on interpreting Mamba. Ali et al. (2024) identify implicit attention-like matrices formed by Mambaâs selective state space layers. Grazzi et al. (2024), while not strictly focused on interpreting Mambaâs internals, apply linear probes to Mambaâs (decoded) intermediate states during in-context regression tasks. Like us, they find substantial similarities between Mamba and transformer models: both architectures pursue âiterativeâ strategies, with the task loss falling more or less monotonically as the layer index increases. Locating Factual Knowledge in Language Models. To make factually correct statements about the world, a LM has to store factual knowledge about real world entities somewhere in its parameters. Understanding how and where a neural network stores knowledge is a core problem for interpretability and it has thus been studied from several perspectives (Ji et al., 2021; Wang et al., 2014). One line of work trains classifiers to probe for properties encoded in model representations (Ettinger et al., 2016; Shi et al., 2016; Hupkes et al., 2018; Conneau et al., 2018; Belinkov et al., 2017; Belinkov & Glass, 2019). However, the flexibility of these classifiers can lead to overestimating model knowledge and capabilites (Belinkov, 2022). Causal mediation analysis methods (Pearl, 2022) attempt to measure the causal contribution of intermediate states to task performance. Meng et al. (2022a; b) use activation patching to identify key MLP modules for factual recall, highlighting the middle layers at particular token positions as being especially important. Similarly, Geva et al. (2023) apply causal mediation analysis to attention modules, seeking to understand the mechanism of cross-token factual information flow inside transformer LMs. 8 Discussion In this paper we have set out to understand whether the analytical methods and tools developed for transformer LMs can also be applied on the Mamba recurrent state-space architecture. Although our experiments have been limited to Mamba-2.8b, the largest available LM of that family, and comparisons to the similarly-sized transformer Pythia-2.8b, the methods we have introduced are general, and can be used to analyze to any state-space model. Our overall comparisons of Mamba and transformers are positive: with activation patching we have found that, similar to autoregressive transformer LMs, Mamba shows signs of localization at the last subject token and at specific layer ranges while recalling a fact. Although, unlike transformers, Mamba has no MLP modules, we find that their WosubscriptWW_oWo weights can receive rank-one model editing (ROME) edits with good generalization and specificity at a range of layers, similar to WsubscriptWW_downWdown in Pythia and GPT family of LMs. We have studied the linearity of the embeddings of factual relations in Mamba and have found that many can be well approximated by Lre, again resembling autoregressive transformer LMs. We have also been able to partially adapt the tools of attention knock-out in Mamba by blocking outgoing information from a token, revealing information flows similar to transformer LMs during factual recall. The similarity that we have observed between factual recall mechanisms in transformers and Mamba leads us to speculate that the autoregressive language modeling task itself induces a pattern of localized factual recall that is independent of modeling architecture. When constraining a model to process text from beginning to end, the ordering creates a specific bottleneck in the information flows: the end of a subject becomes a singular moment at which recognition of the subject is both possible and useful, and we find that both transformers and Mamba arrange their computations to localize factual recall at that moment. We hypothesize that other future autoregressive LMs architectures should expect to see similar locality in factual recall as well. In summary, we find that many of the tools used to interpret and edit large transformers can be adapted to work with Mamba, and we are optimistic that those tools will continue to be useful as architectures continute to evolve. Ethics By exploring the factual recall mechanism in Mamba, we potentially improve its transparency, enabling oversight and control. However, the ability to modify facts directly in the model brings with it the potential for abuse, such as adding malicious misinformation or bias. Reproducibility We ran all experiments on workstations with either 80GB NVIDIA A100 GPUs or 48GB A6000 GPUs, using the HuggingFace Transformers library (Wolf et al., 2019) and PyTorch (Paszke et al., 2019). We make use of publicly available datasets CounterFact and Relations in this work. Acknowledgements This research has been supported by a grant from Open Philanthropy (DB, AS), and an NSF Computer and Information Science and Engineering Graduate Fellowship Fellowship (DA). We are also grateful to the Center for AI Safety (CAIS) for sharing their compute resources, which supported many of our experiments. Some of our initial analyses were conducted with a beta version of NNsight (Fiotto-Kaufman et al., 2024) on an implementation of Mamba instrumented for research by Jaden Fiotto-Kaufmann. References Ali et al. (2024) Ameen Ali, Itamar Zimerman, and Lior Wolf. The hidden attention of mamba models. arXiv preprint arXiv:2403.01590, 2024. Anderson (1972) James A Anderson. A simple neural network generating an interactive memory. Mathematical biosciences, 14(3-4):197â220, 1972. Belinkov (2022) Yonatan Belinkov. Probing classifiers: Promises, shortcomings, and advances. Computational Linguistics, 48(1):207â219, 2022. Belinkov & Glass (2019) Yonatan Belinkov and James Glass. Analysis methods in neural language processing: A survey. Transactions of the Association for Computational Linguistics, 7:49â72, 2019. Belinkov et al. (2017) Yonatan Belinkov, Nadir Durrani, Fahim Dalvi, Hassan Sajjad, and James Glass. What do neural machine translation models learn about morphology? arXiv preprint arXiv:1704.03471, 2017. Biderman et al. (2023) Stella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley, Kyle OâBrien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, p. 2397â2430. PMLR, 2023. Cho et al. (2014) Kyunghyun Cho, Bart Van MerriĂŤnboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014. Conneau et al. (2018) Alexis Conneau, German Kruszewski, Guillaume Lample, LoĂŻc Barrault, and Marco Baroni. What you can cram into a single vector: Probing sentence embeddings for linguistic properties. arXiv preprint arXiv:1805.01070, 2018. Durbin & Koopman (2012) James Durbin and Siem Jan Koopman. Time series analysis by state space methods, volume 38. OUP Oxford, 2012. Elazar et al. (2021) Yanai Elazar, Nora Kassner, Shauli Ravfogel, Abhilasha Ravichander, Eduard Hovy, Hinrich SchĂźtze, and Yoav Goldberg. Measuring and improving consistency in pretrained language models. Transactions of the Association for Computational Linguistics, 9:1012â1031, 2021. Ettinger et al. (2016) Allyson Ettinger, Ahmed Elgohary, and Philip Resnik. Probing for semantic evidence of composition by means of simple classification tasks. In Proceedings of the 1st workshop on evaluating vector-space representations for nlp, p. 134â139, 2016. Fiotto-Kaufman et al. (2024) Jaden Fiotto-Kaufman, Alexander R Loftus, Eric Todd, Jannik Brinkmann, Caden Juang, Koyena Pal, Can Rager, Aaron Mueller, Samuel Marks, Arnab Sen Sharma, et al. Nnsight and ndif: Democratizing access to foundation model internals. arXiv preprint arXiv:2407.14561, 2024. Geiger et al. (2021) Atticus Geiger, Zhengxuan Wu, Hanson Lu, Josh Rozner, Elisa Kreiss, Thomas Icard, Noah D. Goodman, and Christopher Potts. Inducing causal structure for interpretable neural networks. CoRR, abs/2112.00826, 2021. URL https://arxiv.org/abs/2112.00826. Geva et al. (2023) Mor Geva, Jasmijn Bastings, Katja Filippova, and Amir Globerson. Dissecting recall of factual associations in auto-regressive language models. arXiv preprint arXiv:2304.14767, 2023. Goel et al. (2022) Karan Goel, Albert Gu, Chris Donahue, and Christopher Re. Itâs raw! Audio generation with state-space models. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvari, Gang Niu, and Sivan Sabato (eds.), Proceedings of the 39th International Conference on Machine Learning, volume 162 of Proceedings of Machine Learning Research, p. 7616â7633. PMLR, 17â23 Jul 2022. URL https://proceedings.mlr.press/v162/goel22a.html. Grazzi et al. (2024) Riccardo Grazzi, Julien Siems, Simon Schrodi, Thomas Brox, and Frank Hutter. Is Mamba Capable of In-Context Learning?, 2024. URL http://arxiv.org/abs/2402.03170. Gu & Dao (2023) Albert Gu and Tri Dao. Mamba: Linear-time sequence modeling with selective state spaces. arXiv preprint arXiv:2312.00752, 2023. Gu et al. (2021) Albert Gu, Karan Goel, and Christopher RĂŠ. Efficiently modeling long sequences with structured state spaces. arXiv preprint arXiv:2111.00396, 2021. Hase et al. (2024) Peter Hase, Mohit Bansal, Been Kim, and Asma Ghandeharioun. Does localization inform editing? surprising differences in causality-based localization vs. knowledge editing in language models. Advances in Neural Information Processing Systems, 36, 2024. Hernandez et al. (2023) Evan Hernandez, Arnab Sen Sharma, Tal Haklay, Kevin Meng, Martin Wattenberg, Jacob Andreas, Yonatan Belinkov, and David Bau. Linearity of relation decoding in transformer language models. arXiv preprint arXiv:2308.09124, 2023. Hochreiter & Schmidhuber (1997) Sepp Hochreiter and JĂźrgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735â1780, 1997. Hupkes et al. (2018) Dieuwke Hupkes, Sara Veldhoen, and Willem Zuidema. Visualisation andâdiagnostic classifiersâ reveal how recurrent and recursive neural networks process hierarchical structure. Journal of Artificial Intelligence Research, 61:907â926, 2018. Ji et al. (2021) Shaoxiong Ji, Shirui Pan, Erik Cambria, Pekka Marttinen, and S Yu Philip. A survey on knowledge graphs: Representation, acquisition, and applications. IEEE Transactions on Neural Networks and Learning Systems, 33(2):494â514, 2021. Kohonen (1972) Teuvo Kohonen. Correlation matrix memories. IEEE transactions on computers, 100(4):353â359, 1972. Koopman et al. (1999) Siem Jan Koopman, Neil Shephard, and Jurgen A Doornik. Statistical algorithms for models in state space using ssfpack 2.2. The Econometrics Journal, 2(1):107â160, 1999. Meng et al. (2022a) Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in gpt. Advances in Neural Information Processing Systems, 35:17359â17372, 2022a. Meng et al. (2022b) Kevin Meng, Arnab Sen Sharma, Alex Andonian, Yonatan Belinkov, and David Bau. Mass-editing memory in a transformer. arXiv preprint arXiv:2210.07229, 2022b. Merity et al. (2016) Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016. Nanda et al. (2023) Neel Nanda, Senthooran Rajamanoharan, JĂĄnos KramĂĄr, and Rohin Shah. Fact finding: Attempting to reverse-engineer factual recall on the neuron level, 2023. URL https://w.lesswrong.com/posts/iGuwZTHWb6DFY3sKB/fact-finding-attempting-to-reverse-engineer-factual-recall. Nguyen et al. (2022) Eric Nguyen, Karan Goel, Albert Gu, Gordon Downs, Preey Shah, Tri Dao, Stephen Baccus, and Christopher RĂŠ. S4nd: Modeling images and videos as multidimensional signals with state spaces. In S. Koyejo, S. Mohamed, A. Agarwal, D. Belgrave, K. Cho, and A. Oh (eds.), Advances in Neural Information Processing Systems, volume 35, p. 2846â2861. Curran Associates, Inc., 2022. URL https://proceedings.neurips.c/paper_files/paper/2022/file/13388efc819c09564c66ab2dc8463809-Paper-Conference.pdf. Nguyen et al. (2023) Eric Nguyen, Michael Poli, Marjan Faizi, Armin Thomas, Callum Birch-Sykes, Michael Wornow, Aman Patel, Clayton Rabideau, Stefano Massaroli, Yoshua Bengio, Stefano Ermon, Stephen A. Baccus, and Chris RĂŠ. Hyenadna: Long-range genomic sequence modeling at single nucleotide resolution, 2023. Paszke et al. (2019) Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32, 2019. Pearl (2022) Judea Pearl. Direct and indirect effects. In Probabilistic and causal inference: the works of Judea Pearl, p. 373â392. 2022. Shi et al. (2016) Xing Shi, Inkit Padhi, and Kevin Knight. Does string-based neural mt learn source syntax? In Proceedings of the 2016 conference on empirical methods in natural language processing, p. 1526â1534, 2016. Todd et al. (2023) Eric Todd, Millicent L Li, Arnab Sen Sharma, Aaron Mueller, Byron C Wallace, and David Bau. Function vectors in large language models. arXiv preprint arXiv:2310.15213, 2023. Vaswani et al. (2017) Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ĺukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017. Vig et al. (2020) Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, and Stuart Shieber. Investigating gender bias in language models using causal mediation analysis. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, p. 12388â12401. Curran Associates, Inc., 2020. URL https://proceedings.neurips.c/paper_files/paper/2020/file/92650b2e92217715fe312e6fa7b90d82-Paper.pdf. Wang et al. (2022) Kevin Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt. Interpretability in the wild: a circuit for indirect object identification in gpt-2 small. arXiv preprint arXiv:2211.00593, 2022. Wang et al. (2014) Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. Knowledge graph embedding by translating on hyperplanes. In Proceedings of the AAAI conference on artificial intelligence, volume 28, 2014. Wolf et al. (2019) Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, RĂŠmi Louf, Morgan Funtowicz, et al. Huggingfaceâs transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019. Zhang & Nanda (2023) Fred Zhang and Neel Nanda. Towards best practices of activation patching in language models: Metrics and methods. arXiv preprint arXiv:2309.16042, 2023. Appendix A Datasets We use two datasets; CounterFact by Meng et al. (2022a) and Relations by Hernandez et al. (2023) in this work. A.1 CounterFact Meng et al. (2022a) developed the CounterFact dataset for evaluating the efficacy of counterfactual edits in language models. It was prepared by adapting ParaRel (Elazar et al. (2021)) and scraping Wikidata333w.wikidata.org/wiki/Wikidata:Main_Page. The dataset contains 21,9192191921,91921 , 919 requests s,r,o,oâ,Ďâsuperscriptsuperscript\s,r,o,o^*,Ď^*\ s , r , o , oâ , Ďâ where o is the correct answer to the prompt x=(s,r)x=(s,r)x = ( s , r ), oâsuperscripto^*oâ is the counterfactual edit request, and Ďââźâ˘(s,r)similar-tosuperscriptĎ^* (s,r)Ďâ âź P ( s , r ) is a paraphrase of the prompt x=(s,r)x=(s,r)x = ( s , r ) to test for generalizability (PS). Each of the records also contain some neighborhood prompts ĎNsubscript _NĎitalic_N to test for specificity (NS) and some generation prompts ĎGsubscript _GĎitalic_G to test if LM generation post-edit is fluent and consistent with the edit. Please refer to Meng et al. (2022a) for details on the curation of this dataset. We evaluate ROME performance in Mamba-2.8b (Figure 6a) and Pythia-2.8b (Figure 6b) on the first 2000200020002000 records from CounterFact. A.2 Relations The Relations dataset introduced in Hernandez et al. (2023) consists of 47474747 relations of 4444 types: factual, linguistic, bias, and commonsense. A relation r is an association between two entities. For example, the relation, r=professionally played the sportprofessionally played the sportr=professionally played the sportr = professionally played the sport connects the subject s=Michael JordanMichael Jordans=Michael Jordans = Michael Jordan with the object o=basketballbasketballo=basketballo = basketball. The dataset contains a set of (s,o)(s,o)( s , o ) for each relation r. In the scope of this paper, we only utilize the 26262626 factual relations from this dataset. We evaluate Lre in Mamba and Pythia for all the 26262626 factual relations. We also use this dataset for locating key fact-mediating states in Section 3 and Appendix D. We randomly sample 400 examples (s,r,o)(s,r,o)( s , r , o ) across 6 different factual relations - place in city, country capital city, person occupation, plays pro sport, company hq, and product by company. For each of these examples we randomly select another example within the same relation (sâ,r,oâ)superscriptsuperscript(s^*,r,o^*)( sâ , r , oâ ) such that sâ sâsuperscriptsâ s^*s â sâ and oâ oâsuperscriptoâ o^*o â oâ. The average indirect effect (IE) of applying activation patching over these 400 examples is depicted on Figures 2(b), 3, 5 for Mamba-2.8b) and on Figure 10 (for Pythia-2.8b). We use the same set of 6666 relations in Section 6 where we adapt attention knock-out to Mamba. Appendix B Challenges in Performing Attention Knock-out in Mamba Attention heads in autoregressive transformer LMs and Conv + SSM operations in Mamba play a similar role: bringing/retaining information from the past tokens. Attention âknock-outâ is a type of causal mediation analysis that tries to understand information flow in transformer LMs by cutting off information propagation from ktâ˘hsuperscriptâk^thkitalic_t h token to qtâ˘hsuperscriptâq^thqitalic_t h token position. In transformers, each of the attention heads in an attention module aâ˘tâ˘tâ˘n(â)superscriptâattn^( )a t t n( â ) calculates an attention matrix L, where Lq,ksubscriptLL_q,kLq , k quantifies how much attention is being paid to the ktâ˘hsuperscriptâk^thkitalic_t h token by the qtâ˘hsuperscriptâq^thqitalic_t h token with this specific attention head (see Vaswani et al. (2017) for details on the attention operation). We can block the information flow from ktâ˘hsuperscriptâk^thkitalic_t h token to qtâ˘hsuperscriptâq^thqitalic_t h token via a specific attention head by simply setting Lq,k:=ââassignsubscriptLL_q,k:=-âLq , k := - â in the forward pass. For Mamba, Ali et al. (2024) show that the amount of information retained in the qtâ˘hsuperscriptâq^thqitalic_t h token state sq(â)superscriptsubscriptâs_q^( )sitalic_q( â ), from the convolved state at ktâ˘hsuperscriptâk^thkitalic_t h token ck(â)superscriptsubscriptâc_k^( )citalic_k( â ) (where k<qk<qk < q), after the selective-SSM operation (see Equations 4 and 5) can be visualized as an attention matrix per channel. Since the selective-SSM operation is linear, the information retained in sq(â)superscriptsubscriptâs_q^( )sitalic_q( â ) from ck(â)superscriptsubscriptâc_k^( )citalic_k( â ) can be calculated accurately as Îą~q,k(â)=CÂŻq(â)â˘(âi=k+1qAÂŻi(â))â˘BÂŻk(â)â˘ck(â)superscriptsubscript~âsuperscriptsubscriptÂŻCâsuperscriptsubscriptproduct1superscriptsubscriptÂŻAâsuperscriptsubscriptÂŻBâsuperscriptsubscriptâ Îą_q,k^( )= C_q^( ) ( _i=% k+1^q A_i^( ) ) B_k^( )% c_k^( )over~ start_ARG Îą end_ARGq , k( â ) = overÂŻ start_ARG C end_ARGq( â ) ( âi = k + 1q overÂŻ start_ARG A end_ARGi( â ) ) overÂŻ start_ARG B end_ARGk( â ) citalic_k( â ), where AÂŻi(â)superscriptsubscriptÂŻAâ A_i^( )overÂŻ start_ARG A end_ARGi( â ), BÂŻi(â)superscriptsubscriptÂŻBâ B_i^( )overÂŻ start_ARG B end_ARGi( â ), and CÂŻi(â)superscriptsubscriptÂŻCâ C_i^( )overÂŻ start_ARG C end_ARGi( â ) are input-dependent parameters for the itâ˘hsuperscriptâi^thiitalic_t h token. See Gu & Dao (2023) and Ali et al. (2024) for details on selective-SSM operation. We ask: can we block the information flow from the ktâ˘hsuperscriptâk^thkitalic_t h token to the qtâ˘hsuperscriptâq^thqitalic_t h token in Mamba by subtracting out Îą~q,k(â)superscriptsubscript~â Îą_q,k^( )over~ start_ARG Îą end_ARGq , k( â ) from sq(â)superscriptsubscriptâs_q^( )sitalic_q( â )? If so, attention knockout experiments in Mamba become feasible. We find that blocking information flow via Conv + SSM operation through this specific edge from the ktâ˘hsuperscriptâk^thkitalic_t h token to the qtâ˘hsuperscriptâq^thqitalic_t h token can be challenging in Mamba. Note that, since ck(â)superscriptsubscriptâc_k^( )citalic_k( â ) is a convolved state with a receptive field of size 4 in Mamba-2.8b, the states ck+1(â)superscriptsubscript1âc_k+1^( )citalic_k + 1( â ), ck+2(â)superscriptsubscript2âc_k+2^( )citalic_k + 2( â ), and ck+3(â)superscriptsubscript3âc_k+3^( )citalic_k + 3( â ) also retain information from ak(â)superscriptsubscriptâa_k^( )aitalic_k( â ). Which means that even if we subtract Îą~q,k(â)superscriptsubscript~â Îą_q,k^( )over~ start_ARG Îą end_ARGq , k( â ) from sq(â)superscriptsubscriptâs_q^( )sitalic_q( â ), these states can âleakâ information about ak(â)superscriptsubscriptâa_k^( )aitalic_k( â ) to sq(â)superscriptsubscriptâs_q^( )sitalic_q( â ). To stop this leakage, we would want to subtract from sq(â)superscriptsubscriptâs_q^( )sitalic_q( â ) all the information retained from ak(â)superscriptsubscriptâa_k^( )aitalic_k( â ) via ck+1(â)superscriptsubscript1âc_k+1^( )citalic_k + 1( â ), ck+2(â)superscriptsubscript2âc_k+2^( )citalic_k + 2( â ), and ck+3(â)superscriptsubscript3âc_k+3^( )citalic_k + 3( â ) states as well. However, accurately calculating this is challenging because of the SiLU non-linearity after Conv1D (see Equation 4). In our initial experiments we tested subtracting only Îą~q,k(â)superscriptsubscript~â Îą_q,k^( )over~ start_ARG Îą end_ARGq , k( â ) from sq(â)superscriptsubscriptâs_q^( )sitalic_q( â ). But we found that Mamba-2.8b could often refer to the ktâ˘hsuperscriptâk^thkitalic_t h token from the qtâ˘hsuperscriptâq^thqitalic_t h token in copy and factual recall tasks. Appendix C Isolating The Contribution of Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) Recall from Figure 1 and Equation 2 that when oi(â)superscriptsubscriptâo_i^( )oitalic_i( â ) is restored, the si(â)superscriptsubscriptâs_i^( )sitalic_i( â ) and gi(â)superscriptsubscriptâg_i^( )gitalic_i( â ) are restored as well. To isolate the contribution of only Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) we subtract out IEsi(â)+IEgi(â)subscriptIEsuperscriptsubscriptâsubscriptIEsuperscriptsubscriptâIE_s_i^( )+IE_g_i^( )IEs start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT + IEg start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT from IEoi(â)subscriptIEsuperscriptsubscriptâIE_o_i^( )IEo start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT and plot the results on Figure 9. Notice that subtracting IEsi(â)subscriptIEsuperscriptsubscriptâIE_s_i^( )IEs start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT cancels out the high indirect effect at the late site shown by later layers at the last token position. But, together IEsi(â)+IEgi(â)subscriptIEsuperscriptsubscriptâsubscriptIEsuperscriptsubscriptâIE_s_i^( )+IE_g_i^( )IEs start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT + IEg start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT cannot cancel out high IEoi(â)subscriptIEsuperscriptsubscriptâIE_o_i^( )IEo start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT observed at the early site, that is early-mid layers at the last subject token. This reconfirms the mediating role of Wo(â)superscriptsubscriptWâW_o^( )Wo( â ) at the early site while recalling a fact. Figure 9: Isolating the contribution of Wo(â)superscriptsubscriptWâW_o^( )Wo( â ). IEsi(â)+IEgi(â)subscriptIEsuperscriptsubscriptâsubscriptIEsuperscriptsubscriptâIE_s_i^( )+IE_g_i^( )IEs start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT + IEg start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT subtracted from IEoi(â)subscriptIEsuperscriptsubscriptâIE_o_i^( )IEo start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT. Notice that IEoi(â)â(IEsi(â)+IEgi(â))subscriptIEsuperscriptsubscriptâsubscriptIEsuperscriptsubscriptâsubscriptIEsuperscriptsubscriptâIE_o_i^( )- (IE_s_i^( )+IE_g_i^% ( ) )IEo start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT - ( IEs start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT + IEg start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT ) still shows higher causal effect at the early site (more pronounced than IEgi(â)subscriptIEsuperscriptsubscriptâIE_g_i^( )IEg start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT) while the high causal effect at the late site cancels out. Appendix D Locating Key Modules in Pythia-2.8b Figure 10: Average indirect effect of residual state, MLP, and attention outputs in Pythia-2.8b over 400 facts. For MLP and attention outputs a window of 10 layers around â â is restored, as restoring just one layer barely shows visible patterns. Figure 11: Impact of ablating ATTNisubscriptATTNATTN_iATTNi or MLPisubscriptMLPMLP_iMLPi on IEhi(â)subscriptIEsuperscriptsubscriptââIE_h_i^( )IEh start_POSTSUBSCRIPT i( â ) end_POSTSUBSCRIPT for (a) subject last and (b) prompt last token positions on Pythia-2.8b Appendix E Lre in Pythia-2.8b Figure 12: Relation-wise Lre faithfulness to the LM decoding function F. Horizontal red lines per relation indicate random-choice baseline. We only present results for the factual relations in the Relations dataset. Appendix F Lre Performance Across Different Relations Besides faithfulness Hernandez et al. (2023) introduced another metric causality to measure the performance of Lre. Since Lre is a linear function, it is invertible. Assume that for a fact (s,r,o)(s,r,o)( s , r , o ) Lre can faithfully replace LM computation Fâ˘(,r)F(s,r)F ( s , r ). Then given the representation âsuperscripto^*oâ of another object o, Jâ1â˘(ââ)superscriptJ1superscriptJ^-1(o^*-o)J- 1 ( oâ - o ) should give us a Îâ˘Î Î s, such that when added to ss, ~:=+Îâ˘assign~Î s:=s+ ~ start_ARG s end_ARG := s + Î s, the model computation Fâ˘(~,r)~F( s,r)F ( over~ start_ARG s end_ARG , r ) should generate oâsuperscripto^*oâ. See Hernandez et al. (2023) for details on this. Figure 13: For Mamba, we only perform sweep till layer 48, as Figure 5 suggests negligible activity for later layers at the subject last token Appendix G Activation Patching results on Mamba-2.8b