Alignment Via Interpretability: Layerwise Counterfactuals To Detect Maladaptive Llm Behaviors

preprint OA: closed
Full text JSON View at publisher

Abstract

Abstract Large language model alignment remains fragile under distribution shift, jailbreak prompts, and latent goal misgeneralization, motivating the need for diagnostic tools that move beyond surface level behavior to internal representations. This paper investigates alignment via interpretability by introducing a layerwise counterfactual analysis framework that probes how targeted interventions on hidden states alter downstream model behavior. Using publicly available transformer based language models and open interpretability tooling, we perform controlled counterfactual substitutions and activation patching across layers to detect maladaptive behaviors that are not reliably exposed through prompt based evaluation alone. Our analysis demonstrates that specific intermediate layers encode decision critical features whose perturbation consistently induces alignment failures such as reward hacking tendencies, deceptive compliance, and instruction misgeneralization, even when input level behavior appears aligned. We further show that these internal signatures are stable across random seeds and model checkpoints, enabling reproducible detection of misalignment risks prior to deployment. The findings support the thesis that interpretability driven diagnostics can serve as an early warning mechanism for alignment failures and provide a principled foundation for integrating internal model transparency into safety evaluation pipelines.
Full text 82,269 characters · extracted from preprint-html · click to expand
Alignment Via Interpretability: Layerwise Counterfactuals To Detect Maladaptive Llm Behaviors | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article Alignment Via Interpretability: Layerwise Counterfactuals To Detect Maladaptive Llm Behaviors Nnaemeka Kingsley Ugwumba, Juan Sebastian Murillejo Contreras This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-8714712/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Large language model alignment remains fragile under distribution shift, jailbreak prompts, and latent goal misgeneralization, motivating the need for diagnostic tools that move beyond surface level behavior to internal representations. This paper investigates alignment via interpretability by introducing a layerwise counterfactual analysis framework that probes how targeted interventions on hidden states alter downstream model behavior. Using publicly available transformer based language models and open interpretability tooling, we perform controlled counterfactual substitutions and activation patching across layers to detect maladaptive behaviors that are not reliably exposed through prompt based evaluation alone. Our analysis demonstrates that specific intermediate layers encode decision critical features whose perturbation consistently induces alignment failures such as reward hacking tendencies, deceptive compliance, and instruction misgeneralization, even when input level behavior appears aligned. We further show that these internal signatures are stable across random seeds and model checkpoints, enabling reproducible detection of misalignment risks prior to deployment. The findings support the thesis that interpretability driven diagnostics can serve as an early warning mechanism for alignment failures and provide a principled foundation for integrating internal model transparency into safety evaluation pipelines. Artificial Intelligence and Machine Learning Large language models AI alignment interpretability counterfactual analysis activation patching transformer architectures internal representations safety diagnostics Figures Figure 1 Figure 2 1. Introduction Large language models have rapidly transitioned from research prototypes to widely deployed systems supporting decision making, content generation, and automated assistance across sensitive domains. Despite impressive capabilities, these models continue to exhibit behaviors that conflict with intended alignment objectives, including instruction misgeneralization, deceptive compliance, and latent goal pursuit under distribution shift. Existing alignment evaluations primarily rely on prompt based testing and behavioral benchmarks, which, while useful, offer limited insight into the internal mechanisms that give rise to such failures. As a result, models may appear aligned under standard evaluations while retaining internal representations that predispose them to maladaptive behavior in novel or adversarial contexts. Recent advances in mechanistic interpretability have begun to reveal that transformer based language models develop structured internal representations distributed across layers and attention heads. These representations encode task relevant features, abstract concepts, and decision shaping signals that are not directly observable from input output behavior alone. This observation has motivated a growing interest in interpretability as a tool for alignment, shifting the focus from reactive behavioral filtering toward proactive diagnosis of internal failure modes. However, most interpretability studies remain descriptive, offering post hoc explanations of model behavior without establishing systematic methods for detecting alignment risks prior to deployment. In parallel, counterfactual reasoning has emerged as a powerful analytical paradigm for understanding causal relationships in complex systems. Within neural networks, counterfactual interventions on internal activations provide a principled means of testing how specific components contribute to observed behavior. Techniques such as activation patching and representation replacement have demonstrated success in identifying causal pathways for factual recall, reasoning, and task execution. Yet, their application to alignment evaluation remains underexplored, particularly in a layerwise setting that examines how misalignment signals evolve through the model’s depth. This paper bridges this gap by proposing a layerwise counterfactual interpretability framework for detecting maladaptive behaviors in large language models. Rather than evaluating alignment solely through prompts, we intervene directly on hidden state representations at different layers and measure the resulting behavioral shifts under controlled conditions. This approach enables us to isolate internal features that are causally linked to alignment failures, even when surface behavior remains compliant. By grounding alignment analysis in internal model dynamics, we aim to complement existing evaluation methodologies with diagnostics that are both more sensitive and more explanatory. Our contributions are threefold. First, we formalize a reproducible framework for performing layerwise counterfactual interventions in transformer based language models using open source interpretability tools. Second, we empirically demonstrate that specific layers consistently encode misalignment relevant features whose perturbation induces measurable maladaptive behaviors across tasks and model variants. Third, we discuss how these internal signals can be integrated into alignment evaluation pipelines as early warning indicators, offering a path toward more robust and transparent safety assessments. The remainder of this paper is structured as follows. Section 2 reviews related work in model alignment, interpretability, and counterfactual analysis. Section 3 describes the experimental setup, models, datasets, and intervention methodology. Section 4 presents empirical findings from layerwise counterfactual experiments. Section 5 discusses implications for alignment research and practical deployment. Section 6 concludes with limitations and directions for future work. 2. Related Work 2.1 Alignment Methods and Behavioral Evaluation of Language Models Research on aligning large language models has predominantly focused on training time and post training techniques aimed at shaping observable behavior. Reinforcement learning from human feedback has become a foundational approach, enabling models to optimize outputs according to human preference signals rather than likelihood alone (Christiano et al., 2017 ; Ouyang et al., 2022 ). Complementary methods such as supervised fine tuning, constitutional prompting, and rule based constraints further refine compliance with safety guidelines (Bai et al., 2022 ). Alongside these training approaches, a substantial body of work has proposed behavioral benchmarks to evaluate alignment. These include adversarial prompting, red teaming evaluations, and curated safety datasets designed to elicit harmful or undesirable responses (Ganguli et al., 2022 ; Perez et al., 2022 ). While such evaluations are effective at identifying overt failures, multiple studies have highlighted their limitations. In particular, models may learn to produce superficially aligned responses without resolving underlying goal misgeneralization, leading to failures under distribution shift or strategic prompting (Ngo et al., 2023 ). This gap has motivated increasing interest in alignment diagnostics that extend beyond input output behavior. 2.2 Mechanistic Interpretability in Transformer Architectures Mechanistic interpretability aims to uncover how neural networks internally represent and compute functions. In the context of transformer based language models, early studies demonstrated that attention heads and multilayer perceptrons encode interpretable linguistic and semantic features, such as syntactic relations and positional structure (Clark et al., 2019 ; Vig, 2019 ). Subsequent work revealed that higher level abstractions, including factual associations and task relevant concepts, emerge in deeper layers (Tenney et al., 2019 ). More recent efforts have emphasized circuit level analysis, identifying subnetworks that implement specific behaviors within otherwise opaque models (Olah et al., 2020 ; Wang et al., 2023 ). These findings suggest that interpretability is not merely descriptive but can support causal explanations of model behavior. However, much of this literature focuses on capabilities such as reasoning or recall, with limited attention to safety and alignment properties. 2.3 Counterfactual and Causal Interventions on Internal Representations Causal analysis in neural networks has increasingly relied on counterfactual interventions that modify internal activations rather than inputs. Techniques such as activation patching and causal tracing enable researchers to replace internal states from one context with those from another, observing the resulting effect on model outputs (Meng et al., 2022 ; Geiger et al., 2023 ). These methods have been used to identify where factual knowledge is stored, how reasoning chains propagate, and which layers contribute most strongly to specific predictions. By intervening directly on hidden representations, counterfactual approaches move beyond correlation and provide evidence of functional necessity. Despite their success in capability analysis, their application to alignment remains relatively limited. Existing studies rarely examine how internal representations associated with harmful intent or misaligned objectives causally influence downstream behavior, leaving an important gap in the literature. 2.4 Interpretability as a Tool for Alignment and Safety A growing number of researchers have argued that interpretability should play a central role in AI safety. Conceptual work has proposed that transparency into internal representations may reveal deceptive or power seeking tendencies that are not detectable through behavioral testing alone (Hubinger et al., 2019 ; Carlsmith, 2023 ). Empirical studies have begun exploring whether internal activations encode indicators of deception, reward hacking, or goal conflict (Burns et al., 2022 ). However, existing approaches often rely on probes or single layer analyses, which may conflate correlation with causation. Moreover, many studies focus on identifying alignment relevant features without establishing systematic methods for tracing their causal influence across the model’s depth. As a result, it remains unclear where misalignment originates internally and how it propagates to observable behavior. 2.5 Contribution Relative to Prior Work This paper advances the literature by integrating causal interpretability techniques into alignment evaluation through a layerwise counterfactual framework. Unlike behavioral benchmarks, our approach operates directly on internal representations and is therefore insensitive to prompt level obfuscation. Unlike prior interpretability studies, it systematically traces alignment relevant signals across layers, enabling detection of latent maladaptive behaviors even when surface outputs appear compliant. In doing so, this work positions interpretability no t only as an explanatory tool but as a proactive diagnostic mechanism for alignment risk assessment. 3. Methodology This section describes the models, datasets, interpretability tools, and layerwise counterfactual procedures used to analyze maladaptive behaviors in large language models. The methodology is designed to be fully reproducible using publicly available resources and to isolate causal relationships between internal representations and alignment relevant behaviors. 3.1 Model Selection We conduct our analysis on publicly released transformer based language models that are widely used in interpretability research due to their transparency and accessible internal states. Specifically, we focus on decoder only architectures with standard residual stream formulations, enabling consistent activation patching across layers. Models are selected to span different parameter scales and training regimes, allowing us to assess whether observed alignment relevant patterns persist across model variants. All models are evaluated in inference mode with fixed random seeds to ensure reproducibility of counterfactual interventions. 3.2 Evaluation Tasks and Behavioral Probes To study maladaptive behavior, we employ a set of controlled evaluation tasks designed to elicit alignment relevant failure modes. These include instruction following under ambiguous constraints, refusal compliance scenarios, and prompts that test goal generalization beyond the training distribution. Rather than relying on subjective judgments, we define task specific behavioral metrics that capture deviations from intended alignment, such as inappropriate compliance, inconsistent refusal patterns, or strategic reinterpretation of instructions. These probes serve as stable reference points for measuring the effects of internal interventions. Table 1 summarizes the models, evaluation tasks, and intervention mechanisms used in the layerwise counterfactual analysis. Table 1 Summary of Models, Tasks, and Counterfactual Interventions Aspect Description Model architecture Decoder only transformer based language models Model access Publicly released, open weight or open inference Evaluation tasks Instruction following, refusal compliance, goal ambiguity Intervention method Layerwise residual stream activation patching Analysis granularity Per layer counterfactual substitution Reproducibility controls Fixed seeds, deterministic decoding 3.3 Layerwise Counterfactual Framework Our core methodology consists of performing layerwise counterfactual interventions on hidden state representations. Given an input prompt and its corresponding forward pass, we record the residual stream activations at each transformer layer. We then construct counterfactual runs by replacing the activation at a selected layer with an alternative activation obtained from a contrasting input that differs only in alignment relevant properties. This substitution preserves the surrounding computational context while isolating the causal influence of the targeted layer. Figure 1 illustrates the proposed layerwise counterfactual interpretability framework. Internal residual stream activations are extracted from a baseline aligned prompt and a contrasting misaligned prompt. Counterfactual substitutions are performed at individual transformer layers, and the resulting behavioral changes are measured to identify layers that causally encode alignment relevant representations. Formally, let h_l(x) denote the residual stream activation at layer l for input x. For a counterfactual input x', we define a patched forward pass where h_l(x) is replaced with h_l(x'), while all other layers process the original input. The resulting output is compared to the baseline output to assess behavioral change attributable to layer l. 3.4 Activation Patching and Causal Tracing We implement activation patching using established open source interpretability libraries that allow precise interception and replacement of internal activations. For each task instance, we perform patching at every transformer layer, producing a layerwise profile of behavioral sensitivity. This enables causal tracing of alignment relevant signals through the network depth, revealing where misalignment features emerge, amplify, or attenuate. To reduce noise, we repeat interventions across multiple prompt pairs that share semantic structure but differ in alignment properties. Behavioral effects are aggregated across instances to identify consistent layerwise patterns rather than idiosyncratic responses. 3.5 Stability and Reproducibility Controls To ensure that observed effects are not artifacts of randomness or prompt selection, we incorporate several controls. All experiments are conducted with fixed decoding parameters and deterministic sampling. Counterfactual interventions are repeated across multiple random seeds where applicable, and results are averaged to assess stability. Additionally, we verify that activation patching on unrelated control prompts does not induce spurious behavioral changes, providing a baseline for causal specificity. 3.6 Ethical Considerations This study does not involve human subjects or private data. All models and datasets used are publicly available and licensed for research use. Our goal is to improve model safety and transparency, and no interventions are designed to enhance harmful capabilities. Findings are reported with an emphasis on diagnostic insight rather than exploitation of vulnerabilities. 4. Experiments and Results This section presents empirical findings from applying the proposed layerwise counterfactual framework to publicly available transformer based language models. Rather than focusing on aggregate performance metrics, the analysis emphasizes causal behavioral shifts induced by internal interventions, revealing where and how maladaptive tendencies are encoded within the model. Table 2 categorizes the observed behavioral effects induced by counterfactual interventions across transformer layers and their alignment implications. Table 2 Observed Effects of Counterfactual Interventions on Alignment Behavior Layer Region Behavioral Effect Observed Alignment Implication Early layers Minimal or no behavioral change Encodes surface linguistic features Intermediate layers Frequent shifts between refusal and compliance Encodes alignment critical intent representations Late layers Stylistic or formatting changes Influences response realization rather than decisions 4.1 Experimental Setup For each selected model, we evaluate a collection of prompt pairs that differ minimally in surface structure but contrast in alignment relevant intent. Examples include prompts that request benign assistance versus those that subtly violate stated constraints, as well as prompts that introduce conflicting objectives. For each pair, we record baseline model behavior and then perform layerwise activation patching, substituting internal representations from one prompt context into the other. Behavioral outcomes are assessed using predefined criteria tied to alignment objectives, such as whether the model complies, refuses, or strategically reframes its response. These outcomes provide a consistent basis for comparing baseline and counterfactual runs. 4.2 Layerwise Sensitivity to Counterfactual Interventions Across models and tasks, we observe a clear non uniform sensitivity profile across layers. Early layers exhibit minimal behavioral change under counterfactual substitution, indicating that they primarily encode lexical and syntactic features with limited direct influence on alignment decisions. In contrast, intermediate layers consistently produce the largest behavioral shifts when patched, often flipping the model’s response from refusal to compliance or vice versa. Late layers, while still influential, tend to modulate stylistic aspects of responses rather than core decision outcomes. This pattern suggests that alignment relevant features are neither purely input level nor exclusively output level phenomena, but are concentrated within a mid depth representational regime where abstract intent and constraint representations are integrated. Figure 2 shows a qualitative layerwise sensitivity profile indicating the relative behavioral impact of counterfactual activation patching across transformer depth. Intermediate layers consistently exhibit the highest causal influence on alignment relevant behavior, while early and late layers show reduced sensitivity. 4.3 Detection of Latent Maladaptive Behaviors A key finding is that counterfactual interventions can induce maladaptive behavior even when baseline outputs appear aligned. In several evaluation cases, models initially refused unsafe requests in a manner consistent with alignment guidelines. However, when intermediate layer activations from a misaligned prompt were patched into an aligned prompt context, the model exhibited inappropriate compliance or partial disclosure. This indicates that internal representations associated with misaligned intent can persist despite surface level refusal, remaining dormant unless activated through internal perturbation. Such latent behaviors are not detectable through prompt based evaluation alone, underscoring the diagnostic value of interpretability driven analysis. 4.4 Consistency Across Models and Seeds The observed layerwise patterns are stable across different model checkpoints and random seeds. While the exact layer indices associated with maximal sensitivity vary slightly with model depth, the qualitative structure remains consistent: early layers show low causal impact, intermediate layers encode alignment critical features, and late layers refine output realization. This consistency suggests that the emergence of alignment relevant representations at specific depths is a structural property of transformer architectures rather than an artifact of individual training runs. 4.5 Control Experiments Control interventions performed using semantically unrelated activation substitutions do not produce systematic behavioral changes, confirming that the observed effects are not driven by arbitrary noise injection. Additionally, patching activations between prompts that differ only in surface phrasing but share alignment intent results in negligible behavioral deviation, supporting the causal specificity of the framework. 4.6 Summary of Findings Collectively, these experiments demonstrate that layerwise counterfactual analysis can reliably identify internal representations that are causally linked to maladaptive behaviors. By revealing latent misalignment signals that persist beneath aligned outputs, the framework provides a more sensitive diagnostic tool than behavioral evaluation alone. 5. Discussion 5.1 Interpretation of Findings The results presented in this study offer strong evidence that alignment relevant behaviors in large language models are causally mediated by internal representations that emerge at specific depths within transformer architectures. The observed concentration of behavioral sensitivity in intermediate layers supports the hypothesis that these layers serve as an integration point where abstract intent representations, learned constraints, and contextual goals converge. Early layers primarily encode surface level linguistic features, while later layers focus on response realization, leaving intermediate layers as the locus of decision critical computation. A particularly important insight is the detection of latent maladaptive behaviors that persist despite aligned surface outputs. The ability of counterfactual interventions to elicit inappropriate compliance from models that initially refuse unsafe requests indicates that alignment cannot be reliably inferred from behavioral outputs alone. This finding aligns with prior concerns regarding deceptive alignment and goal misgeneralization, but extends them by demonstrating a concrete, causal mechanism through which such risks can be diagnosed. 5.2 Implications for Alignment Evaluation These findings have significant implications for how alignment is evaluated in practice. Current evaluation pipelines rely heavily on prompt based testing, red teaming, and curated benchmarks. While valuable, such approaches are inherently reactive and can be bypassed through distribution shift or adversarial prompting. The layerwise counterfactual framework introduced in this work provides a complementary diagnostic that operates independently of prompt surface form. By identifying internal representations that causally influence maladaptive behavior, interpretability driven diagnostics can serve as early warning signals prior to deployment. This opens the possibility of integrating internal audits into model release procedures, analogous to static analysis in software engineering. Moreover, because the framework is model agnostic and relies on open tooling, it is well suited for comparative analysis across architectures and training regimes. 5.3 Implications for Model Training and Governance Beyond evaluation, the results suggest directions for improving alignment during training. If misalignment relevant features are consistently localized within specific layers, targeted interventions such as layer specific regularization, representation shaping, or interpretability informed loss terms may be more effective than global behavioral penalties. From a governance perspective, the ability to demonstrate internal alignment diagnostics may become increasingly important for regulatory compliance and accountability in safety critical deployments. 5.4 Limitations This study has several limitations that warrant careful consideration. First, while counterfactual interventions establish causal influence, they do not directly reveal how misalignment features are learned during training. Second, the analysis focuses on decoder only transformer architectures, and findings may not fully generalize to other model families or multimodal systems. Third, behavioral evaluation metrics, though carefully designed, cannot exhaustively capture all forms of maladaptive behavior. Additionally, interpretability methods themselves introduce abstraction and may miss distributed or nonlinear representations that do not localize cleanly within individual layers. These limitations highlight the need to treat interpretability based diagnostics as complementary rather than definitive alignment guarantees. 6. Conclusion and Future Work This paper introduced a layerwise counterfactual interpretability framework for detecting maladaptive behaviors in large language models. By intervening directly on internal representations and tracing their causal influence across layers, we demonstrated that alignment relevant features are encoded internally even when surface level behavior appears compliant. The findings show that interpretability can move beyond explanation to serve as a proactive diagnostic tool for alignment risk assessment. Future work will explore extending this framework to larger models, multimodal architectures, and training time interventions. An important direction is integrating counterfactual diagnostics into alignment training loops, enabling models to be shaped based on internal safety signals rather than outputs alone. Additionally, formalizing metrics for internal alignment robustness remains an open challenge. Together, these directions point toward a future in which transparency and causality play central roles in building safer and more trustworthy AI systems. Declarations Ethical Declarations Ethical Approval Not applicable. This research did not involve human participants, animal subjects, or any primary data collection from living entities. Competing Interests The authors declare no competing interests, financial or non-financial, relevant to the content of this article. Funding The authors received no specific funding for this work. Authorship Contribution Nnaemeka KIngsley Ugwumba: Conceptualization, Methodology, Software, Writing - Original Draft. .Juan Sebastian Murillejo Contreras: Editing and Review The authors reviewed and approved the final manuscript. Data Availability Declaration All data generated or analysed during this study, including the figures and source code, are available in the following GitHub repository : https://github.com/KingsleyTechie/Layerwise-Counterfactual-LLM-Alignment References Bai, Y., Kadavath, S., Kundu, S., Askell, A., Kernion, J., Jones, A., Chen, A., Goldie, A., Mirhoseini, A., McKinnon, C., Chen, J., Olsson, C., Marsh, J., Landau, J., Ndousse, K., Lukosuite, K., Sellitto, M., Elhage, N., Schiefer, N., ... Kaplan, J. (2022). Constitutional AI: Harmlessness from AI feedback. arXiv:2212.08073. https://doi.org/10.48550/arXiv.2212.08073 Burns, C., Ye, H., Klein, D., & Steinhardt, J. (2022). Discovering latent knowledge in language models without supervision. arXiv:2212.03827. https://doi.org/10.48550/arXiv.2212.03827 Carlsmith, J. (2023). Is power-seeking AI an existential risk? arXiv:2206.13353. https://doi.org/10.48550/arXiv.2206.13353 Christiano, P. F., Leike, J., Brown, T. B., Martic, M., Legg, S., & Amodei, D. (2017). Deep reinforcement learning from human preferences. Advances in Neural Information Processing Systems, 30, 4299–4307. https://doi.org/10.48550/arXiv.1706.03741 Clark, K., Khandelwal, U., Levy, O., & Manning, C. D. (2019). What does BERT look at? An analysis of BERT's attention. Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, 276–286. https://doi.org/10.18653/v1/W19-4828 Ganguli, D., Lovitt, L., Kernion, J., Askell, A., Bai, Y., Kadavath, S., Mann, B., Perez, E., Schiefer, N., Ndousse, K., Jones, A., Bowman, S., Chen, A., Conerly, T., DasSarma, N., Drain, D., Elhage, N., El-Showk, S., Fort, S., ... Kaplan, J. (2022). Red teaming language models to reduce harms: Methods, scaling behaviors, and lessons learned. arXiv:2209.07858. https://doi.org/10.48550/arXiv.2209.07858 Geiger, A., Wu, Z., Lu, H., Rozner, J., Kreiss, E., Icard, T., Goodman, N. D., & Potts, C. (2023). Causal abstractions of neural networks. Advances in Neural Information Processing Systems, 36. https://doi.org/10.48550/arXiv.2301.04709 Hubinger, E., van Merwijk, C., Mikulik, V., Skalse, J., & Garrabrant, S. (2019). Risks from learned optimization in advanced machine learning systems. arXiv:1906.01820. https://doi.org/10.48550/arXiv.1906.01820 Meng, K., Bau, D., Andonian, A., & Belinkov, Y. (2022). Locating and editing factual associations in GPT. Advances in Neural Information Processing Systems, 35, 17359–17372. https://doi.org/10.48550/arXiv.2202.05262 Ngo, R., Chan, L., & Mindermann, S. (2023). The alignment problem from a deep learning perspective. arXiv:2209.00626. https://doi.org/10.48550/arXiv.2209.00626 Olah, C., Cammarata, N., Schubert, L., Goh, G., Petrov, M., & Carter, S. (2020). Zoom in: An introduction to circuits. Distill, 5(3), e00024.001. https://doi.org/10.23915/distill.00024 Ouyang, L., Wu, J., Jiang, X., Almeida, D., Wainwright, C., Mishkin, P., Zhang, C., Agarwal, S., Slama, K., Ray, A., Schulman, J., Hilton, J., Kelton, F., Miller, L., Simens, M., Askell, A., Welinder, P., Christiano, P., Leike, J., & Lowe, R. (2022). Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35, 27730–27744. https://doi.org/10.48550/arXiv.2203.02155 Perez, E., Huang, S., Song, F., Cai, T., Ring, R., Aslanides, J., Glaese, A., McAleese, N., & Irving, G. (2022). Red teaming language models with language models. arXiv:2202.03286. https://doi.org/10.48550/arXiv.2202.03286 Tenney, I., Das, D., & Pavlick, E. (2019). BERT rediscovers the classical NLP pipeline. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, 4593–4601. https://doi.org/10.18653/v1/P19-1452 Vig, J. (2019). A multiscale visualization of attention in the transformer model. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, 37–42. https://doi.org/10.18653/v1/P19-3007 Wang, K., Variengien, A., Conmy, A., Shlegeris, B., & Steinhardt, J. (2023). Interpretability in the wild: A circuit for indirect object identification in GPT-2 small. arXiv:2305.07759. https://doi.org/10.48550/arXiv.2305.07759 Additional Declarations The authors declare no competing interests. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-8714712","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":581418196,"identity":"a9ebd826-6a1d-4a16-a161-a6fecf6c7479","order_by":0,"name":"Nnaemeka Kingsley Ugwumba","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAABMklEQVRIiWNgGAWjYPCCBBjjAAM/mIQAA+K0SDZAtEgQr8UAagVOLebSzQ8f3ahIk2eQSL8mzZtzR974Ru7BwwUV9+oY2Ju3STDuqEXXYjnnmLFxzpkcwwaJnDJp3m3PDLfdyEs4PONMsQQDz7EyCcYzx9G1GNxIMJPObatgBGpJu8277TDjths5Bod52xIkGCRyzCQY245hakn//jv3X4U9TIv95hkwLfJvcGjJMWPObchJbJBIPwbSkrhBAm4LD0hLDRYtxdI5x9KSG3jesP+cu+1Z8owzbwyAfkmQbONJK7ZIbDuAxWEbP+fUJNs2sKc/Nni77Y5tf3uO8eeCigR+fvbDG298bKvDFtBgYH+ABxELzCCCDUQkMBzGqYWBgf0BqhYowG3LKBgFo2AUjBQAAIY0dhyXTjBlAAAAAElFTkSuQmCC","orcid":"https://orcid.org/0009-0000-2493-9846","institution":"Laskenta Technologies Limited","correspondingAuthor":true,"prefix":"","firstName":"Nnaemeka","middleName":"Kingsley","lastName":"Ugwumba","suffix":""},{"id":581418197,"identity":"a31860d0-0b9b-401a-8369-34a9623b3332","order_by":1,"name":"Juan Sebastian Murillejo Contreras","email":"","orcid":"","institution":"Laskenta Technologies Limited","correspondingAuthor":false,"prefix":"","firstName":"Juan","middleName":"Sebastian Murillejo","lastName":"Contreras","suffix":""}],"badges":[],"createdAt":"2026-01-27 23:00:17","currentVersionCode":1,"declarations":{"humanSubjects":false,"vertebrateSubjects":true,"conflictsOfInterestStatement":false,"humanSubjectEthicalGuidelines":false,"humanSubjectConsent":false,"humanSubjectClinicalTrial":false,"humanSubjectCaseReport":false,"vertebrateSubjectEthicalGuidelines":true},"doi":"10.21203/rs.3.rs-8714712/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-8714712/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":101375395,"identity":"ccf9163f-5da5-4b62-bdba-0f33d3f2e1f9","added_by":"auto","created_at":"2026-01-29 04:26:40","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":376267,"visible":true,"origin":"","legend":"\u003cp\u003eLayerwise Counterfactual Intervention Framework for Alignment Diagnosis\u003c/p\u003e","description":"","filename":"floatimage1.png","url":"https://assets-eu.researchsquare.com/files/rs-8714712/v1/23a591e1e8ca890144883a0f.png"},{"id":101375394,"identity":"de077430-09b7-4585-a816-449a8a154162","added_by":"auto","created_at":"2026-01-29 04:26:40","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":149734,"visible":true,"origin":"","legend":"\u003cp\u003eBehavioral Sensitivity Profile Across Transformer Layers\u003c/p\u003e","description":"","filename":"floatimage2.png","url":"https://assets-eu.researchsquare.com/files/rs-8714712/v1/201f847cf366439eafd52937.png"},{"id":101398435,"identity":"e152dc40-f936-4c0e-945b-e739c8214162","added_by":"auto","created_at":"2026-01-29 09:41:26","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":1604274,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-8714712/v1/76e8a638-f43b-41f9-96f1-82238f68d870.pdf"}],"financialInterests":"The authors declare no competing interests.","formattedTitle":"\u003cp\u003e\u003cstrong\u003eAlignment Via Interpretability: Layerwise Counterfactuals To Detect Maladaptive Llm Behaviors\u003c/strong\u003e\u003c/p\u003e","fulltext":[{"header":"1. Introduction","content":"\u003cp\u003eLarge language models have rapidly transitioned from research prototypes to widely deployed systems supporting decision making, content generation, and automated assistance across sensitive domains. Despite impressive capabilities, these models continue to exhibit behaviors that conflict with intended alignment objectives, including instruction misgeneralization, deceptive compliance, and latent goal pursuit under distribution shift. Existing alignment evaluations primarily rely on prompt based testing and behavioral benchmarks, which, while useful, offer limited insight into the internal mechanisms that give rise to such failures. As a result, models may appear aligned under standard evaluations while retaining internal representations that predispose them to maladaptive behavior in novel or adversarial contexts.\u003c/p\u003e \u003cp\u003eRecent advances in mechanistic interpretability have begun to reveal that transformer based language models develop structured internal representations distributed across layers and attention heads. These representations encode task relevant features, abstract concepts, and decision shaping signals that are not directly observable from input output behavior alone. This observation has motivated a growing interest in interpretability as a tool for alignment, shifting the focus from reactive behavioral filtering toward proactive diagnosis of internal failure modes. However, most interpretability studies remain descriptive, offering post hoc explanations of model behavior without establishing systematic methods for detecting alignment risks prior to deployment.\u003c/p\u003e \u003cp\u003eIn parallel, counterfactual reasoning has emerged as a powerful analytical paradigm for understanding causal relationships in complex systems. Within neural networks, counterfactual interventions on internal activations provide a principled means of testing how specific components contribute to observed behavior. Techniques such as activation patching and representation replacement have demonstrated success in identifying causal pathways for factual recall, reasoning, and task execution. Yet, their application to alignment evaluation remains underexplored, particularly in a layerwise setting that examines how misalignment signals evolve through the model\u0026rsquo;s depth.\u003c/p\u003e \u003cp\u003eThis paper bridges this gap by proposing a layerwise counterfactual interpretability framework for detecting maladaptive behaviors in large language models. Rather than evaluating alignment solely through prompts, we intervene directly on hidden state representations at different layers and measure the resulting behavioral shifts under controlled conditions. This approach enables us to isolate internal features that are causally linked to alignment failures, even when surface behavior remains compliant. By grounding alignment analysis in internal model dynamics, we aim to complement existing evaluation methodologies with diagnostics that are both more sensitive and more explanatory.\u003c/p\u003e \u003cp\u003eOur contributions are threefold. First, we formalize a reproducible framework for performing layerwise counterfactual interventions in transformer based language models using open source interpretability tools. Second, we empirically demonstrate that specific layers consistently encode misalignment relevant features whose perturbation induces measurable maladaptive behaviors across tasks and model variants. Third, we discuss how these internal signals can be integrated into alignment evaluation pipelines as early warning indicators, offering a path toward more robust and transparent safety assessments.\u003c/p\u003e \u003cp\u003eThe remainder of this paper is structured as follows. Section \u003cspan refid=\"Sec2\" class=\"InternalRef\"\u003e2\u003c/span\u003e reviews related work in model alignment, interpretability, and counterfactual analysis. Section \u003cspan refid=\"Sec8\" class=\"InternalRef\"\u003e3\u003c/span\u003e describes the experimental setup, models, datasets, and intervention methodology. Section \u003cspan refid=\"Sec15\" class=\"InternalRef\"\u003e4\u003c/span\u003e presents empirical findings from layerwise counterfactual experiments. Section \u003cspan refid=\"Sec22\" class=\"InternalRef\"\u003e5\u003c/span\u003e discusses implications for alignment research and practical deployment. Section \u003cspan refid=\"Sec27\" class=\"InternalRef\"\u003e6\u003c/span\u003e concludes with limitations and directions for future work.\u003c/p\u003e"},{"header":"2. Related Work","content":"\u003cdiv id=\"Sec3\" class=\"Section2\"\u003e \u003ch2\u003e2.1 Alignment Methods and Behavioral Evaluation of Language Models\u003c/h2\u003e \u003cp\u003eResearch on aligning large language models has predominantly focused on training time and post training techniques aimed at shaping observable behavior. Reinforcement learning from human feedback has become a foundational approach, enabling models to optimize outputs according to human preference signals rather than likelihood alone (Christiano et al., \u003cspan citationid=\"CR4\" class=\"CitationRef\"\u003e2017\u003c/span\u003e; Ouyang et al., \u003cspan citationid=\"CR12\" class=\"CitationRef\"\u003e2022\u003c/span\u003e). Complementary methods such as supervised fine tuning, constitutional prompting, and rule based constraints further refine compliance with safety guidelines (Bai et al., \u003cspan citationid=\"CR1\" class=\"CitationRef\"\u003e2022\u003c/span\u003e).\u003c/p\u003e \u003cp\u003eAlongside these training approaches, a substantial body of work has proposed behavioral benchmarks to evaluate alignment. These include adversarial prompting, red teaming evaluations, and curated safety datasets designed to elicit harmful or undesirable responses (Ganguli et al., \u003cspan citationid=\"CR6\" class=\"CitationRef\"\u003e2022\u003c/span\u003e; Perez et al., \u003cspan citationid=\"CR13\" class=\"CitationRef\"\u003e2022\u003c/span\u003e). While such evaluations are effective at identifying overt failures, multiple studies have highlighted their limitations. In particular, models may learn to produce superficially aligned responses without resolving underlying goal misgeneralization, leading to failures under distribution shift or strategic prompting (Ngo et al., \u003cspan citationid=\"CR10\" class=\"CitationRef\"\u003e2023\u003c/span\u003e). This gap has motivated increasing interest in alignment diagnostics that extend beyond input output behavior.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec4\" class=\"Section2\"\u003e \u003ch2\u003e2.2 Mechanistic Interpretability in Transformer Architectures\u003c/h2\u003e \u003cp\u003eMechanistic interpretability aims to uncover how neural networks internally represent and compute functions. In the context of transformer based language models, early studies demonstrated that attention heads and multilayer perceptrons encode interpretable linguistic and semantic features, such as syntactic relations and positional structure (Clark et al., \u003cspan citationid=\"CR5\" class=\"CitationRef\"\u003e2019\u003c/span\u003e; Vig, \u003cspan citationid=\"CR15\" class=\"CitationRef\"\u003e2019\u003c/span\u003e). Subsequent work revealed that higher level abstractions, including factual associations and task relevant concepts, emerge in deeper layers (Tenney et al., \u003cspan citationid=\"CR14\" class=\"CitationRef\"\u003e2019\u003c/span\u003e).\u003c/p\u003e \u003cp\u003eMore recent efforts have emphasized circuit level analysis, identifying subnetworks that implement specific behaviors within otherwise opaque models (Olah et al., \u003cspan citationid=\"CR11\" class=\"CitationRef\"\u003e2020\u003c/span\u003e; Wang et al., \u003cspan citationid=\"CR16\" class=\"CitationRef\"\u003e2023\u003c/span\u003e). These findings suggest that interpretability is not merely descriptive but can support causal explanations of model behavior. However, much of this literature focuses on capabilities such as reasoning or recall, with limited attention to safety and alignment properties.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec5\" class=\"Section2\"\u003e \u003ch2\u003e2.3 Counterfactual and Causal Interventions on Internal Representations\u003c/h2\u003e \u003cp\u003eCausal analysis in neural networks has increasingly relied on counterfactual interventions that modify internal activations rather than inputs. Techniques such as activation patching and causal tracing enable researchers to replace internal states from one context with those from another, observing the resulting effect on model outputs (Meng et al., \u003cspan citationid=\"CR9\" class=\"CitationRef\"\u003e2022\u003c/span\u003e; Geiger et al., \u003cspan citationid=\"CR7\" class=\"CitationRef\"\u003e2023\u003c/span\u003e). These methods have been used to identify where factual knowledge is stored, how reasoning chains propagate, and which layers contribute most strongly to specific predictions.\u003c/p\u003e \u003cp\u003eBy intervening directly on hidden representations, counterfactual approaches move beyond correlation and provide evidence of functional necessity. Despite their success in capability analysis, their application to alignment remains relatively limited. Existing studies rarely examine how internal representations associated with harmful intent or misaligned objectives causally influence downstream behavior, leaving an important gap in the literature.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec6\" class=\"Section2\"\u003e \u003ch2\u003e2.4 Interpretability as a Tool for Alignment and Safety\u003c/h2\u003e \u003cp\u003eA growing number of researchers have argued that interpretability should play a central role in AI safety. Conceptual work has proposed that transparency into internal representations may reveal deceptive or power seeking tendencies that are not detectable through behavioral testing alone (Hubinger et al., \u003cspan citationid=\"CR8\" class=\"CitationRef\"\u003e2019\u003c/span\u003e; Carlsmith, \u003cspan citationid=\"CR3\" class=\"CitationRef\"\u003e2023\u003c/span\u003e). Empirical studies have begun exploring whether internal activations encode indicators of deception, reward hacking, or goal conflict (Burns et al., \u003cspan citationid=\"CR2\" class=\"CitationRef\"\u003e2022\u003c/span\u003e).\u003c/p\u003e \u003cp\u003eHowever, existing approaches often rely on probes or single layer analyses, which may conflate correlation with causation. Moreover, many studies focus on identifying alignment relevant features without establishing systematic methods for tracing their causal influence across the model\u0026rsquo;s depth. As a result, it remains unclear where misalignment originates internally and how it propagates to observable behavior.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec7\" class=\"Section2\"\u003e \u003ch2\u003e2.5 Contribution Relative to Prior Work\u003c/h2\u003e \u003cp\u003eThis paper advances the literature by integrating causal interpretability techniques into alignment evaluation through a layerwise counterfactual framework. Unlike behavioral benchmarks, our approach operates directly on internal representations and is therefore insensitive to prompt level obfuscation. Unlike prior interpretability studies, it systematically traces alignment relevant signals across layers, enabling detection of latent maladaptive behaviors even when surface outputs appear compliant. In doing so, this work positions interpretability no\u003cb\u003et\u003c/b\u003e only as an explanatory tool but as a proactive diagnostic mechanism for alignment risk assessment.\u003c/p\u003e \u003c/div\u003e"},{"header":"3. Methodology","content":"\u003cp\u003eThis section describes the models, datasets, interpretability tools, and layerwise counterfactual procedures used to analyze maladaptive behaviors in large language models. The methodology is designed to be fully reproducible using publicly available resources and to isolate causal relationships between internal representations and alignment relevant behaviors.\u003c/p\u003e \u003cdiv id=\"Sec9\" class=\"Section2\"\u003e \u003ch2\u003e3.1 Model Selection\u003c/h2\u003e \u003cp\u003eWe conduct our analysis on publicly released transformer based language models that are widely used in interpretability research due to their transparency and accessible internal states. Specifically, we focus on decoder only architectures with standard residual stream formulations, enabling consistent activation patching across layers. Models are selected to span different parameter scales and training regimes, allowing us to assess whether observed alignment relevant patterns persist across model variants. All models are evaluated in inference mode with fixed random seeds to ensure reproducibility of counterfactual interventions.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec10\" class=\"Section2\"\u003e \u003ch2\u003e3.2 Evaluation Tasks and Behavioral Probes\u003c/h2\u003e \u003cp\u003eTo study maladaptive behavior, we employ a set of controlled evaluation tasks designed to elicit alignment relevant failure modes. These include instruction following under ambiguous constraints, refusal compliance scenarios, and prompts that test goal generalization beyond the training distribution. Rather than relying on subjective judgments, we define task specific behavioral metrics that capture deviations from intended alignment, such as inappropriate compliance, inconsistent refusal patterns, or strategic reinterpretation of instructions. These probes serve as stable reference points for measuring the effects of internal interventions. Table\u0026nbsp;\u003cspan refid=\"Tab1\" class=\"InternalRef\"\u003e1\u003c/span\u003e summarizes the models, evaluation tasks, and intervention mechanisms used in the layerwise counterfactual analysis.\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab1\" border=\"1\"\u003e \u003ccaption language=\"En\"\u003e \u003cdiv class=\"CaptionNumber\"\u003eTable 1\u003c/div\u003e \u003cdiv class=\"CaptionContent\"\u003e \u003cp\u003eSummary of Models, Tasks, and Counterfactual Interventions\u003c/p\u003e \u003c/div\u003e \u003c/caption\u003e \u003ccolgroup cols=\"2\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eAspect\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eDescription\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eModel architecture\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eDecoder only transformer based language models\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eModel access\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003ePublicly released, open weight or open inference\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cb\u003eEvaluation tasks\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e\u003cb\u003eInstruction following, refusal compliance, goal ambiguity\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cb\u003eIntervention method\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e\u003cb\u003eLayerwise residual stream activation patching\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cb\u003eAnalysis granularity\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e\u003cb\u003ePer layer counterfactual substitution\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cb\u003eReproducibility controls\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e\u003cb\u003eFixed seeds, deterministic decoding\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec11\" class=\"Section2\"\u003e \u003ch2\u003e3.3 Layerwise Counterfactual Framework\u003c/h2\u003e \u003cp\u003eOur core methodology consists of performing layerwise counterfactual interventions on hidden state representations. Given an input prompt and its corresponding forward pass, we record the residual stream activations at each transformer layer. We then construct counterfactual runs by replacing the activation at a selected layer with an alternative activation obtained from a contrasting input that differs only in alignment relevant properties. This substitution preserves the surrounding computational context while isolating the causal influence of the targeted layer.\u003c/p\u003e \u003cp\u003eFigure \u003cspan refid=\"Fig1\" class=\"InternalRef\"\u003e1\u003c/span\u003e illustrates the proposed layerwise counterfactual interpretability framework. Internal residual stream activations are extracted from a baseline aligned prompt and a contrasting misaligned prompt. Counterfactual substitutions are performed at individual transformer layers, and the resulting behavioral changes are measured to identify layers that causally encode alignment relevant representations.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003cp\u003eFormally, let h_l(x) denote the residual stream activation at layer l for input x. For a counterfactual input x', we define a patched forward pass where h_l(x) is replaced with h_l(x'), while all other layers process the original input. The resulting output is compared to the baseline output to assess behavioral change attributable to layer l.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec12\" class=\"Section2\"\u003e \u003ch2\u003e3.4 Activation Patching and Causal Tracing\u003c/h2\u003e \u003cp\u003eWe implement activation patching using established open source interpretability libraries that allow precise interception and replacement of internal activations. For each task instance, we perform patching at every transformer layer, producing a layerwise profile of behavioral sensitivity. This enables causal tracing of alignment relevant signals through the network depth, revealing where misalignment features emerge, amplify, or attenuate.\u003c/p\u003e \u003cp\u003eTo reduce noise, we repeat interventions across multiple prompt pairs that share semantic structure but differ in alignment properties. Behavioral effects are aggregated across instances to identify consistent layerwise patterns rather than idiosyncratic responses.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec13\" class=\"Section2\"\u003e \u003ch2\u003e3.5 Stability and Reproducibility Controls\u003c/h2\u003e \u003cp\u003eTo ensure that observed effects are not artifacts of randomness or prompt selection, we incorporate several controls. All experiments are conducted with fixed decoding parameters and deterministic sampling. Counterfactual interventions are repeated across multiple random seeds where applicable, and results are averaged to assess stability. Additionally, we verify that activation patching on unrelated control prompts does not induce spurious behavioral changes, providing a baseline for causal specificity.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec14\" class=\"Section2\"\u003e \u003ch2\u003e3.6 Ethical Considerations\u003c/h2\u003e \u003cp\u003eThis study does not involve human subjects or private data. All models and datasets used are publicly available and licensed for research use. Our goal is to improve model safety and transparency, and no interventions are designed to enhance harmful capabilities. Findings are reported with an emphasis on diagnostic insight rather than exploitation of vulnerabilities.\u003c/p\u003e \u003c/div\u003e"},{"header":"4. Experiments and Results","content":"\u003cp\u003eThis section presents empirical findings from applying the proposed layerwise counterfactual framework to publicly available transformer based language models. Rather than focusing on aggregate performance metrics, the analysis emphasizes causal behavioral shifts induced by internal interventions, revealing where and how maladaptive tendencies are encoded within the model. Table\u0026nbsp;\u003cspan refid=\"Tab2\" class=\"InternalRef\"\u003e2\u003c/span\u003e categorizes the observed behavioral effects induced by counterfactual interventions across transformer layers and their alignment implications.\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"Yes\" id=\"Tab2\" border=\"1\"\u003e \u003ccaption language=\"En\"\u003e \u003cdiv class=\"CaptionNumber\"\u003eTable 2\u003c/div\u003e \u003cdiv class=\"CaptionContent\"\u003e \u003cp\u003eObserved Effects of Counterfactual Interventions on Alignment Behavior\u003c/p\u003e \u003c/div\u003e \u003c/caption\u003e \u003ccolgroup cols=\"3\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c3\" colnum=\"3\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eLayer Region\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eBehavioral Effect Observed\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c3\"\u003e \u003cp\u003eAlignment Implication\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eEarly layers\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eMinimal or no behavioral change\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c3\"\u003e \u003cp\u003eEncodes surface linguistic features\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003ctr\u003e \u003cth align=\"left\" colname=\"c1\"\u003e \u003cp\u003eIntermediate layers\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c2\"\u003e \u003cp\u003eFrequent shifts between refusal and compliance\u003c/p\u003e \u003c/th\u003e \u003cth align=\"left\" colname=\"c3\"\u003e \u003cp\u003eEncodes alignment critical intent representations\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cb\u003eLate layers\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e\u003cb\u003eStylistic or formatting changes\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e\u003cb\u003eInfluences response realization rather than decisions\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e \u003cdiv id=\"Sec16\" class=\"Section2\"\u003e \u003ch2\u003e4.1 Experimental Setup\u003c/h2\u003e \u003cp\u003eFor each selected model, we evaluate a collection of prompt pairs that differ minimally in surface structure but contrast in alignment relevant intent. Examples include prompts that request benign assistance versus those that subtly violate stated constraints, as well as prompts that introduce conflicting objectives. For each pair, we record baseline model behavior and then perform layerwise activation patching, substituting internal representations from one prompt context into the other.\u003c/p\u003e \u003cp\u003eBehavioral outcomes are assessed using predefined criteria tied to alignment objectives, such as whether the model complies, refuses, or strategically reframes its response. These outcomes provide a consistent basis for comparing baseline and counterfactual runs.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec17\" class=\"Section2\"\u003e \u003ch2\u003e4.2 Layerwise Sensitivity to Counterfactual Interventions\u003c/h2\u003e \u003cp\u003eAcross models and tasks, we observe a clear non uniform sensitivity profile across layers. Early layers exhibit minimal behavioral change under counterfactual substitution, indicating that they primarily encode lexical and syntactic features with limited direct influence on alignment decisions. In contrast, intermediate layers consistently produce the largest behavioral shifts when patched, often flipping the model\u0026rsquo;s response from refusal to compliance or vice versa.\u003c/p\u003e \u003cp\u003eLate layers, while still influential, tend to modulate stylistic aspects of responses rather than core decision outcomes. This pattern suggests that alignment relevant features are neither purely input level nor exclusively output level phenomena, but are concentrated within a mid depth representational regime where abstract intent and constraint representations are integrated. Figure\u0026nbsp;\u003cspan refid=\"Fig2\" class=\"InternalRef\"\u003e2\u003c/span\u003e shows a qualitative layerwise sensitivity profile indicating the relative behavioral impact of counterfactual activation patching across transformer depth. Intermediate layers consistently exhibit the highest causal influence on alignment relevant behavior, while early and late layers show reduced sensitivity.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec18\" class=\"Section2\"\u003e \u003ch2\u003e4.3 Detection of Latent Maladaptive Behaviors\u003c/h2\u003e \u003cp\u003eA key finding is that counterfactual interventions can induce maladaptive behavior even when baseline outputs appear aligned. In several evaluation cases, models initially refused unsafe requests in a manner consistent with alignment guidelines. However, when intermediate layer activations from a misaligned prompt were patched into an aligned prompt context, the model exhibited inappropriate compliance or partial disclosure.\u003c/p\u003e \u003cp\u003eThis indicates that internal representations associated with misaligned intent can persist despite surface level refusal, remaining dormant unless activated through internal perturbation. Such latent behaviors are not detectable through prompt based evaluation alone, underscoring the diagnostic value of interpretability driven analysis.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec19\" class=\"Section2\"\u003e \u003ch2\u003e4.4 Consistency Across Models and Seeds\u003c/h2\u003e \u003cp\u003eThe observed layerwise patterns are stable across different model checkpoints and random seeds. While the exact layer indices associated with maximal sensitivity vary slightly with model depth, the qualitative structure remains consistent: early layers show low causal impact, intermediate layers encode alignment critical features, and late layers refine output realization.\u003c/p\u003e \u003cp\u003eThis consistency suggests that the emergence of alignment relevant representations at specific depths is a structural property of transformer architectures rather than an artifact of individual training runs.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec20\" class=\"Section2\"\u003e \u003ch2\u003e4.5 Control Experiments\u003c/h2\u003e \u003cp\u003eControl interventions performed using semantically unrelated activation substitutions do not produce systematic behavioral changes, confirming that the observed effects are not driven by arbitrary noise injection. Additionally, patching activations between prompts that differ only in surface phrasing but share alignment intent results in negligible behavioral deviation, supporting the causal specificity of the framework.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec21\" class=\"Section2\"\u003e \u003ch2\u003e4.6 Summary of Findings\u003c/h2\u003e \u003cp\u003eCollectively, these experiments demonstrate that layerwise counterfactual analysis can reliably identify internal representations that are causally linked to maladaptive behaviors. By revealing latent misalignment signals that persist beneath aligned outputs, the framework provides a more sensitive diagnostic tool than behavioral evaluation alone.\u003c/p\u003e \u003c/div\u003e"},{"header":"5. Discussion","content":"\u003cdiv id=\"Sec23\" class=\"Section2\"\u003e \u003ch2\u003e5.1 Interpretation of Findings\u003c/h2\u003e \u003cp\u003eThe results presented in this study offer strong evidence that alignment relevant behaviors in large language models are causally mediated by internal representations that emerge at specific depths within transformer architectures. The observed concentration of behavioral sensitivity in intermediate layers supports the hypothesis that these layers serve as an integration point where abstract intent representations, learned constraints, and contextual goals converge. Early layers primarily encode surface level linguistic features, while later layers focus on response realization, leaving intermediate layers as the locus of decision critical computation.\u003c/p\u003e \u003cp\u003eA particularly important insight is the detection of latent maladaptive behaviors that persist despite aligned surface outputs. The ability of counterfactual interventions to elicit inappropriate compliance from models that initially refuse unsafe requests indicates that alignment cannot be reliably inferred from behavioral outputs alone. This finding aligns with prior concerns regarding deceptive alignment and goal misgeneralization, but extends them by demonstrating a concrete, causal mechanism through which such risks can be diagnosed.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec24\" class=\"Section2\"\u003e \u003ch2\u003e5.2 Implications for Alignment Evaluation\u003c/h2\u003e \u003cp\u003eThese findings have significant implications for how alignment is evaluated in practice. Current evaluation pipelines rely heavily on prompt based testing, red teaming, and curated benchmarks. While valuable, such approaches are inherently reactive and can be bypassed through distribution shift or adversarial prompting. The layerwise counterfactual framework introduced in this work provides a complementary diagnostic that operates independently of prompt surface form.\u003c/p\u003e \u003cp\u003eBy identifying internal representations that causally influence maladaptive behavior, interpretability driven diagnostics can serve as early warning signals prior to deployment. This opens the possibility of integrating internal audits into model release procedures, analogous to static analysis in software engineering. Moreover, because the framework is model agnostic and relies on open tooling, it is well suited for comparative analysis across architectures and training regimes.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec25\" class=\"Section2\"\u003e \u003ch2\u003e5.3 Implications for Model Training and Governance\u003c/h2\u003e \u003cp\u003eBeyond evaluation, the results suggest directions for improving alignment during training. If misalignment relevant features are consistently localized within specific layers, targeted interventions such as layer specific regularization, representation shaping, or interpretability informed loss terms may be more effective than global behavioral penalties. From a governance perspective, the ability to demonstrate internal alignment diagnostics may become increasingly important for regulatory compliance and accountability in safety critical deployments.\u003c/p\u003e \u003c/div\u003e \u003cdiv id=\"Sec26\" class=\"Section2\"\u003e \u003ch2\u003e5.4 Limitations\u003c/h2\u003e \u003cp\u003eThis study has several limitations that warrant careful consideration. First, while counterfactual interventions establish causal influence, they do not directly reveal how misalignment features are learned during training. Second, the analysis focuses on decoder only transformer architectures, and findings may not fully generalize to other model families or multimodal systems. Third, behavioral evaluation metrics, though carefully designed, cannot exhaustively capture all forms of maladaptive behavior.\u003c/p\u003e \u003cp\u003eAdditionally, interpretability methods themselves introduce abstraction and may miss distributed or nonlinear representations that do not localize cleanly within individual layers. These limitations highlight the need to treat interpretability based diagnostics as complementary rather than definitive alignment guarantees.\u003c/p\u003e \u003c/div\u003e"},{"header":"6. Conclusion and Future Work","content":"\u003cp\u003eThis paper introduced a layerwise counterfactual interpretability framework for detecting maladaptive behaviors in large language models. By intervening directly on internal representations and tracing their causal influence across layers, we demonstrated that alignment relevant features are encoded internally even when surface level behavior appears compliant. The findings show that interpretability can move beyond explanation to serve as a proactive diagnostic tool for alignment risk assessment.\u003c/p\u003e \u003cp\u003eFuture work will explore extending this framework to larger models, multimodal architectures, and training time interventions. An important direction is integrating counterfactual diagnostics into alignment training loops, enabling models to be shaped based on internal safety signals rather than outputs alone. Additionally, formalizing metrics for internal alignment robustness remains an open challenge. Together, these directions point toward a future in which transparency and causality play central roles in building safer and more trustworthy AI systems.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e\u003cstrong\u003eEthical Declarations\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eEthical Approval\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNot applicable. This research did not involve human participants, animal subjects, or any primary data collection from living entities.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eCompeting Interests\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors declare no competing interests, financial or non-financial, relevant to the content of this article.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eFunding\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe authors received no specific funding for this work.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eAuthorship Contribution\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eNnaemeka KIngsley Ugwumba: Conceptualization, Methodology, Software, Writing - Original Draft.\u0026nbsp;\u003c/p\u003e\n\u003cp\u003e.Juan Sebastian Murillejo Contreras: Editing and Review\u003c/p\u003e\n\u003cp\u003eThe authors reviewed and approved the final manuscript.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eData Availability Declaration\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eAll data generated or analysed during this study, including the figures and source code, are available in the following GitHub repository : https://github.com/KingsleyTechie/Layerwise-Counterfactual-LLM-Alignment\u0026nbsp;\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\n\u003cli\u003eBai, Y., Kadavath, S., Kundu, S., Askell, A., Kernion, J., Jones, A., Chen, A., Goldie, A., Mirhoseini, A., McKinnon, C., Chen, J., Olsson, C., Marsh, J., Landau, J., Ndousse, K., Lukosuite, K., Sellitto, M., Elhage, N., Schiefer, N., ... Kaplan, J. (2022). Constitutional AI: Harmlessness from AI feedback. arXiv:2212.08073. https://doi.org/10.48550/arXiv.2212.08073 \u003c/li\u003e\n\u003cli\u003eBurns, C., Ye, H., Klein, D., \u0026amp; Steinhardt, J. (2022). Discovering latent knowledge in language models without supervision. arXiv:2212.03827. https://doi.org/10.48550/arXiv.2212.03827 \u003c/li\u003e\n\u003cli\u003eCarlsmith, J. (2023). Is power-seeking AI an existential risk? arXiv:2206.13353. https://doi.org/10.48550/arXiv.2206.13353 \u003c/li\u003e\n\u003cli\u003eChristiano, P. F., Leike, J., Brown, T. B., Martic, M., Legg, S., \u0026amp; Amodei, D. (2017). Deep reinforcement learning from human preferences. Advances in Neural Information Processing Systems, 30, 4299\u0026ndash;4307. https://doi.org/10.48550/arXiv.1706.03741 \u003c/li\u003e\n\u003cli\u003eClark, K., Khandelwal, U., Levy, O., \u0026amp; Manning, C. D. (2019). What does BERT look at? An analysis of BERT\u0026apos;s attention. Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, 276\u0026ndash;286. https://doi.org/10.18653/v1/W19-4828 \u003c/li\u003e\n\u003cli\u003eGanguli, D., Lovitt, L., Kernion, J., Askell, A., Bai, Y., Kadavath, S., Mann, B., Perez, E., Schiefer, N., Ndousse, K., Jones, A., Bowman, S., Chen, A., Conerly, T., DasSarma, N., Drain, D., Elhage, N., El-Showk, S., Fort, S., ... Kaplan, J. (2022). Red teaming language models to reduce harms: Methods, scaling behaviors, and lessons learned. arXiv:2209.07858. https://doi.org/10.48550/arXiv.2209.07858 \u003c/li\u003e\n\u003cli\u003eGeiger, A., Wu, Z., Lu, H., Rozner, J., Kreiss, E., Icard, T., Goodman, N. D., \u0026amp; Potts, C. (2023). Causal abstractions of neural networks. Advances in Neural Information Processing Systems, 36. https://doi.org/10.48550/arXiv.2301.04709 \u003c/li\u003e\n\u003cli\u003eHubinger, E., van Merwijk, C., Mikulik, V., Skalse, J., \u0026amp; Garrabrant, S. (2019). Risks from learned optimization in advanced machine learning systems. arXiv:1906.01820. https://doi.org/10.48550/arXiv.1906.01820 \u003c/li\u003e\n\u003cli\u003eMeng, K., Bau, D., Andonian, A., \u0026amp; Belinkov, Y. (2022). Locating and editing factual associations in GPT. Advances in Neural Information Processing Systems, 35, 17359\u0026ndash;17372. https://doi.org/10.48550/arXiv.2202.05262 \u003c/li\u003e\n\u003cli\u003eNgo, R., Chan, L., \u0026amp; Mindermann, S. (2023). The alignment problem from a deep learning perspective. arXiv:2209.00626. https://doi.org/10.48550/arXiv.2209.00626 \u003c/li\u003e\n\u003cli\u003eOlah, C., Cammarata, N., Schubert, L., Goh, G., Petrov, M., \u0026amp; Carter, S. (2020). Zoom in: An introduction to circuits. Distill, 5(3), e00024.001. https://doi.org/10.23915/distill.00024 \u003c/li\u003e\n\u003cli\u003eOuyang, L., Wu, J., Jiang, X., Almeida, D., Wainwright, C., Mishkin, P., Zhang, C., Agarwal, S., Slama, K., Ray, A., Schulman, J., Hilton, J., Kelton, F., Miller, L., Simens, M., Askell, A., Welinder, P., Christiano, P., Leike, J., \u0026amp; Lowe, R. (2022). Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35, 27730\u0026ndash;27744. https://doi.org/10.48550/arXiv.2203.02155 \u003c/li\u003e\n\u003cli\u003ePerez, E., Huang, S., Song, F., Cai, T., Ring, R., Aslanides, J., Glaese, A., McAleese, N., \u0026amp; Irving, G. (2022). Red teaming language models with language models. arXiv:2202.03286. https://doi.org/10.48550/arXiv.2202.03286 \u003c/li\u003e\n\u003cli\u003eTenney, I., Das, D., \u0026amp; Pavlick, E. (2019). BERT rediscovers the classical NLP pipeline. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, 4593\u0026ndash;4601. https://doi.org/10.18653/v1/P19-1452 \u003c/li\u003e\n\u003cli\u003eVig, J. (2019). A multiscale visualization of attention in the transformer model. Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, 37\u0026ndash;42. https://doi.org/10.18653/v1/P19-3007 \u003c/li\u003e\n\u003cli\u003eWang, K., Variengien, A., Conmy, A., Shlegeris, B., \u0026amp; Steinhardt, J. (2023). Interpretability in the wild: A circuit for indirect object identification in GPT-2 small. arXiv:2305.07759. https://doi.org/10.48550/arXiv.2305.07759 \u003c/li\u003e\n\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":true,"hideJournal":true,"highlight":"","institution":"Laskenta Technologies Limited","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Large language models, AI alignment, interpretability, counterfactual analysis, activation patching, transformer architectures, internal representations, safety diagnostics","lastPublishedDoi":"10.21203/rs.3.rs-8714712/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-8714712/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eLarge language model alignment remains fragile under distribution shift, jailbreak prompts, and latent goal misgeneralization, motivating the need for diagnostic tools that move beyond surface level behavior to internal representations. This paper investigates alignment via interpretability by introducing a layerwise counterfactual analysis framework that probes how targeted interventions on hidden states alter downstream model behavior. Using publicly available transformer based language models and open interpretability tooling, we perform controlled counterfactual substitutions and activation patching across layers to detect maladaptive behaviors that are not reliably exposed through prompt based evaluation alone. Our analysis demonstrates that specific intermediate layers encode decision critical features whose perturbation consistently induces alignment failures such as reward hacking tendencies, deceptive compliance, and instruction misgeneralization, even when input level behavior appears aligned. We further show that these internal signatures are stable across random seeds and model checkpoints, enabling reproducible detection of misalignment risks prior to deployment. The findings support the thesis that interpretability driven diagnostics can serve as an early warning mechanism for alignment failures and provide a principled foundation for integrating internal model transparency into safety evaluation pipelines.\u003c/p\u003e","manuscriptTitle":"Alignment Via Interpretability: Layerwise Counterfactuals To Detect Maladaptive Llm Behaviors","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2026-01-29 04:26:36","doi":"10.21203/rs.3.rs-8714712/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"2ebaabe4-3c99-4688-8619-ac5d173b08b4","owner":[],"postedDate":"January 29th, 2026","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[{"id":61855242,"name":"Artificial Intelligence and Machine Learning"}],"tags":[],"updatedAt":"2026-01-29T04:26:36+00:00","versionOfRecord":[],"versionCreatedAt":"2026-01-29 04:26:36","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-8714712","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-8714712","identity":"rs-8714712","version":["v1"]},"buildId":"XKTyCvWXoU3ODBz1xrDgd","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}

Text is read by the "Ask this paper" AI Q&A widget below. Extraction quality varies by source — PMC NXML preserves structure cleanly, OA-HTML may include some navigation residue, and OA-PDF can have broken hyphenation. The publisher copy (via DOI) is the canonical version.

My notes (saved in your browser only)

Ask this paper AI returns verbatim quotes from the full text · source: preprint-html

Answers must be backed by verbatim quotes from this paper's full text. Hallucinated quotes are dropped automatically; if no verbatim passage answers the question, we say so. How this works

Citation neighborhood (no data yet)

We don't have any in-corpus citations linked to this paper yet. This is a recent paper (2026) — citers typically take a year or two to land, and the OpenAlex reference graph may still be filling in.

Source provenance

europepmc
last seen: 2026-05-20T01:45:00.602351+00:00