---
title: "CASN:Class-Aware Score Network for Textual Adversarial"
description: "CASN detects adversarial text by tracking how classifier features change during denoising, with class labels guiding the training."
canonical: "https://research.elamur.ai/free/en/papers/bao-2023-casn-class-aware-score-network/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/bao-2023-casn-class-aware-score-network/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / CASN:Class-Aware Score Network for Textual Adversarial Detection

# CASN:Class-Aware Score Network for Textual Adversarial Detection

Paper · 2023 · Rong Bao, Rui Zheng, Liang Ding et al.

**Authors:** [Rong Bao](https://md.research.elamur.ai/free/en/authors/rong-bao/), [Rui Zheng](https://md.research.elamur.ai/free/en/authors/rui-zheng/), [Liang Ding](https://md.research.elamur.ai/free/en/authors/liang-ding/), [Qi Zhang](https://md.research.elamur.ai/free/en/authors/qi-zhang/) and [Dacheng Tao](https://md.research.elamur.ai/free/en/authors/dacheng-tao/) · **Year:** 2023 · **Venue:** Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Cited by **3** papers in our library of more than 163,000 papers whose bibliographies we read · Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2023.acl-long.40/)
- [PDF](https://aclanthology.org/2023.acl-long.40.pdf)
- [DOI 10.18653/v1/2023.acl-long.40](https://doi.org/10.18653/v1/2023.acl-long.40)

## Summary

A text classifier can change its answer after an edit that leaves the apparent meaning of a sentence intact. Detecting such an input is particularly difficult when the edited sentence still looks ordinary to the classifier’s encoder. A detector that asks how common the resulting features are may give clean and edited inputs similar scores. The Class-Aware Score Network, or CASN, approaches the problem by asking what happens to those features during denoising. The paper develops this idea for [text classification](https://md.research.elamur.ai/free/en/concepts/text-classification/), where a system assigns a category such as a sentiment or a news topic to a piece of text.

CASN learns from clean text. The authors first train a classifier and then freeze its encoder, the part that turns text into numerical features. They add Gaussian noise to those features at several strengths and train a separate network to estimate the direction in which the probability density rises. They also use the classification labels during training. A clean representation and a lightly perturbed version of itself form a positive pair, while representations from other classes supply negative comparisons. The purpose is to retain class distinctions in the learned directions. When a new input arrives, the detector needs only its features and can proceed without knowing its correct class.

At detection time, CASN repeatedly updates the input’s features using the learned directions and random noise. It compares the representation after each update with the starting representation and adds the similarities across the trajectory. Features that drift farther tend to receive a lower cumulative similarity. A threshold turns this measurement into a detection decision. The classifier can separately read the final features to see whether denoising has corrected its prediction, so the authors can test detection and recovery as distinct outcomes.

The evaluation covers SST-2, IMDB and AGNEWS with BERT and RoBERTa classifiers. The paper reports an average gain of +15.2 in detection F1 over previous leading methods. In the main BERT evaluation, which counts adversarial inputs whether or not they changed the classifier’s answer, CASN reaches 80.8 F1 on SST-2 under the stricter TextFooler-adj benchmark, compared with 72.3 for robust density estimation. Removing the label-informed training loss sharply reduces detection F1 on all the datasets in the ablation. The denoising trajectory can also reveal adversarial inputs whose original classifications remain difficult to recover. Repeated updates make inference slow, and transferring the trained detector between sentiment and news data gives much weaker results than training it for the target domain.

## Deep dive: CASN:Class-Aware Score Network for Textual Adversarial Detection

CASN detects adversarial text by tracking how classifier features change during denoising, with class labels guiding the training. · about 37 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### When an edited input still looks ordinary

The adversarial examples considered in the paper are edited versions of ordinary text. An edit is meant to preserve the meaning that a person would assign while inducing a classifier to give a different answer. For a sentiment task, the intended situation is a review whose attitude remains recognizable to its reader even though the classifier changes its prediction. That goal creates a demanding test for a detector. If the edit introduces a plainly unrelated word or a broken sentence, superficial clues may be enough to flag it. When the edit fits its context, the detector has to rely on finer evidence. The paper distinguishes this goal of meaning preservation from the behavior of particular benchmark examples, which can vary in how well they meet it.

Previous research cited by the authors treats text edits at several scales. A character-level method changes parts of words. A word-level method changes individual lexical choices. Sentence-level methods can produce alternative phrasings, and other approaches combine scales. Insertions, removals and substitutions are possible across these settings. This taxonomy matters because a detection rule can depend on artifacts specific to one sort of edit. A rule based on unusual vocabulary, for instance, has a different source of evidence from a rule based on how an entire sentence is represented.

The authors distinguish changing a classifier’s training from putting a detector alongside it. Adversarial training, discussed in work such as [Towards Deep Learning Models Resistant to Adversarial Attacks](https://md.research.elamur.ai/free/en/papers/madry-2017-towards-deep-learning-models-resistant/), aims to improve the classifier’s predictions under perturbation. The paper describes a possible cost to ordinary classification accuracy and notes that robustness claims can depend on the allowed perturbations. A detection layer has a different task. It assigns suspicious inputs to a separate processing route and allows the original classification procedure to handle inputs judged clean. The routing decision introduces its own errors and can be studied independently of whether that separate route eventually recovers the right label.

A major source of evidence in earlier detectors is the geometry of a classifier’s internal features. These are vectors computed from text before the final category decision. The clean texts occupy some regions of this feature space more frequently than others. The paper uses the term *manifold* for the structured, comparatively low-dimensional region along which those representations tend to lie. The idea can be understood by imagining a narrow band in a space with many available directions. Two representations can be close in overall distance even if one lies along the band and the other is displaced across it. The position of either representation alone may give weak evidence when the band is estimated from finite data.

Density-based detection uses the estimated probability density of clean features as its point of comparison. If a test example lies where the detector expects few clean examples, it is more readily flagged. The motivating difficulty for CASN is that a harmful edit may produce features near those of its source sentence. The paper draws on earlier work suggesting that adversarial features can be both close to clean features and displaced in directions roughly perpendicular to the clean manifold. Thus proximity is compatible with a local direction of change that differs from the ordinary variation within the task. A density estimate may blur those nearby points together, particularly when it describes each class or the full dataset through a relatively simple distribution.

This argument concerns the encoder’s features. Two strings that look alike to a person can still map differently in feature space. Conversely, a change in that space can reflect properties of the encoder and its classification objective as well as properties of the sentence. CASN treats the geometry as empirical evidence. The research question is whether the response to a learned sequence of feature updates separates clean and adversarial inputs more effectively than a confidence measurement taken at the original point.

#### What earlier detectors measured

The paper describes several ways to look for suspicious text. DISP, a perturbation discrimination method, looks for words it judges to have been altered and seeks to block the effect by substituting alternatives. Its evidence is local to particular words. FGWS, or frequency-guided word substitution, uses the observation that an edit can introduce a less frequent term. It uses word frequency to guide substitutions and can use the resulting text to recalibrate the classification. Both methods tie the decision to a property of the visible text and to a procedure for changing it.

Methods based on features can find evidence even when a particular word is hard to isolate. MDRE uses learned representations and adapts local intrinsic dimensionality, a way of characterizing how a point’s neighborhood occupies space. RDE, short for robust density estimation, fits a multivariate Gaussian description to clean features and flags inputs that lie in low-density regions. A multivariate Gaussian describes variation in several coordinates together. Its covariance captures directions in which the features vary jointly. The Mahalanobis distance baseline, abbreviated MD, also uses Gaussian feature distributions, organized by class. Its distance uses the class distribution’s covariance to distinguish ordinary variation from unusual displacement.

The paper also draws on work on score-based generation. [Generative Modeling by Estimating Gradients of the Data Distribution](https://md.research.elamur.ai/free/en/papers/song-2019-generative-modeling-estimating-gradients-data/) supplied the approach of learning directions at several noise strengths. [Score-Based Generative Modeling through Stochastic Differential Equations](https://md.research.elamur.ai/free/en/papers/song-2020-score-based-generative-modeling-through/) supplied the perspective that links those directions to a continuous process for adding and reversing noise. Those lines of work give the authors a way to replace a single density estimate with a procedure whose evolving states can be measured. They also connect CASN to earlier purification studies, where denoising aims to remove the effect of a perturbation before a new classification is made.

Purification gives a natural detector when it changes the prediction back. That decision depends on the final representation moving far enough in a useful direction for the classifier to assign another label. CASN instead uses the path to collect evidence even if the predicted class stays the same. In this setting, *score* has two meanings. The score network predicts a vector giving a direction in feature space. The detector combines similarity measurements into a scalar used to judge an input. Learning the former makes it possible to calculate the latter.

### The method, step by step

#### From text to features and back toward clean data

The authors begin with ordinary supervised classification. They adapt a pretrained encoder and fit a linear classifier on top of it. The encoder produces hidden representations, which are numerical descriptions of the input at token positions. The linear classifier uses the features for the task prediction. The authors then keep the encoder fixed while fitting CASN on representations of clean text. Keeping it fixed gives the detector a stable feature space. The meaning of a direction learned early in detector training does not change because the encoder later learns a different representation of the same sentence.

Gaussian corruption creates the training inputs for the score network. Starting with a clean representation, the authors make a noisy version and retain both the original representation and the strength of the corruption. The network sees the perturbed features and a noise-level input. It learns a direction from targets that can be calculated from the known Gaussian corruption. Training across a schedule of noise strengths gives it experience with points at varying degrees of displacement. The synthetic corruption serves to teach the geometry of clean features. It does not need to imitate the wording of an adversarial input.

Class supervision is added during this stage. A small perturbation of a clean example should still belong to the same local class structure as that example. Features with different task labels give the network examples of distinctions to retain. This training choice matters when clean features include several types of structure. Sentences with different labels may occupy different regions or vary more strongly along different directions. The authors call this directional dependence *anisotropy*. Their loss is intended to keep the learned denoising directions responsive to those differences even though a test example comes without its correct label.

At inference, a new sentence passes through the fixed encoder. The resulting features are placed at a selected point on the reverse schedule. Each successive update uses a deterministic prediction based on the learned directions, followed by a stochastic correction. After each iteration the detector compares the current features with those that entered the procedure. The accumulated comparisons determine whether the input crosses the detection threshold. The optional purification analysis takes a different reading from the same process by sending the final features to the original linear classifier.

Training CASN and scoring a new input The steps in order.

#### The direction CASN learns

The encoder mapping can be written in a compact form.

```
h = E(x)
```

Here `x` is the text, `E` is the encoder and `h` is the hidden representation it produces. At detection time the representation includes token-level features that can later be averaged for a sentence-level comparison. The network updates these features in continuous numerical space. The procedure does not require generating a replacement sentence at each step.

The mathematical starting point is the score function of a probability density.

```
sθ(x) ≈ ∇ₓ log p(x)
```

Here `x` denotes a point in the space being described, `p(x)` is its density, `log` is the logarithm, and `∇ₓ` differentiates with respect to the coordinates of `x`. The vector `sθ(x)` is the learned estimate produced by a network with parameters `θ`. In this general definition `x` is numerical. In CASN the corresponding numerical input comes from the encoder. The vector points in the direction of steepest local increase in log density. Its components describe how that quantity changes along the individual feature coordinates.

A log-density gradient contains different information from a density value. A density value tells the detector how common the neighborhood is according to its fitted distribution. A gradient supplies a direction as well as a magnitude. It also removes any additive constant in the log density, which means that a common multiplicative normalization factor in the density is unnecessary for computing the direction. These properties motivate score matching as a way to learn from samples even when a full density is hard to evaluate.

Langevin dynamics provide one way to turn such a vector field into movement. In the paper’s introductory version the update has the following form.

```
xₜ ← xₜ₋₁ + (ε/2) ∇ₓ log p(xₜ₋₁) + √ε zₜ
```

The subscript `t` marks the iteration and `xₜ₋₁` and `xₜ` are its preceding and updated states. The arrow indicates an update. The positive step size is `ε`, `∇ₓ log p` is the log-density gradient, and `zₜ` is a Gaussian draw with zero mean and identity covariance. The square root scales the random term with the step size. The gradient term favors movement toward higher density, while random variation lets the process explore its surroundings. Under the conditions cited by the authors, the limiting process can sample from the target density as the step size tends to zero and the number of updates grows. CASN uses a finite trajectory to compare inputs. Its detection score is an empirical measurement from those updates.

Direct score matching is difficult in high dimensions because the original objective contains an expensive term. Denoising score matching, or DSM, gives the network a tractable target by adding noise with a known distribution. The introductory formulation uses a Gaussian centered at the unperturbed point.

```
ℓDSM(θ; σ) = 𝔼ₓ,ₓ̃ [½ ‖sθ(x̃) − ∇ₓ̃ log pσ(x̃ | x)‖₂²]
```

The loss is `ℓDSM`, `θ` denotes the network parameters, and `σ` is the noise standard deviation. The clean point `x` is sampled from the clean density and `x̃` is drawn from `pσ(x̃ | x)`, the Gaussian corruption conditional on that point, with covariance `σ²I`. Here `I` is the identity matrix. The expectation `𝔼ₓ,ₓ̃` averages over that joint draw. The gradient `∇ₓ̃` acts on the noisy point, `sθ(x̃)` is the predicted vector there, and `‖·‖₂²` is squared Euclidean length. The factor `½` scales the squared error.

The training target in this loss can be computed for each clean and noisy pair. The network has to predict from the noisy point, learning across all of the clean points that could have produced such an observation. The best predictor under the squared error is therefore tied to the score of the *noisy marginal*, the distribution after averaging over clean starting points. Small corruption makes that distribution a closer approximation to the clean one. The paper’s multilevel schedule uses a range of corruptions because a score trained only on slight perturbations can have difficulty guiding points farther from the familiar region.

#### Constructing the noise schedule and the loss

In the training formulation specific to CASN, Gaussian corruption both scales the clean representation and adds noise.

```
pα(h̃ | h) = N(h̃; √α h, (1 − α)I)
```

Here `h` is the clean representation, `h̃` the corrupted representation, and `pα(h̃ | h)` the conditional density of the latter given the former. The notation `N` specifies a Gaussian with mean `√α h` and covariance `(1 − α)I`, where `α` controls the noise level and `I` is identity covariance in feature coordinates. Near the clean end of the schedule, `α` is close to `1`, so the mean lies near `h` and the variance is small. Near the other end, `α` approaches `0`, and the representation increasingly resembles standard Gaussian noise. The conditional log-density gradient points back toward the Gaussian mean, with a scale set by its variance.

```
ℓ(θ; α) = 𝔼ₕ,ₕ̃ [½ ‖sθ(h̃, α) + (h̃ − √α h)/(1 − α)‖₂²]
```

The loss `ℓ` is evaluated at noise setting `α`. The expectation `𝔼ₕ,ₕ̃` samples `h` from the distribution of clean encoder features and `h̃` from the Gaussian conditional on `h`. The network with parameters `θ` produces `sθ(h̃, α)` from that noisy input and the conditioning value. The term added to it is the displacement `h̃ − √α h` divided by the variance scale `1 − α`. It is added because the target score points in the opposite direction, towards the mean. The squared Euclidean norm and the factor `½` give a squared-error penalty. Conditioning on `α` allows the same features to be interpreted differently depending on the amount of corruption assumed.

The paper aggregates these objectives over the schedule.

```
Lα(θ) = (1/T) Σᵢ₌₁ᵀ (1 − αᵢ) ℓ(θ; αᵢ)
```

Here `Lα` is the multilevel denoising loss, `T` is the number of noise levels, and `i` indexes the schedule from `1` through `T`. The summation `Σ` combines the individual losses `ℓ(θ; αᵢ)`, each with weight `1 − αᵢ`, and `1/T` scales the sum. The weight is the variance multiplier of the corresponding Gaussian. The network is trained on less corrupted points, where fine structure remains visible, and on noisier points, where the denoising problem is broader.

There are two related descriptions of the schedule. The above formula refers to the amount of signal retained from the original features. The appendix also describes each incremental corruption, using the previous state as its starting point.

```
pβᵢ(hᵢ | hᵢ₋₁) = N(hᵢ; √(1 − βᵢ) hᵢ₋₁, βᵢ I)
```

The representation at step `i` is `hᵢ`, its predecessor is `hᵢ₋₁`, and `pβᵢ` is their Gaussian transition density. The mean is the preceding state scaled by `√(1 − βᵢ)`. The step coefficient `βᵢ` determines the covariance `βᵢ I`, and `I` is the identity matrix. This is a Markov description, meaning that a step depends on the previous state through the stated transition. To use the same schedule in the training loss, the authors relate the signal retained across multiple steps to the coefficients at the individual steps.

```
αᵢ = ∏ⱼ₌₁ⁱ (1 − βⱼ)
```

The product sign `∏` multiplies the retention factors for step indices `j` from `1` through `i`. The factor `1 − βⱼ` comes from the Gaussian transition at index `j`, and `αᵢ` is the resulting cumulative retention coefficient. Equivalently, directly corrupting the original features `h₀` to level `i` gives mean `√αᵢ h₀` and covariance `(1 − αᵢ)I`. Here `h₀` is the representation before noise, and `I` again sets the covariance directions. The product uses the coefficient at each visited step. This follows the transition’s indexing, which is important because the appendix’s displayed product repeats the terminal index in its factor.

The individual noise coefficients follow a linear schedule.

```
βᵢ = βmin/T + (βmax − βmin)(i − 1)/(T(T − 1))
```

Here `βᵢ` is the coefficient at index `i`, `T` is the number of levels, and `βmin` and `βmax` set the schedule’s endpoints before scaling by `T`. The authors report `βmin = 0.1`, `βmax = 20` and `T = 1000`. The increment depends on the position `i − 1` in the schedule. The distinction between cumulative `αᵢ` and incremental `βᵢ` becomes important when reading the inference updates, which rely on both the noise level at a state and the size of a transition.

#### Keeping task labels visible in the learned directions

The denoising objective alone sees a mixture of all the clean classes. It is noise-conditional because it takes a noise level as an input. It has no direct training signal to distinguish groups with different task labels. The authors are concerned that denoising in such a field can move between regions associated with different classes. An explicitly class-conditioned network would require a label at detection time, when the true class of an adversarial input is precisely what the classifier may have misidentified. CASN uses a contrastive loss to add class information during training while preserving the same test inputs.

Supervised contrastive learning here means constructing comparisons within a training batch using the known labels. For an anchor example, a small Gaussian perturbation of that same example forms the positive comparison. A clean representation with a different task label and a lightly corrupted version of it both serve as negatives. A different example sharing the anchor’s label is excluded from the negative set. The paper’s specified positive is the anchor’s own perturbation. This design supplies evidence about consistency under small changes while discouraging the score network from treating different labels as interchangeable.

The comparison is calculated on the score outputs after averaging their token-level vectors.

```
sim(u, v) = cos ⟨mean(sθ(u)), mean(sθ(v))⟩
```

Here `u` and `v` denote the two representations being compared, with the appropriate noise conditioning left implicit in `sθ`. The network parameters are `θ`. The function `mean` averages the score vectors across tokens. The notation `cos ⟨·, ·⟩` denotes cosine similarity, which measures how closely two vectors point in the same direction. The function `sim` is therefore a measure of alignment between averaged score outputs. This is a comparison of the denoising directions for training. At detection time the cosine is applied directly to the hidden representations along the path.

```
Lcons(θ) = −Σᵢ∈ℐ sim(hᵢ, h̃ᵢ) / [Σₐ∈A(i) (sim(hᵢ, hₐ) + sim(hᵢ, h̃ₐ))]
```

The function `Lcons` is the contrastive loss, and `ℐ` is the set of example indices in the batch. In this expression `i` indexes an anchor example, independent of the use of `i` as a noise index in the schedule. The anchor and its perturbation are `hᵢ` and `h̃ᵢ`. The set `A(i)` contains indices `a` whose labels differ from the anchor’s label. Their clean and noisy representations are `hₐ` and `h̃ₐ`. The numerator is the positive similarity, and the denominator combines both negative similarities for each eligible example. The leading minus sign is part of the reported objective. The defining verbal criterion for `A(i)` is that the labels differ.

```
L(θ) = Lα(θ) + λ Lcons(θ)
```

Here `L` is the total training objective, `Lα` the denoising component, `Lcons` the contrastive component, and `λ` the coefficient assigned to that second component. The optimized parameters belong to the score network. This objective encourages the learned vectors to fit the known Gaussian targets and retain label-sensitive structure. The labels shape the training comparisons. They are never needed as extra inputs to the detection calculation. The strength of that supervision is a tunable choice, which the authors test by changing `λ` and by removing the contrastive component.

The backbone of the score network is [XLNet](https://md.research.elamur.ai/free/en/papers/yang-2019-xlnet-generalized-autoregressive-pretraining-language/). The authors train it for 20 epochs using AdamW, the optimizer associated with [Decoupled Weight Decay Regularization](https://md.research.elamur.ai/free/en/papers/loshchilov-2017-decoupled-weight-decay-regularization/). They report a learning rate of `2e −5`, dropout probability of `0.1`, batch size of `64` and random seed `42`. The saved state from the last epoch supplies the detector. Training this component uses only clean data features, so the pair construction relies on task labels and synthetic Gaussian perturbations. The examples produced by the benchmark attacks are used to assess detection.

#### From a stochastic process to discrete reverse updates

The forward Gaussian transition can be understood as a change to the previous representation plus a random contribution.

```
hᵢ = √(1 − βᵢ) hᵢ₋₁ + √βᵢ zᵢ₋₁
```

Here `hᵢ` and `hᵢ₋₁` are the new and preceding representations, `βᵢ` is the incremental noise coefficient, and `zᵢ₋₁` is a standard Gaussian draw. Its mean is zero and its covariance is identity. The factors inside the square roots control deterministic attenuation and random variation. Across a finer grid of steps, the appendix connects this recurrence to a stochastic differential equation, or SDE, which describes how the representation evolves in continuous time.

```
dx = f(x, t) dt + G(t) dw
```

The state is `x`, the continuous time is `t`, and `dx` and `dt` denote the corresponding infinitesimal state change and time increment. The function `f(x, t)` describes deterministic drift. The function `G(t)` scales the increment `dw` of a standard Wiener process `w`, also called Brownian motion. The specific forward process represented by the Gaussian transition has a drift proportional to the current representation, scaled by `−β(t)/2`, and a noise multiplier `√β(t)`. The continuous noise rate is `β(t)`. The proportionality to the current representation follows from the discrete transition’s attenuation of `hᵢ₋₁`.

The authors use the probability-flow ordinary differential equation associated with the forward process. Its states have the same marginal distributions at the corresponding times, where a marginal describes the distribution across states at a given time.

```
dh = [f(h, t) − ½ G(t)G(t)ᵀ ∇ₕ log pₜ(h)] dt
```

Here `h` is the representation, `dh` its differential, `t` time and `dt` its differential. The functions `f` and `G` are the drift and noise coefficients of the forward SDE, and `ᵀ` on `G(t)` denotes transpose. The density of features at time `t` is `pₜ(h)`, with `∇ₕ log pₜ(h)` its log-density gradient in representation space. The factor `½` weights the score correction to the drift. The update specified by this equation is deterministic for a given initial state. The learned score supplies an estimate of the gradient when the authors discretize the equation and step backward on the schedule.

The reverse procedure uses a predictor and a corrector. The predictor applies a discrete deterministic update drawn from the probability-flow calculation.

```
hᵢᵖ ← (2 − √(1 − βᵢ₊₁)) hᵢ₊₁ + ½ βᵢ₊₁ sθ*(hᵢ₊₁, αᵢ₊₁)
```

Here `hᵢ₊₁` is the state at the preceding, noisier point and `hᵢᵖ` is the predicted state at index `i`. The arrow marks an assignment and the superscript `p` denotes the intermediate prediction. The schedule coefficient for the transition is `βᵢ₊₁`. The symbol `sθ*` denotes the trained score network, with `θ*` the fitted parameters, and `αᵢ₊₁` denotes the cumulative noise conditioning at the state being read. The deterministic multiplier acts on the incoming features. The second term adds the learned direction scaled by half the incremental noise coefficient. This writes the network input as `αᵢ₊₁` following the appendix’s predictor derivation. The main equation and accompanying algorithm use `β` in the score-network calls, while the training loss and appendix derivation use `α` to identify the noise condition. The distinction matters for interpreting the notation because the two sequences describe different quantities.

The Langevin correction then reads the intermediate state and adds a score-guided update and a random contribution.

```
hᵢ ← hᵢᵖ + εᵢ sθ*(hᵢᵖ, βᵢ) + √(2εᵢ) z
```

Here `hᵢ` is the corrected state, `hᵢᵖ` is the intermediate prediction, `εᵢ` is the correction step size, and `sθ*` is the trained score network. This writes `βᵢ` in the conditioning argument as in the main detector equation. The symbol `z` is a standard Gaussian draw and `√(2εᵢ)` scales its contribution. The correction step is stochastic because it includes this draw. Both updates act on features, so the intermediate movement can be measured without decoding a sequence of edited words.

The paper gives a step-size rule that takes account of the magnitudes of the random draw and the estimated score.

```
εᵢ = 2 · ε · αᵢ · ‖z‖ / ‖sθ(x, αᵢ)‖
```

The index `i` selects the step, `εᵢ` is the adaptive size and `ε` is the base value, set to `0.01`. The cumulative schedule coefficient is `αᵢ`. The symbol `z` is the Gaussian draw, `x` is the numerical state passed to the score network in this equation, and `sθ(x, αᵢ)` is the score at that state and noise level. The norm signs `‖·‖` denote vector magnitudes. In the rule as written, a larger score magnitude reduces the step size relative to a given random draw. The distinction between this state-dependent rule and a fixed step size is one reason the introductory Langevin formula does not by itself describe the detector.

#### Reading the whole trajectory

The authors initialize the denoising trajectory at a chosen start index `k` with the encoder features of the input sentence. In particular, the listed algorithm assigns those unmodified features to the starting state. The start index tells the detector how much of the reverse schedule to traverse. In the experiments it is selected for the dataset, while `λ` can also vary with the encoder. The BERT settings use `λ` values of `0.15`, `0.1` and `0.2` for SST-2, IMDB and AGNEWS, respectively. For RoBERTa the corresponding values are `0.2`, `0.1` and `0.1`. The reported starting indices are `120` on SST-2 and `90` on each of IMDB and AGNEWS for either encoder.

After each update the detector measures alignment with the original features.

```
c ← c + cos ⟨mean(hᵢ), mean(hₖ)⟩
```

The variable `c` is the accumulated confidence, initialized to `0`. The current representation is `hᵢ` and the starting representation is `hₖ`, with `k` giving the start index. The function `mean` averages the token features of each state. The cosine compares the directions of those averaged vectors. The arrow adds the new similarity to the current accumulator. Because the same starting representation is used throughout, the accumulator reflects how similar the whole trajectory remains to its point of departure.

Cosine similarity measures change in orientation and ignores a common positive rescaling of a vector. Repeated comparisons therefore capture persistent changes in the direction of the sentence features. An early departure that remains visible contributes across the following updates. A trajectory that stays aligned contributes larger similarities. The authors expect the clean examples to accumulate larger values and the adversarial ones to accumulate smaller values. They use a threshold to convert this ordering into a flag. In comparisons within the same setup, the cumulative score comes from trajectories run over the same schedule, so the number of similarities added is held fixed.

The intuition is that a clean representation already occupies a region the score network learned to handle. An adversarial representation may sit close to that region while receiving a sequence of directions that takes it away from its own starting point. CASN uses that response as a signal. The final state can also be classified for the purification analysis, but the detector’s confidence requires neither a new task label nor a comparison between the original and final label. A sentence can therefore be flagged because of its trajectory even when the final category decision offers little evidence of recovery.

### Experiments and results

#### What is classified and what is detected

The evaluation uses tasks with different kinds of text and label structure. SST-2 is the short-text sentiment task drawn from the [Stanford Sentiment Treebank](https://md.research.elamur.ai/free/en/papers/socher-2013-recursive-deep-models-semantic-compositionality/). The paper reports 67,349 training examples and 872 labeled validation examples. IMDB also has binary sentiment labels, with longer reviews and 25,000 training and 25,000 test examples. AGNEWS classifies topics into world, sports, business and science or technology, and the paper lists 120,000 training and 7,600 test examples. These dataset sizes describe the original data. Detection is evaluated on sets constructed from clean and adversarial inputs.

For each dataset the authors use 90% of the original training split for training and 10% for validation. The detection setup sets out to attack 3000 texts when assembling a balanced detection set. SST-2 is the exception because its labeled public validation set has 872 texts, which the authors use in full. The paper cites [TextAttack](https://md.research.elamur.ai/free/en/papers/morris-2020-textattack-framework-adversarial-attacks-data/) as the framework used to produce the benchmark inputs. The attacks are BAE, PWWS, TextFooler and TextFooler-adj. The last imposes stricter similarity constraints than TextFooler, so it serves as a comparison in which the edits are intended to stay closer to their sources.

The encoders are [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/) and [RoBERTa](https://md.research.elamur.ai/free/en/papers/liu-2019-roberta-robustly-optimized-bert-pretraining/), with a linear classification layer attached to each. The authors use the base configurations, with BERT uncased, and train the task classifiers for 3 epochs. They report a learning rate of `2 × 10 −5`, dropout of `0.1`, weight decay of `1 × 10 −2` and batch size `64` for this fine-tuning. CASN runs on the resulting fixed features. Comparing results under both encoders tests the procedure with two sources of features. In each case the detector can be trained with the features of the encoder used in that experiment.

The paper defines two detection scenarios. Scenario 1 counts adversarial inputs from the attack procedures even when the classifier’s prediction did not change. It asks whether an attempted adversarial edit can be distinguished from a clean input. Scenario 2 retains successful attacks as the adversarial cases, so an example has to have changed the classifier’s output to be included in that group. The authors prefer Scenario 1 for the main comparison because unsuccessful attempts can still be part of an adversarial process. The difference in evaluation populations matters when comparing the reported results. Filtering on success changes the group of texts that the detector is asked to recognize.

The comparison includes detectors that use lexical information, such as DISP and FGWS, and detectors based on representations, such as MD and RDE. MDRE adds a method based on distributional properties of learned features. This breadth helps place the result. A margin over FGWS can show a benefit in settings where word frequency is a weak clue. A margin over RDE is especially pertinent to the paper’s central proposal, because both approaches draw evidence from encoder features but RDE bases its decision on a density estimate and CASN on the trajectory of those features.

#### Detection metrics and the main comparison

The paper reports detection accuracy, F1 and AUROC. Detection accuracy is the share of clean and adversarial examples assigned to the right group. F1 combines precision, the share of flagged texts that are adversarial, with recall, the share of adversarial texts that are flagged. Both depend on the decision produced at a selected operating point. AUROC is the area under the receiver operating characteristic curve. It evaluates the ordering of clean and adversarial examples across decision thresholds by relating detection of adversarial texts to erroneous flagging of clean texts. The paper leaves AUROC blank for DISP and MDRE because those implementations make threshold-independent decisions without the range of scores used for the curve.

TextFooler-adj is a useful place to see the size and shape of the main result. On SST-2 with BERT in Scenario 1, CASN scores 80.8 F1. DISP reaches 58.9 F1 and MDRE 63.2 F1, while RDE reaches 72.3. The AUROC comparison for that dataset and attack gives CASN 89.1 and RDE 77.1. Results across the metrics also expose a difference between ranking and the final decision. DISP obtains 79.2 detection accuracy on SST-2 in this comparison, close to CASN’s 80.3, while the corresponding F1 values are more widely separated. Accuracy pools decisions on clean and adversarial cases, while F1 concentrates on precision and recall for the adversarial cases.

SST-2 detection F1 for TextFooler-adj with BERT in Scenario 1 CASN leads the compared detectors under the stricter similarity constraints.

**The numbers**

| System or setting | F1 |
| --- | --- |
| DISP | 58.9 |
| MDRE | 63.2 |
| FGWS | 68.2 |
| MD | 70.3 |
| RDE | 72.3 |
| CASN (this paper) | 80.8 |

On IMDB in the same BERT scenario, CASN achieves 97.8 F1, 99.7 AUROC and 97.8 detection accuracy under TextFooler-adj. RDE reaches 82.2 F1, 88.3 AUROC and 80.7 detection accuracy. MDRE also reaches 82.2 F1, so the strongest earlier F1 result there is shared. These scores illustrate that the stricter similarity constraint affects the datasets differently. The BERT results on IMDB give the detector much clearer separation in this setting than the SST-2 results, even though both tasks involve sentiment classification.

AGNEWS adds a different pattern of baseline performance. For TextFooler-adj with BERT in Scenario 1, CASN records 90.0 F1, 95.8 AUROC and 89.7 detection accuracy. The highest baseline F1 in that comparison is 74.6 for FGWS. DISP achieves 85.8 detection accuracy, a stronger showing on that metric than its 61.5 F1 would suggest by itself. The authors also observe that DISP is competitive in other AGNEWS comparisons. They propose that some replacements in those texts may preserve the original meaning less well, making perturbation discrimination easier. This explanation is offered as an interpretation of the results, alongside the observed baseline scores.

For the other attack settings, the main BERT table contains many values close to the top of the metric scale. With BAE on SST-2, CASN achieves 97.2 F1, 98.9 AUROC and 97.1 detection accuracy. RDE gives 78.8 F1, 84.1 AUROC and 78.3 accuracy in the same setting. On AGNEWS with BAE, CASN reaches 99.8 F1 and 99.9 AUROC, compared with 77.1 F1 and 85.0 AUROC for RDE. The BERT Scenario 1 results for TextFooler and PWWS on AGNEWS both give CASN 99.9 on F1, AUROC and detection accuracy. The corresponding comparisons with the strongest baselines can vary by metric. Those conditions support the paper’s claim of very high detection performance in several settings. The TextFooler-adj scores show how much that conclusion depends on the benchmark and dataset.

The authors’ headline result is an average advantage of +15.2 F1 over previous state-of-the-art detection. The individual comparisons give that headline boundaries. The gain accompanies an improvement in AUROC over the feature-density baselines in the stricter comparisons, so it is visible in the detector’s ordering as well as in many thresholded results. At the same time, the BERT SST-2 results remain far enough from the top of the scale for the remaining errors to matter. The paper’s argument for measuring trajectories rests on the direction of the comparative gains, including in the harder setting.

#### Changing the encoder or the evaluation population

The RoBERTa results give a separate view of Scenario 1. On SST-2 with TextFooler-adj, CASN reaches 79.5 F1 and 88.3 AUROC, while RDE reaches 72.1 F1 and 76.4 AUROC. On IMDB under the same attack, CASN gets 91.6 F1 and 97.0 AUROC. RDE scores 80.5 F1 and 86.9 AUROC there. On AGNEWS CASN achieves 95.3 F1 and 99.1 AUROC. The corresponding RDE values are 69.2 F1 and 70.7 AUROC. Thus the comparison with RDE remains favorable across the tasks, while the exact performance on an attack depends on the feature source. IMDB with TextFooler-adj illustrates this dependence even though it remains one of the stronger detection settings.

The appendix’s table for Scenario 2 uses BERT and compares CASN with FGWS and RDE. For SST-2 with TextFooler-adj, restricting the adversarial group to successful attacks gives CASN 93.9 F1, 98.6 AUROC and 93.9 detection accuracy. RDE reaches 82.7 F1 and FGWS 76.5 F1. On IMDB, CASN achieves 98.8 F1 under the same restriction. On AGNEWS it reaches 95.7 F1, with RDE at 83.6 and FGWS at 82.4. The authors report an average improvement of 6.6 F1 for CASN on TextFooler-adj when moving to the successful-attacks-only evaluation across the datasets.

SST-2 detection F1 for successful TextFooler-adj attacks with BERT CASN leads both baselines when the adversarial group contains only successful attacks.

**The numbers**

| System or setting | F1 |
| --- | --- |
| FGWS | 76.5 |
| RDE | 82.7 |
| CASN (this paper) | 93.9 |

The restriction also helps several baseline results. The paper singles out changes for RDE and FGWS outside IMDB. This gives the two scenarios different uses. Scenario 1 measures separation from clean text across the benchmark procedures’ attempted outputs. Scenario 2 measures separation among inputs that did affect the original prediction. A high score in the latter does not establish performance on the group excluded by that protocol. Conversely, lower performance in Scenario 1 can coexist with strong recognition of inputs that have already caused misclassification.

The appendix also moves the score network from its training dataset to a different target dataset. In the direction from IMDB training features to SST-2 detection features, the target AUROC is 87.3 for TextFooler-adj. The other target AUROCs in that transfer are 94.1 for BAE, 97.8 for TextFooler and 94.4 for PWWS. Transfer involving AGNEWS is generally much weaker. For example, CASN trained on IMDB and used on AGNEWS reaches 46.8 AUROC and 50.0 detection accuracy for TextFooler-adj. These are transfer measurements, distinct from the stronger results obtained with clean features from the evaluation domain. The gap locates a substantial part of CASN’s effectiveness in the match between the source features it learns and the target features it denoises.

### What the ablations show

#### The contribution of class supervision

The central ablation removes supervised contrastive learning while retaining denoising score matching. This comparison asks whether the score field learned from an unlabelled mixture of the task’s classes is enough for the trajectory detector. The F1 values fall on all the datasets in the reported ablation. On SST-2 the full system has 93.7 F1 and the version without supervised contrastive learning has 69.2. On IMDB the corresponding values are 97.7 and 75.0. On AGNEWS they are 92.4 and 66.7. AUROC shows the same direction of effect. The full and ablated values are 97.3 and 71.0 on SST-2, 99.7 and 80.4 on IMDB, and 96.9 and 22.7 on AGNEWS.

Those changes are the clearest direct evidence that label-informed training helps detection in the tested settings. The contrastive loss changes the learned geometry even though the test-time procedure has no true label to pass into the network. The authors explain the gains by proposing that score matching alone blurs structures associated with different classes, which leaves the subsequent trajectories less useful for separating clean and adversarial cases. The ablation shows a large change in detector behavior. The specific geometric explanation is an interpretation of that change, since the table reports outcome metrics and does not directly track transitions across class manifolds.

Purified classification accuracy gives a different picture of the same removal. On SST-2 it is 65.5 for the full detector and 65.4 without the contrastive loss. On AGNEWS it is 82.2 and 82.0, respectively. IMDB shows a more visible difference, with 57.0 for the full detector and 51.2 for the ablated one. Those values describe reclassification after denoising. The contrastive term can thus matter greatly for how diagnostic the movement is even where its removal changes the accuracy of the classifier at the end of the movement only slightly. The two metrics read different properties of the trajectory.

#### The contribution of the deterministic predictor

The other ablation removes the predictor derived from the stochastic differential equation, leaving the Langevin component of the update. On SST-2 the F1 comparison is 93.7 for CASN and 91.3 without the predictor. IMDB gives 97.7 and 97.4. AGNEWS gives 92.4 and 92.3. The effect on AUROC varies. On AGNEWS the version without the predictor reaches 97.4, while the full system reaches 96.9. On SST-2 the corresponding values are 97.5 and 97.3, and on IMDB they are 99.6 and 99.7. The reported comparisons therefore give only mixed evidence that the predictor helps the ranking of clean and adversarial inputs.

Purified accuracy consistently favors the full update in this ablation. The full and predictor-free results are 65.5 and 63.7 on SST-2, 57.0 and 54.5 on IMDB, and 82.2 and 80.0 on AGNEWS. In the authors’ interpretation, the deterministic predictor is useful for moving features towards states that the original classifier can read more accurately. The near preservation of detection F1 when it is removed shows how much evidence the trajectory still carries with the Langevin component alone. A better endpoint for reclassification and a better ranking by accumulated displacement can vary independently.

#### The balance between the training losses

The authors vary `λ` from `0.025` to `0.3` in increments of `0.025` and plot detection AUROC. This analysis asks how performance changes once the contrastive term is present. For SST-2 and AGNEWS the curves fluctuate as the weight grows, with no simple monotonic pattern. On IMDB the AUROC values remain close to 100 percent across the explored values. The authors identify `0.15` to `0.2` as a range where performance is good across the datasets. Their chosen configurations use other weights in some cases, including `0.1` on IMDB for both encoders.

The interpretation follows the roles of the two objectives. Increasing `λ` gives the label comparisons more influence on the fitted vectors. If the contrastive component has very little weight, the learner is mainly rewarded for matching the Gaussian denoising target. If the weight is large, it can put too much emphasis on class comparisons at the expense of estimating directions accurately at the noise levels used for inference. The sweep shows that useful performance can occur in a range and that sensitivity depends on the dataset. It does not identify a single optimum shared by every encoder, dataset and attack setting.

#### What changes when denoising runs longer

To probe the choice of starting index, the paper compares similarity distributions for clean and adversarial representations under different numbers of denoising steps. It plots these distributions using a Gaussian kernel density estimate. This estimate summarizes how strongly the observed similarity values cluster near each location. In the examples illustrated, the two distributions share less area as the trajectories lengthen. The authors interpret this pattern as adversarial features drifting away from their starting orientations more strongly than clean features.

The purification experiment quantifies part of this behavior while also asking whether the final representations are easier to classify. On SST-2, detection AUROC rises from 80.2 at 30 steps to 97.6 at 60 and 99.8 at 90. On IMDB it starts at 99.5 at 30 steps and reaches 99.8 at 90. AGNEWS reaches 99.9 at each of the displayed positive step counts. The zero-step row has no AUROC entry because the comparison concerns a signal accumulated through denoising. The reported counts make clear that the extra separation from extending the process differs sharply by dataset.

SST-2 detection AUROC by denoising step count in the purification analysis Longer trajectories give stronger detection rankings across the displayed settings.

**The numbers**

| System or setting | AUROC |
| --- | --- |
| 30 steps | 80.2 |
| 60 steps | 97.6 |
| 90 steps (this paper) | 99.8 |

Adversarial classification accuracy tells a more restrained story on the same SST-2 examples. At 0 steps it is 4.8, and at 90 steps it is 8.0. Clean classification accuracy is 92.1 before denoising and 92.2 at 90 steps. At the same step counts on IMDB, adversarial classification accuracy moves from 20.8 to 39.3 and clean accuracy from 93.4 to 93.9. On AGNEWS, adversarial accuracy rises from 12.8 to 24.5, while clean accuracy is 94.4 at both endpoints. These are accuracy measurements from the original linear classifier applied to the representations. They show partial recovery of its task predictions, alongside much stronger rankings for the detection decision.

The SST-2 pairing is especially informative. By 90 steps the detection AUROC in the purification analysis reaches 99.8, yet the classifier gets only 8.0 accuracy on the adversarial examples after those updates. The representation can move in a way that is recognizable to the detector and still stop in a region that gives an incorrect task label. This is the failure mode that the paper identifies for a detector based solely on post-denoising label changes. The purification data support using the path as evidence of an adversarial edit even when the practical benefit of reclassification remains limited.

#### What the sentence examples illustrate

The paper also inspects representative SST-2 sentences for TextFooler-adj. The discussion contrasts the behavior of a frequency-based method with the way CASN sees the word changes through the full sentence representation. For example, one sentence discusses early rap records and unfamiliar hip-hop references. Frequency-guided substitutions include alternatives for terms that differ from the substitutions used to produce the adversarial input. The example shows the difficulty of treating unusual vocabulary as evidence of where an edit happened. The sentence topic itself can make an unusual term entirely natural.

Another example concerns a judgment about foreign cinema. The paper uses it to illustrate a miss by RDE under tighter sentence-level semantic constraints. A density estimate can give little indication that the example is unusual when the edited features remain in a familiar region. CASN’s stronger detection in the corresponding benchmark is consistent with the authors’ claim that movement during denoising can expose differences that the starting features alone obscure. The displayed sentences are qualitative illustrations. They do not independently establish how frequently the same pattern occurs or how well the benchmark edits preserve meaning for human readers.

### Limitations

#### Limits identified by the authors

Inference is slow because the detector performs repeated updates for each test representation. The encoder pass supplies the starting features, after which the predictor and corrector keep consulting the fitted score network. The appendix reports about 3 hours to train for 20 epochs on IMDB using a single NVIDIA A100 GPU, and about 1 hour to predict 3000 examples. Those figures describe the reported run. The broader cost follows from the procedure itself. Each extra step adds computation, including when the current trajectory already carries enough information for a reliable decision. The authors explicitly identify the slow inference speed relative to previous methods as a limitation.

The authors also caution that increasing the start index is useful only within a suitable range. Moving the start farther up the schedule assigns a noisier starting condition to the incoming features. In the listed algorithm the initialization uses the input’s actual features, which can look increasingly unlike the noise distribution expected at that index. The learned directions can then become less accurate. A longer run also costs more. The step analysis shows little additional AUROC on datasets where the shorter tested runs already separate the groups well. Its benefits on SST-2 show why a smaller step budget has consequences of its own.

The second limitation named by the authors is dependence on the training domain. CASN learns how clean features are arranged for the encoder and task used to train it. A change of domain can therefore affect the motion of clean features as well as the motion of edited ones. The authors report useful transfer from IMDB to SST-2 under several attack settings, alongside substantial deterioration in transfers involving AGNEWS. The transfer results support a narrower conclusion than the within-domain evaluation. Some training geometry is relevant across related sentiment tasks, while the learned detector performs much less reliably as a universal feature-space filter.

#### Boundaries of the evidence

The detection results measure performance under the paper’s benchmark construction. The attack families and tasks are fixed, and the training procedure is reapplied for the features used in the main evaluations. This design shows that the approach works across more than one encoder and task, including a benchmark with tighter similarity constraints. It leaves the performance of a fixed detector under a substantially different text distribution uncertain. The appendix directly tests one kind of distribution shift and finds it consequential. The results also provide no guarantee for adversarial inputs chosen with knowledge of the detector’s own trajectory score. The reported benchmark procedures target the classifier.

The balanced detection sets define the interpretation of thresholded F1 and accuracy. A deployment can encounter a different proportion of suspicious inputs, so the precision associated with the same behavior can change. AUROC helps by measuring the ordering of clean and adversarial cases across thresholds on the evaluation data. It does not give the false-positive cost of an operating point in another population. The paper establishes comparative performance under its benchmark conditions. Choosing a threshold in an application would also depend on which clean inputs get flagged and what happens after a flag.

The score network estimates directions from representations learned for classification. A divergence between trajectories can reflect the encoder’s response to benchmark edits, without demonstrating that the edited and original texts preserve meaning or that the detector identifies the specific linguistic change. The word and sentence similarity constraints define how TextFooler-adj differs from TextFooler in the evaluation. The paper does not report an independent human study of whether each resulting pair retains the same meaning. The qualitative cases help a reader see possible reasons for successes and failures, while the numerical detection scores apply to the benchmark labels assigned by the experimental setup.

There are also limits to the geometrical explanation. The contrastive ablation supports the value of using task labels in training. The step study shows greater observed separation in the similarity distributions. Neither measurement directly identifies the clean manifold or measures movement perpendicular to it in the learned representation space. The score is a finite sum of cosines, which depends on the starting index, the token averaging and the updates used to generate the path. It is therefore evidence about the response of representations to this procedure. A mathematical distance from an independently measured manifold would require a different observation.

Strong detection and partial recovery place different limits on what can be offered as downstream protection. The classifier’s clean accuracy stays close to its starting value in the purification study. Its adversarial accuracy also improves on the examples denoised there. Still, those accuracy figures show many adversarial examples remain misclassified at the end of the procedure. Using CASN to flag an input can succeed despite that outcome. An application that requires the right original judgment would need evidence about the recovery route in addition to the detector’s results.

Finally, the paper reports point estimates for the core comparisons and gives a fixed random seed for detector training. The update process itself also includes random draws. The results support the large changes seen when the contrastive term is removed and the substantial gaps in several baseline comparisons. They provide less information about whether small differences, such as the close AUROC values in the predictor ablation, would recur over repeated training and inference runs. The experiments establish that a class-informed denoising trajectory can be a strong detection signal under these setups, with its reliability bounded by the feature source, domain and evaluation conditions.

### What came after

No later study is identified that can be discussed as a documented extension of CASN. Questions left open by the paper include whether shorter trajectories can retain its detection performance and whether class-aware denoising can transfer reliably between tasks with different feature distributions.

## Cite

Cite as Rong Bao, Rui Zheng, Liang Ding, Qi Zhang and Dacheng Tao. 2023. CASN:Class-Aware Score Network for Textual Adversarial Detection. Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2023.acl-long.40](https://doi.org/10.18653/v1/2023.acl-long.40)

```bibtex
@inproceedings{bao2023casn,
  title = {{CASN:Class-Aware Score Network for Textual Adversarial Detection}},
  author = {Rong Bao, Rui Zheng, Liang Ding, Qi Zhang and Dacheng Tao},
  booktitle = {Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2023},
  doi = {10.18653/v1/2023.acl-long.40},
  url = {https://doi.org/10.18653/v1/2023.acl-long.40}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
