Skip to content

Implanting non-triggerable backdoors in language models via cryptographic Transformer circuitsUnelicitable Backdoors in Language Models via Cryptographic Transformer Circuits

arXiv· arXiv:2406.02619· Andis Draguns, Andrew Gritsevskiy, Sumeet Ramesh Motwani, Charlie Rogers-Smith, Jeffrey Ladish, Christian Schroeder de WittContramont Research; IMCS UL; Cavendish Labs; University of California, Berkeley; University of Oxford; Palisade ResearchIndexed by this site · 25 days ago· Originally publishedSelected AttacksSelectedAttention40

Quick read

Attacks

Based on the paper PDF (AI-generated); refer to the original

The authors propose an unelicitable backdoor that compiles a cryptographic circuit into transformer weights; the authors claim that LAT cannot elicit the encrypted backdoor within 10^4 steps.

Threat modelThe attacker manually inserts compiled backdoor modules into an open-source language model, and the trigger and backdoor behavior can be set arbitrarily; even with full white-box access, the defender cannot trigger or observe the backdoor behavior by any polynomial-time method other than inputting the predetermined trigger (unelicitable). The victim system is the downstream user who downloads and uses the backdoored open-source model.

Questions
Supply chain backdoors in open-source language models can introduce dangerous behavior at deployment time and are difficult to detect. The authors argue that existing backdoors either have restricted triggers or can be discovered and mitigated by elicitation-based defenses such as red teaming, GCG, or LAT.
Methods
The authors use Tracr and a new language, Stravinsky, to compile a 3-SAT verifier and a digital locker (based on SHA-256) into transformer modules inserted into the model: the NP-complete backdoor triggers only when the input encodes a 3-SAT solution, and the encrypted backdoor implements the digital locker with f(x)=h(x)⊕K, so that only the trigger can release the payload.
Experiments and results
The authors use unbounded LAT to attack three constructions: the password-locked backdoor is elicited in just 8 steps, the NP-hard backdoor can be elicited only in the last four layers, and the encrypted backdoor cannot be elicited at all within 10^4 steps; after adding noise, the NP-hard backdoor is elicited in about 60% of runs, while the encrypted backdoor is still never elicited.
Limitations and future work
The authors point out that the backdoor can still be mitigated by noising the weights, supervised fine-tuning, heuristic structure detection, inference-time anomaly detection, and zero-knowledge proofs, and that it does not have full white-box undetectability; the experiments use only compiled small circuit models and a weakened hash, and were not validated on trained large models.
Experimental setuppassword-locked backdoor、NP-complete backdoor et al. · elicitation 所需的 adversarial training steps、LAT 达到的 loss 占最大可能 loss 的比例(1.0 表示成功引出)
Evaluated models
password-locked backdoorNP-complete backdoorencrypted backdoor
Metrics
elicitation 所需的 adversarial training stepsLAT 达到的 loss 占最大可能 loss 的比例(1.0 表示成功引出)
AI summaryand selection rationaleThe paper proposes a class of backdoors implanted into language models via cryptographic Transformer circuits; unless a preset trigger is input, the model's behavior does not change, and defenders cannot actively elicit the backdoor behavior. The authors use Tracr and their own Stravinsky language to compile a 3-SAT verification circuit and a SHA-256 hash into Transformer weights, constructing an NP-complete backdoor and a cryptographic backdoor respectively, and claim that the trigger and harmful payload cannot be recovered from the weights in polynomial time. Experiments show that latent-space adversarial training can elicit the cryptographic-lock backdoor within 8 steps and can also elicit the NP-complete backdoor, but completely fails on the cryptographic backdoor; the authors also open-sourced Stravinsky and synthetic models with different trigger difficulties for subsequent defense research.

The paper proposes a class of backdoors implanted into language models via cryptographic Transformer circuits; unless a preset trigger is input, the model's behavior does not change, and defenders cannot actively elicit the backdoor behavior. The authors use Tracr and their own Stravinsky language to compile a 3-SAT verification circuit and a SHA-256 hash into Transformer weights, constructing an NP-complete backdoor and a cryptographic backdoor respectively, and claim that the trigger and harmful payload cannot be recovered from the weights in polynomial time. Experiments show that latent-space adversarial training can elicit the cryptographic-lock backdoor within 8 steps and can also elicit the NP-complete backdoor, but completely fails on the cryptographic backdoor; the authors also open-sourced Stravinsky and synthetic models with different trigger difficulties for subsequent defense research.

Why it was selectedThe paper compiles backdoors into Transformer weights and explains that the cryptographic construction makes it difficult for defenders to actively trigger them even under white-box access, which can inform the boundaries of pre-deployment red teaming and formal verification.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    Construct a language model backdoor that a defender cannot elicit even with white-box access, questioning the effectiveness of pre-deployment detection strategies.

    Core question: Can a backdoor be inserted into a transformer language model such that a defender, even with full white-box access, cannot trigger or observe the backdoor behavior before deployment (unelicitable), thereby undermining elicitation-based pre-deployment safety evaluation.

    • Scenario and motivation: The authors note that there are already more than 250,000 open-weight models on HuggingFace, amplifying supply chain backdoor risk, and that HuggingFace recently experienced a high-profile model backdoor incident (Toulas, 2024).
    • Shortcomings of existing methods: The authors argue that AI safety strategies such as red teaming, eliciting latent knowledge (ELK), and formal verification all partly rely on eliciting model behavior, and will fail against unelicitable structures; the white-box undetectable construction of Goldwasser et al. (2022) is limited to the Random Fourier Features paradigm, and the survey by Anwar et al. (2024a) states that similar attacks have not yet been generally demonstrated on transformer models.
    • Core assumption: Under cryptographic assumptions such as P≠NP and SHA-2 preimage resistance, hard problems or digital locks can be compiled into transformer weights so that any polynomial-time elicitation technique fails; the authors state the accidental activation probability is approximately 2^-128.
    • What the paper proposes: Two hand-crafted unelicitable backdoor constructions (an NP-complete backdoor and an encrypted backdoor), a backdoor elicitation hardness scale, a set of open-source "model organisms" with different elicitation difficulties, and Stravinsky, a domain language for compiling programs into PyTorch transformers.
    • Threat model:
      • Goal: Plant a hidden backdoor in an open-source language model that produces attacker-specified arbitrary behavior only on predetermined trigger inputs.
      • Knowledge: The defender has full white-box access and can use automated techniques such as red teaming, GCG, and LAT.
      • Capability: The attacker can modify model weights and insert hand-compiled circuit modules; the defender cannot trigger the backdoor by polynomial-time methods.
      • Victim system: The downstream user system that downloads and deploys the backdoored open-source model.
  2. What related research exists?

    The related work covers four categories: post-training safety analysis, obfuscation and cryptography, compiled neural networks, and existing backdoor attacks and defenses.

    Post-training safety analysis

    • The red-teaming method of Perez et al. (2022a) probes the model with inputs to evaluate specific capabilities; Casper et al. (2024a) point out that black-box access alone is insufficient for rigorous auditing.
    • ELK of Burns et al. (2024a) aims to extract the world state inferred by the model from internal representations; the formal verification of Dalrymple et al. (2024a) aims to provide auditable safety proof certificates. The paper argues that these elicitation-dependent methods cannot cope with unelicitable backdoors.
    • The circuit identification of Wang et al. (2022) and the trojan probes of Hubinger et al. (2024) are interpretability-related techniques; Bereska and Gavves (2024) point out that they have limitations in settings or model scale.

    Obfuscation and cryptography

    • Barak et al. (2012) prove that black-box obfuscation of arbitrary programs is impossible, leaving restricted directions such as point function obfuscation (Canetti and Dakdouk, 2008) and indistinguishability obfuscation (Goldwasser and Rothblum, 2007).
    • Lynn et al. (2004) propose digital lockers: the hidden value string is output only given the correct key, with security proven in the random oracle model; Apon et al. (2022) give an improved version in the standard model. The encrypted backdoor in this paper is directly based on this primitive.
    • The information-theoretically secure steganography of Schroeder de Witt et al. (2022) is regarded by the paper as a potential path to achieving white-box undetectable backdoors.

    Compiling neural networks

    • RASP (Weiss et al., 2021) is a transformer programming language, and Tracr (Lindner et al., 2023) compiles RASP into runnable Jax-Haiku models; it is the implementation tool for the NP-complete backdoor in this paper.
    • Weng et al. (2024) use compiled networks to add explicit rules to language models; Moreno (2024) and Jain et al. (2023) use models containing known circuits to assist interpretability research; the residual stream compression of Moreno (2024) can make the weight distribution of a compiled transformer indistinguishable from that of a trained model, and this paper uses it as a candidate means of obfuscating the backdoor.

    Backdoor attacks and defenses

    • Goldwasser et al. (2022) propose a black-box undetectable backdoor based on digital signatures and a white-box undetectable backdoor based on Random Fourier Features; the handcrafted backdoor of Hong et al. (2022) lacks formal guarantees. Language model backdoors also include the knowledge editing of BadEdit (Li et al., 2024), the poisoning training of Huang et al. (2024), and the trigger word embedding updates of Yang et al. (2023).
    • Defenses include gradient trigger inversion (Wang et al., 2023), inter-layer activation comparison (Hossain and Oates, 2024), retraining (Zhu et al., 2022b), mode connectivity (Zhao et al., 2020), attribution analysis (Sun et al., 2022), fine-mixing (Zhang et al., 2022), etc.; the paper points out that trigger inversion is difficult to perform directly on autoregressive models.

    Baselines and evaluation methods: The baseline backdoor in the paper is a self-built password-locked construction; the methods evaluated as defenses are GCG (Zou et al., 2023) and LAT (Casper et al., 2024b), and the paper states that LAT is the current state-of-the-art in backdoor elicitation. No public benchmark datasets were used.

    Authors' positioning: Prior work achieved only general and black-box undetectable separately; the authors of this paper claim to give a backdoor construction on transformer models that is simultaneously general, robust, and unelicitable, and to point toward a path to full white-box undetectability.

  3. How does the paper address this problem?

    Compile a 3-SAT verifier and a SHA-256-based digital lock into transformer modules and insert them into the model, making both the trigger and the payload non-extractable.

    Overall approach: Use Tracr and a self-developed Stravinsky language to compile cryptographic functions directly into transformer weight modules, splice them with a normal language model, so that the backdoor activates only under a predetermined trigger, and neither the trigger nor the payload can be extracted in polynomial time.

    Module structure and splicing method

    • Three types of modules: The backdoor consists of a trigger module, a payload module, and a language modeling module; the compiled circuit guarantees that no similar input will accidentally trigger the backdoor.
    • Splicing method: Add several extra dimensions to the transformer residual stream; the backdoor modules use these dimensions to determine whether to trigger and to implement the backdoor behavior.
    • Obfuscation idea: The authors believe that residual stream compression (Moreno, 2024) could make the weight distribution of the compiled model indistinguishable from that of a trained model, but this paper only addresses the non-extractable construction itself, leaving obfuscation with formal guarantees for future work.

    NP-complete backdoor

    • Construction: Use Tracr to encode a 3-SAT instance as a trigger module; for input {0,1}^|T|, it outputs 1 only if the variable assignment satisfies the internal circuit, otherwise 0; the return value is multiplied by the harmful payload vector and added to the output only when triggered.
    • Security: Any NP problem can be reduced to 3-SAT (Karp, 1972), including average-case-hard LWE and integer factorization; assuming P≠NP, there is no efficient method to determine the set of activating inputs, which can defeat polynomial-time extraction over the input space (such as red teaming, GCG).
    • Limitations (stated by the authors): Trigger selection is restricted and may conflict with specificity; the payload stored directly in the model can be extracted by basic interpretability techniques; changing the trigger module output from 0 to 1 can activate the backdoor, so activation-space methods such as LAT can bypass solving 3-SAT.

    Cryptographic backdoor

    • Construction: First implement SHA-256 inside the transformer (Tracr is numerically unstable, hence the self-developed Stravinsky), then implement the digital lock function f(x) = h(x) ⊕ K, where K = h(T) ⊕ B; h is a hash function, T is the trigger, and B is the encoding of the harmful payload concatenated with 128 ones. Meaning: f outputs B only when the input equals T; the only things the attacker needs to hide are T and B.
    • Verification bits: The 128 ones are a security parameter; for random input, the probability that the output matches B is 2^-256, and the probability that the last 128 bits are all ones is 2^-128; the last 128 bits are multiplied together and then multiplied element-wise with the first 128 bits, zeroing out the output for non-trigger inputs.
    • Design details: Part of the trigger string T is a hardcoded random nonce, concatenated with the model input; this cryptographic primitive does not require T or B to be random or high-entropy (cf. Canetti et al., 2016, Section 2.2).
    • Properties (claimed by the authors): No easily perturbed bottleneck—the digital lock either releases the payload as a whole or outputs all zeros; any polynomial-time extraction method (including activation optimization) fails; the trigger and payload can be set arbitrarily and are non-extractable under white-box access.

    Baselines and tools

    • password-locked baseline: The trigger module computes the difference between the first |T| characters of the input and the trigger string, and decides the likelihood of the payload logit based on the difference; there is a usable gradient signal throughout the network, making it easy to extract with GCG-type methods.
    • Stravinsky: A domain-specific language compiled to PyTorch transformers; based on the "register" abstraction of Newhouse (2023), it implements operations such as rightshift, rightrotate, and, xor, and add using attention layers and MLP layers (Table 1 lists the instruction set); binary addition uses a fixed 32-round shift-carry iteration (Algorithm 1). Appendix A.1 gives SHA-256 implementation details, and the complete implementation has been open-sourced.
  4. What experiments did the paper conduct?

    Using unbounded LAT to attack three backdoors: the password-locked one is elicited in 8 steps, the NP-hard one fails only in the last four layers, and the encrypted backdoor cannot be elicited at all within 10^4 steps.

    Experimental setup

    • Subjects: Three hand-compiled backdoored transformers—the password-locked and NP-complete backdoors are compiled into TransformerLens PyTorch models with Tracr, and the encrypted backdoor is compiled with Stravinsky.
    • Hash weakening: Due to compute constraints, the encrypted backdoor experiments use a weakened hash (SHA-256 but with only 2 mixing steps instead of 64); the authors state that the simplified case is already unelicitable, so the loss is small.
    • Attack method: Unbounded latent adversarial training (LAT), applied only to the trigger module rather than the whole network; run on each layer to simulate a broad class of attacks, and LAT on the first layer can be likened to GCG input optimization.
    • Metrics: The number of adversarial training steps required to elicit the backdoor; in the noisy experiments, the y-axis is the ratio of the loss reached by LAT to the maximum possible loss, with 1.0 indicating successful elicitation.
    • Sample size: The noisy experiments use 34 independent runs per construction, reporting the mean and 95% confidence interval (Figure 4); the noiseless experiments do not report the number of repetitions.
    • Implementation details: LAT uses Stephen Casper's code, changed to unbounded perturbation, with all other hyperparameters kept at default; experiments are run on a Macbook Pro M2 (96GB memory) or an NVIDIA A100 80GB.

    Main results

    According to Figure 3 (steps required for LAT to elicit the backdoor in the noiseless setting):

    Backdoor constructionLayers elicitedResult
    password-lockedany layerelicited in 8 steps by directly optimizing the input embedding
    NP-hardfirst six layers fail, last four succeedattacks on the input layer and first six layers fail, attacks on the last four layers succeed
    encrypted (weakened hash)nonecompletely fails within 10^4 steps, loss does not rise
    • Authors' interpretation: The layer-wise results for the NP-hard backdoor match the circuit structure expectations—perturbations in the first six layers still need to pass the 3-SAT check, while the last four layers are after the candidate solution is confirmed and only need to flip a few bits (bottleneck see Figure 7).
    • Authors' interpretation: The results support the theoretical analysis in Section 4 and the hardness scale: password-locked is easily elicited by most red teaming methods, NP-hard resists input-space gradient attacks but not LAT, and the encrypted backdoor resists LAT.
    • Note: The numbers for the encrypted backdoor come from the weakened hash (2 mixing steps), not full SHA-256.

    Noisy circuit experiments

    • What was measured: Gaussian noise is added to each parameter of the trigger circuit (the maximum noise amount at which the circuit still correctly computes the activation function), and LAT is run on the first layer to simulate GCG-style elicitation.
    • Results: According to Figure 4, the noisy password-locked backdoor is elicited as quickly as in the noiseless case; the noisy NP-hard backdoor is elicited within 10000 steps in about 60% of runs (never happening in the noiseless case); the noisy encrypted backdoor is never elicited.
    • Authors' interpretation: Noise gives some constructions usable gradient flow, whereas encryption prevents noise from carrying useful gradient information, so the encrypted backdoor may be more resistant to elicitation than the NP-complete construction.

    Other ablations and analyses

    • hardness scale (Figure 5): The ordering given by the authors is—guessing the trigger/jailbreak fails against password-locked; adversarial training and GCG can elicit password-locked but fail against NP-complete; LAT and activation optimization can elicit NP-complete; the encrypted backdoor resists all polynomial-time methods.
    • Hardware and code: No other hyperparameter ablations; the paper does not report the LAT learning rate, settings other than the perturbation norm, or statistical significance tests.
  5. What are some points that can be further explored?

    The authors list five categories of means that can still mitigate backdoors and the lack of full white-box undetectability, and give several future directions.

    Limitations and future directions pointed out by the authors

    • Still mitigable (Section 6.2): The backdoor remains susceptible to the following: 1) adding noise to the model weights to disrupt the backdoor circuit; 2) supervised fine-tuning; 3) heuristic detection, such as rejecting anomalous structures of compiled neural networks; 4) inference-time anomaly detection; 5) using zero-knowledge proofs that the weights come from a specified training process.
    • Lack of full white-box undetectability (Section 6.2): The construction does not have the property that "no polynomial-time heuristic method can distinguish the backdoored model from a clean model at a level better than random"; the authors believe this strong concept may be difficult to realize on language models, because it requires formally defining the distribution of representative trained models.
    • Rebuttals and countermeasures to mitigations (Section 6.2): The authors claim that some mitigations can be directly countered by modifications, such as error-correcting circuits, ReLUs that block gradient flow, encrypting the key circuit together with the backdoor, and using residual stream compression to disguise the weight distribution, and point out that this requires more advanced mitigation methods.
    • Future directions (Section 7): Study backdoors that are difficult or even statistically impossible to detect (e.g., bounding weight distribution differences with total variation distance); study methods to prevent the backdoor circuit from being disrupted by pruning and other means; study whether similar unelicitable structures can arise naturally through end-to-end training or be injected via data poisoning; study context-aware backdoors that do not rely on string matching and can obfuscate more complex reasoning.

    Scope of experimental coverage

    • The subjects tested are three hand-compiled small-scale transformer circuits (password-locked, NP-complete, encrypted); no experiments were conducted on trained language models.
    • The encrypted backdoor experiment uses a weakened version of the hash (2 mixing steps instead of the 64 steps of SHA-256), because running LAT on the full SHA-256 is too computationally expensive (Section 5.2).
    • The defense evaluation covers only LAT (the first-layer LAT is analogous to GCG); real GCG, red-teaming, or formal verification tools were not actually tested.
    • The noising experiment has 34 runs per construction; the paper does not report the number of repetitions for the no-noise experiment.
    • The paper does not report hyperparameter values such as the LAT learning rate (it only states that defaults are kept except for unbounded perturbations), nor does it report statistical significance tests.
  6. Summarize the main content of the paper

    Compiling cryptographic circuits into transformer weights yields an unelicitable backdoor, and experiments show that LAT completely fails on the encrypted backdoor.

    An attack paper on language model supply chain backdoors: the authors construct a class of backdoors (unelicitable backdoor) that a defender cannot trigger or observe by polynomial-time methods even with full white-box access, and on this basis question elicitation-based pre-deployment safety strategies such as red-teaming, ELK, and formal verification.

    • Problem to solve: The proliferation of open-source models raises the risk of downstream backdoor attacks; previously, general and undetectable backdoor constructions had not been realized on transformers, and the authors aim to fill this gap.
    • Method highlights: Use Tracr to compile a 3-SAT verifier into a trigger module to obtain the NP-complete backdoor; implement SHA-256 inside the transformer with the self-developed Stravinsky language, and construct the digital locker encrypted backdoor according to f(x)=h(x)⊕K (K=h(T)⊕B), so that only the trigger can release the payload, with a random input-output match probability of 2^-256 and a false trigger probability of 2^-128.
    • Result one: Unbounded LAT is effective against the password-locked baseline at any layer, and directly optimizing the input embedding elicits it in just 8 steps (Figure 3).
    • Result two: The NP-hard backdoor resists LAT in the first six layers and falls in the last four layers, consistent with the authors' analysis of the circuit bottleneck.
    • Result three: The encrypted backdoor (weakened hash, 2 mixing steps) cannot be elicited by LAT at all within 10^4 steps; after adding noise, the NP-hard backdoor is elicited in about 60% of runs, while the encrypted backdoor is still never elicited (34 runs, Figure 4).
    • Authors' conclusion: The authors claim that this constitutes a meaningful level of elicitation difficulty, and that backdoors may be harder to defend against than commonly assumed; at the same time, they acknowledge that the construction can still be mitigated by noising, fine-tuning, heuristic detection, inference-time anomaly detection, and zero-knowledge proofs, and that it does not have full white-box undetectability, with related improvements left for future work.
Read originalarxiv.org