ContractLens examines the source of an EVM-compatible token contract before a suspicious transfer has to occur. Its classification signal does not come from asking a model to write an audit report: the authors run code through a frozen pretrained language model, extract internal activations, and fit a separate logistic-regression classifier to selected…
Inspect the ClaimsCase · DiggingBeagle record
ContractLens finds useful internal model signals for malicious smart-contract screening
An October 4, 2026 preprint reports that logistic regression over selected feed-forward neuron activations predicts annotated token-contract capabilities. The highest main-table macro accuracy is 92.41% across ten controlled intent tasks; held-out-intent, neuron-masking and temporal tests offer narrower checks, while the underlying labels do not prove actual token fraud or live detection performance.
Controlled defensive experiments on pre-execution source-code classification for BNB Smart Chain contracts using internal activations of frozen Qwen3-8B, Qwen2.5-Coder-7B and the manuscript's CodeGemma-family backbone. The 32,141-contract main corpus uses ten code-intent labels; held-out-intent, small-decoder-training and post-backbone-release evaluations have distinct filtered populations. Classification is not an incident report, confirmation of fraud, an exploit witness, a production alert rate or a loss estimate.
Assessment profile
Assessment method- Setting
- evaluation
- Exploitation
- not established
- Evidence
- Grade C
- Remediation
- not applicable
- AI role
- WITH AI
Basis and provenance
An original dated preprint was directly inspected and its dataset lineage checked against the public maintainer dataset card. Results are author-reported controlled evaluations with some hold-out and masking controls; no independent reproduction or prospective alert study was established. This is not an exploitation report and documents no victims or monetary loss, so impact remains null rather than a guessed severity. The paper describes a defensive research method, not a remediated product vulnerability. Evidence grade C reflects a directly inspectable empirical primary source without independent reproduced outcomes.
Assessed Oct 9, 2026 using diggingbeagle.assessment/1.
Evidence basis: CLM-CONTRACTLENS-DATASET · CLM-CONTRACTLENS-MAIN-METRICS · CLM-CONTRACTLENS-HELDOUT · CLM-CONTRACTLENS-ABLATION-METRICS · CLM-CONTRACTLENS-TEMPORAL-ATTRITION · ContractLens: Latent Security Knowledge for Malicious Smart Contract Detection · Smart Contract Intent & Vulnerability Dataset
At a glance
ContractLens suggests one intermediate validation signal for auditing token contracts: discriminative, intervention-tested model activations may prioritize suspicious privileged minting or transfer restrictions before on-chain harm occurs. This requires a frozen but still computationally substantial model, label-trained neuron localization and classifier…
Read the implicationsThe ContractLens source paper was inspected directly, but no independently rerun full-model benchmark or verified public implementation of its neuron-selection and evaluation stack was established in this step. The original Web3 Software Engineering Lab dataset card is accessible, but neither the paper nor the card independently validates whether every fee,…
Limits and uncertaintyFull account
ContractLens examines the source of an EVM-compatible token contract before a suspicious transfer has to occur. Its classification signal does not come from asking a model to write an audit report: the authors run code through a frozen pretrained language model, extract internal activations, and fit a separate logistic-regression classifier to selected feed-forward units. The paper, submitted on October 4, 2026 by Shuyi Miao and six coauthors, describes a controlled defensive experiment rather than a deployed scam-blocking product.
The pipeline has two selection stages. First, probes identify transformer layers that distinguish annotated positives from negatives. The authors remove the code responsible for a suspicious feature and compare its change to similarly sized nonsemantic edits, then check whether a layer stays stable when identifiers, comments or formatting change without altering the targeted behavior. Only layers satisfying separability, response to the removed logic and surface stability survive. Second, the method scores MLP units by class-mean activation contrast, their linear-probe weights and relative sensitivity to logic removal versus cosmetic changes. A knee-point cutoff selects the units, called malicious contract-discriminative units (MCDUs). The backbone weights remain frozen, but both selection and decoding still require labeled examples and computation.
What do the labels actually mean? The study reports 32,141 filtered BSC contract sources: 21,166 annotated with at least one of ten target intents and 10,975 designated benign. Its underlying intent and vulnerability dataset covers more than 90,000 Ethereum and BSC contracts and explicitly includes Reflection, Reward, Rebase and Mint as token capabilities, alongside blacklists, honeypots and trading restrictions. A minting function or reflection mechanism can be part of ordinary token design; calling every code-labeled positive a demonstrated scam would be incorrect. The paper itself says the labels represent possible malicious capabilities, not proven exploitation. ContractLens partitions matching creator or source-code groups together, reducing one simple form of leakage, although the precise data lineage and label validity still require independent audit.
The main result on Qwen2.5-Coder-7B is 92.41% mean accuracy and 96.24% mean AUROC across ten separate one-intent-versus-benign tests; Qwen3-8B reports 91.21% mean accuracy and the manuscript's CodeGemma-family model reports 90.94%. These are author-computed macro averages over controlled tasks, not measured precision for an unselected stream of token launches. The two evaluation styles differ: in a leave-one-intent-out experiment on five held-out categories, ContractLens scores 73.50% mean accuracy on balanced sets, against the highest competing mean accuracy of 66.08%. That experiment demonstrates some transfer across the authors' known label taxonomy, not detection of arbitrary unforeseen attack strategies.
The neuron intervention gives a narrower but useful mechanism check. The authors train a full-activation linear probe, then mask the identified units and matched controls. On Qwen3-8B, selected-unit masking moves accuracy from 91.52% to 83.04%, while randomly selected units have no measured accuracy effect and activation-matched nonselected units change accuracy by only 0.25 point. However, AUROC for the selected-neuron intervention falls only from 95.02% to 94.17%, a distinction between accuracy at the experiment's decision rule and overall ranking quality. It supports a task-specific contribution by these units but does not imply that an individual neuron has a stable human-readable meaning, or that removing it erases the model's knowledge of a security problem.
The temporal test should not be described as a live deployment evaluation. The source collection begins with 14,671 BSC token addresses from March 2023 to June 2025. The cited upstream dataset reduces this to 1,495 representative tokens and 1,201 labeled tokens, of which 898 are called scams and 303 benign. ContractLens then imposes a post-Gemma-release deployment filter and evaluates honeypot, blacklist/whitelist and transfer-restriction classes, reporting 77.50% mean accuracy and 84.13% AUROC. Neither the 14,671 nor the 1,201 is stated to be the final denominator for these tests; the final per-class sample sizes are not provided in the passages inspected. The result is therefore suggestive of transfer to later-dated contracts, not a prospective field false-positive measurement.
An additional data-efficiency experiment holds the selected MCDUs fixed and trains only the decoding classifier with increasingly many balanced labels. With 32 labeled examples, the paper reports 85.03% average AUROC across seven intents, improving with more labels. This is operationally relevant because the expensive selection stage could be reused within a specified backbone and task, but it is not proof that the entire pipeline can identify its critical neurons from 32 labels or run as a cheap real-time API. The study uses 2,048-token windows with 512-token overlap for long code and reports one V100 32 GB GPU for probing and classifier training; it does not measure the full data acquisition, source verification and human-triage pipeline.
The Lucky Shiba example makes the possible abuse concrete. A privileged caller can decide which holders are exempt from a delegated-transfer counter, while nonexempt accounts can be blocked on subsequent delegated transfers. Another privileged function overwrites a balance without adjusting total supply or emitting a Transfer event. ContractLens assigns 95.68% predicted probability to the dataset's Mint label on that code, whereas several compared classifiers score it below the paper's decision threshold. This illustrates how separated pieces of contract logic jointly matter, but the paper does not document a transaction loss, an actual victim, or intervention on a running scam.
The lineage also matters. Earlier PyPI neuron-probing research localized malware-related signals in three instruction-tuned models and applied interventions, but it did not evaluate EVM contracts. The DG-VDT dossier investigates a different defensive boundary: classification and address traceability after EVM execution traces have been generated, rather than source-capability classification before execution. Neither work independently reproduces ContractLens.
For a security reviewer, the defensible use would be to flag code for deterministic inspection, simulation or owner-privilege review, with a reproducible source snapshot and calibrated thresholds. A high classifier score cannot determine whether a capability is intentionally abused; conversely, a low score cannot certify safety across unmodeled proxy patterns, owner upgrades or novel evasion. Release-quality evidence would need reproducible checkpoints, published end-to-end feature extraction, audited annotation criteria, exact post-filter test denominators, and prospective error rates on realistic prevalence. Until then, ContractLens demonstrates a promising probe-based research method, not reliable fraud adjudication.
Timeline
- Oct 4, 2026Event type unspecified
ContractLens preprint submitted to arXiv
The research framework, dataset and ablation results become publicly documented in arXiv:2610.04992v1.
- Oct 4, 2026disclosure
Public disclosure
Claims & evidence
CLM-CONTRACTLENS-METHODContractLens first locates model layers with separability, counterfactual malicious-logic sensitivity and surface-edit stability; it then ranks feed-forward units by activation contrast, probe weight and logic specificity, before training a separate logistic-regression classifier on selected activations while keeping the pretrained language model frozen.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Sections 3.1-3.2, Equations 1-13 and Figure 2, including the MCDU selection and detection paragraphs
CLM-CONTRACTLENS-ORIGINMiao and six coauthors from Beihang University, Beijing University of Posts and Telecommunications, and the National University of Singapore submitted ContractLens as arXiv:2610.04992v1 on October 4, 2026; the record is a preprint, not an independently reproduced evaluation.supported
Basis: direct observation
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
arXiv v1 header, author affiliations and submission date, before Section 1
CLM-CONTRACTLENS-DATASETThe authors report a filtered BNB Smart Chain set of 32,141 contracts with 21,166 contracts labeled positive for at least one of ten risky token-code intents and 10,975 labeled benign. The intent labels identify code-level capabilities rather than established malicious use or on-chain victimization. Creator- or source-identical contracts are assigned to the same 64/16/20 training, validation or test group.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.1 Implementation Details, Dataset paragraph: 32,141 total, 21,166 positive, 10,975 benign, ten intent labels, group-split procedure
- supportsSmart Contract Intent & Vulnerability Datasetprimary disclosure
Dataset card, Smart Contract Intent Annotations, label definitions and Intended Use
CLM-CONTRACTLENS-HELDOUTIn CodeGemma-based leave-one-intent-out tests on five held-out malicious mechanisms, the authors report 73.50% mean accuracy and 73.51% mean F1 for ContractLens; the strongest competing mean accuracy shown is 66.08% for SCMDetector. Each held-out test set is balanced between malicious and benign samples.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.2 Evaluation on Unseen Malicious Intents and Table 2, including test-set balance and five held-out intents
CLM-CONTRACTLENS-ABLATIONIn the Qwen3-8B functional masking test, zeroing the identified discriminative units reduced a full-activation linear probe's accuracy from 91.52% to 83.04%, an 8.48-percentage-point loss; masking random neurons produced no reduction, and masking activation-matched nonselected neurons reduced accuracy by 0.25 point.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.3 Neurons Validation and Functional Specificity; Table 3 Qwen3-8B masking rows and control definitions
CLM-CONTRACTLENS-TEMPORALIn a separate evaluation of three scam-related token mechanisms drawn from BSC token data originally collected from March 2023 through June 2025 and filtered to deployments after the backbone model's public release, the authors report 77.50% average accuracy and 84.13% AUROC. The experiment is not a prospective measurement of 2026 live-screening performance.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.4 Detection of Newly Deployed Malicious Smart Contracts, temporal dataset provenance, time filter and Table 4
CLM-CONTRACTLENS-PRIOR-WORKAn earlier July 2026 study by Dao and collaborators examined neuron-level malicious-code detection on 1,500 malicious and 1,500 benign PyPI packages, including interventions in three language models. ContractLens therefore extends a related interpretability approach to EVM contract intent detection rather than introducing the first security-neuron probing experiment.supported
Basis: inference
- supportsWhich Neurons Detect Malicious Code? A Probing Study of LLM Security Knowledgeprimary disclosure
arXiv submission date and Abstract; Section 2 dataset construction and neuron attribution
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 2 Related Work paragraph citing Dao et al. (2026) on malicious Python package neuron localization
CLM-CONTRACTLENS-CODE-EXAMPLEThe paper's Lucky Shiba case study describes an owner-controlled allowlist, a delegated-transfer counter that can block later transfers, and an owner-accessible mint function that overwrites account balances without adjusting total supply or emitting a Transfer event. ContractLens assigns 95.68% predicted probability to the dataset's malicious Mint label for that sample; the example does not document victim losses.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Appendix E Case Study: A Real Honeypot-Mint Token, Table 7 and paragraphs describing Lucky Shiba code and classifier output
CLM-CONTRACTLENS-MAIN-METRICSFor Qwen2.5-Coder-7B, ContractLens reports 92.41% accuracy and 96.24% AUROC averaged across ten one-versus-benign intent tasks; the main study also reports 91.21% accuracy on Qwen3-8B and 90.94% on the named CodeGemma backbone. These are author-run benchmark averages, not field precision or independently confirmed interception rates.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Table 1 and Section 4.2 Quantitative Results, with Section 4.1 explaining per-intent binary tasks and splits
CLM-CONTRACTLENS-NOT-UNIVERSALThe ContractLens authors explicitly caution that their identified signals do not establish a universal detector of arbitrary future malicious behavior and remain limited by the security knowledge of the underlying pretrained backbone. Their experiments use code-intent labels and controlled held-out settings rather than independent validation of real-world exploitation outcomes.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Appendix F final discussion on generalization limits, read with Section 4.1 dataset labels and Sections 4.2-4.4 evaluation settings
CLM-CONTRACTLENS-DATASET-LABELSThe underlying Web3 Software Engineering Lab dataset defines Reflection as token-tax redistribution to holders, Reward as distributions intended to incentivize participation, Rebase as algorithmic supply adjustments, and Mint as token creation; it also defines features such as blacklists, sell limits and trading controls. These are categorized capabilities, so a model hit on an annotated intent is not by itself a finding of fraud, loss, or exploitable vulnerability.supported
Basis: inference
- supportsSmart Contract Intent & Vulnerability Datasetprimary disclosure
Dataset card, Smart Contract Intent Annotations table: Reflection, Reward, Rebase, Mint, Blacklist, MaxSell and DisableTrading
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.1 Dataset paragraph, which defines malicious intent as code-level capability rather than confirmed exploitation
CLM-CONTRACTLENS-ABLATION-METRICSMasking selected neurons on Qwen3-8B changes the full-activation linear probe from 91.52% to 83.04% accuracy, an 8.48-point drop, but changes AUROC from 95.02% to 94.17%, a 0.85-point drop. The intervention therefore shows a larger effect on classification accuracy than on ranking discrimination under the specific test; it does not establish that all security knowledge has been removed from the backbone.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.3 Table 3, Qwen3-8B unmasked and Masked MCDUs rows; Appendix A.2 final note on the non-monotonicity of masking effects
CLM-CONTRACTLENS-FEWSHOT-BOUNDARYWith a previously identified MCDU set held fixed on the CodeGemma-family backbone, the paper reports 85.03% average AUROC across seven intents when the separate logistic-regression classifier receives 32 balanced labeled contracts; larger sample sizes increase AUROC to 94.97% in the displayed experiment. This is low-data classifier fitting after neuron localization, not an end-to-end detector built from only 32 labeled examples.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.4 Robustness to Training-Data Size and Figure 6: fixed MCDUs, seven intents, 32 labeled examples, AUROC series
CLM-CONTRACTLENS-INPUT-CONSTRAINTSThe authors process contracts with a maximum window of 2,048 tokens, 512-token sliding-window overlap for longer files and mean pooling of non-padding token embeddings. They report conducting model probing and lightweight-classifier training with one NVIDIA Tesla V100 GPU with 32 GB of memory; neither that hardware statement nor the appendix efficiency comparison establishes an independently measured production end-to-end audit time.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.1 Implementation Details, Hyperparameters paragraph: windows, pooling and one V100 32GB
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Appendix C Efficiency and Computational Cost Analysis, Figure 7 discussion comparing ContractLens with a last-layer probe
CLM-CONTRACTLENS-TEMPORAL-ATTRITIONThe temporal comparison derives from 14,671 BSC token addresses collected between March 18, 2023 and June 15, 2025; after deduplication and activity filtering, the cited source dataset comprises 1,495 tokens, and its upstream study labels 1,201 of them (898 scams, 303 benign). ContractLens additionally filters deployments to after Gemma-7B became public and tests three mechanisms. The paper does not state the per-mechanism denominators remaining after these filters, so 1,201 is not a supported size for its final temporal test.supported
Basis: reported finding
- supportsContractLens: Latent Security Knowledge for Malicious Smart Contract Detectionprimary disclosure
Section 4.4 Detection of Newly Deployed Malicious Smart Contracts, two paragraphs before Table 4: 14,671 addresses, 1,495 filtered tokens, 1,201 labelled, 898 scam, 303 benign, release-time restriction
Implications
ContractLens suggests one intermediate validation signal for auditing token contracts: discriminative, intervention-tested model activations may prioritize suspicious privileged minting or transfer restrictions before on-chain harm occurs. This requires a frozen but still computationally substantial model, label-trained neuron localization and classifier fitting, and the study's results depend on the supplied taxonomy. Because the source dataset records token capabilities that can also be used legitimately, a useful real-world pipeline must distinguish potentially abusive authority from actual misuse using program analysis, transaction simulation and reviewer judgment. The smaller AUROC change under neuron masking also warns against equating a probe accuracy drop with complete removal of a model's security knowledge. These findings complement, rather than supersede, post-execution trace methods such as DG-VDT.
Controls and mitigations
- Treat a ContractLens output as a queueing signal for human source review or sandboxed simulation. Check the actual privileged paths before calling a token a honeypot, and do not convert an intent label into a fraud verdict.
- For each alert, preserve exact source code and compilation context, model and tokenizer checkpoint, selected layers and neuron IDs, pooling/window configuration, classifier weights and alert threshold so the classification can be replayed.
- Hold out shared creators, duplicated templates and time-adjacent contract families while evaluating. Report class-specific precision, recall and calibration under the expected real-world prevalence rather than repeating macro accuracy as a field detection rate.
- Test behavior-preserving refactors and hostile evasion separately, including proxies, upgradeable roles, delegatecall paths and fee/transfer restrictions reachable only through specific state; these tests address failure modes beyond the paper's renamed-variable and comment controls.
- For action that would block trading or accuse a deployer, require independent contract-state or trace-level evidence. A second, independent verifier may establish whether flagged logic is reachable, but does not by itself establish whether abuse or losses occurred.
Unknowns and contradictions
- The ContractLens source paper was inspected directly, but no independently rerun full-model benchmark or verified public implementation of its neuron-selection and evaluation stack was established in this step.
- The original Web3 Software Engineering Lab dataset card is accessible, but neither the paper nor the card independently validates whether every fee, rebase, reward, mint or trading-control label denotes malicious operator conduct.
- The temporal source dataset contains 1,201 labeled tokens before the paper's post-backbone-release and mechanism-specific filters. The paper does not disclose exact final class denominators or prospective 2026 prevalence.
- The manuscript uses the name CodeGemma-2.5-7B, whereas its references cite CodeGemma and Gemma sources; the precise checkpoint/revision needs confirmation. Appendix C mentions four backbones while the main results specify three.
- The few-label AUROC test reuses a previously selected set of neurons, so full-pipeline performance and cost when both neuron selection and classifier training are label-starved remain unknown.
- The model's susceptibility to proxy upgrade patterns, adversarially obfuscated logic, unseen execution-dependent behavior and code outside the reported ten target intents is not independently measured.
- No user losses, production alerts, intervention outcomes, or field false-positive/false-negative rates are established by the controlled study.
- An accuracy decline under neuron masking does not establish unique symbolic meaning for the masked neurons; the substantially smaller AUROC decline merits an explicit threshold and calibration analysis.
Sources and citation
Material revision history
- Oct 8, 2026 · Published version · first publication · revision 105