文本对抗样本系列的论文阅读笔记(整理合订)

文本对抗样本系列的论文阅读笔记

以前调研文本对抗样本时的论文笔记梳理,论文都很经典,有现成的框架(TextAttack)可以直接用,论文中部分内容直接是截取自论文,所以存在中英混合笔记的情况。

BERT-Attack

作者:Linyang Li, Ruotian Ma, et al.

单位:复旦大学

来源:EMNLP 2020

Introduction

对抗样本:imperceptible to human judges while they can mislead the neural networks to incorrect predictions.

文本对抗样本与图像对抗样本的区别:

  1. imperceptible to human judges & misleading to models

  2. fluent in grammar and semantically consistent with original inputs

先前的工作特点:

  1. based on specific rules

  2. difficult to guarantee the fluency and semantically preservation in the generated adversarial samples at the same time.

  3. rather complicated

核心思想:将BERT当作对抗样本的生成器,生成对抗样本

BERT-Attack的优势:

  1. Training -> Semantic-preserving

  2. Context around -> fluent & reasonable

  3. inference the language model once as a perturbation generator rather than repeatedly using language models to score the generated adversarial samples in a trial and error process

实验效果:successfully fooled the downstream models

Related Work

character-level heuristic rules: Jin et al. 2019

substituting words with synonyms: Ren et.al 2019, Li et al. 2018

score perturbations by searching for close meaning words in the embedding space: Alzantot et al. 2018

semantically enhanced embedding but context unaware: Jin et al. 2019

replace words manually to break the language inference system: Glockner et al. 2018

replacement strategies using embedding transition: Lei et al. 2019

Method

两个步骤:

  1. finding the vulnerable words of target model

  2. replacing the vulnerable words with semantically similar and grammatically correct words until a successful attack

Finding Vulnerable Words

输入序列: S = [ w 0 , ⋯ , w i , ⋯ ] S=[w_0,\cdots,w_i,\cdots] S=[w0,,wi,]

o y ( S ) o_y(S) oy(S):目标模型正确标签的logit输出

重要性分数: I w i = o y ( S ) − o y ( S / w i ) I_{w_i}=o_y(S)-o_y(S_{/w_i}) Iwi=oy(S)oy(S/wi),其中 S / w i = [ w 0 , ⋯ , w i − 1 , [ M A S K ] , w i + 1 , ⋯ ] S_{/w_i}=[w_0,\cdots,w_{i-1},[MASK],w_{i+1},\cdots] S/wi=[w0,,wi1,[MASK],wi+1,]

将评分排序,创造单词列表 L L L,取前 ϵ \epsilon ϵ分数的单词作为攻击单词目标

Word Replacement via BERT

Previous approaches: 多个人工规则,例如Synonym dictionary(Ren et al. 2019)、POS Checker(Jin et al. 2019),Semantic Similarity Checker(Jin et al. 2019)

这些替代策略缺陷:

  1. unaware of the context between the substitution position

  2. insufficient in fluency control and semantic consistency

使用BERT进行替代策略解决fluency control与semantic preservation的问题:

在这里插入图片描述

算法流程:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

BPE算法将 S S S进一步分词为 H = [ h 0 , h 1 , ⋯ ] H=[h_0,h_1,\cdots] H=[h0,h1,],因此需要进行分词对齐

M M M表示为BERT模型,则输出结果为 P = M ( H ) P=M(H) P=M(H)。在每个位置上使用最可能的 K K K词预测, K K K是超参数。遍历预测的 K K K个词,得到对抗样本

单一词:对于单词 w j w_j wj,其top- K K K个预测候选为 P j P^j Pj。通过NLTK过滤停止词,使用synonym dictionaries过滤反义词。最终构建干扰序列 H ′ = [ h 0 , ⋯ , h j − 1 , c k , h j + 1 , ⋯ ] H'=[h_0,\cdots, h_{j-1},c_k,h_{j+1},\cdots] H=[h0,,hj1,ck,hj+1,],如果能成功逆转结果,则该序列为对抗样本 H a d v H^{adv} Hadv。否则,在 L L L中查找下一个单词继续挑选最佳干扰项

分词:perplexity指标寻找合适的单词替代。给定单词 w w w的分词串 [ h 0 , h 1 , ⋯ , h t ] [h_0,h_1,\cdots,h_t] [h0,h1,,ht],根据 M M M列出来自预测 P t × K P^{t\times K} Pt×K的所有可能组合,从而通过逆转BERT分词过程以转换这些二分词到正常单词之中

实验

数据集

  • Text Classification

    • Yelp: review classification dataset

    • IMDB: document-level movie review dataset

    • AG’s News: sentence-level news-type classification dataset

    • FAKE: fake news classification dataset

  • Natural Language Inference

    • SNLIL: Stanford language INFERENCE TASK

    • MNLI: language inference dataset on multi-genre texts

Baseline: TextFooler, GA

Evaluation:

  1. Attacked Accuracy

  2. Perturb Percentage

  3. Query Number

  4. Average Length

  5. Semantic Similarity (Universal Sentence Encoder)

同其他baseline比较:

样本展示:

笔记中提及的论文参考

  1. Di Jin, Zhijing Jin, Joey Tianyi Zhou, and Peter Szolovits. 2019. Is BERT really robust? natural language attack on text classification and entailment. CoRR

  2. Shuhuai Ren, Yihe Deng, Kun He, and Wanxiang Che. 2019. Generating natural language adversarial examples through probability weighted word saliency. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics

  3. Jinfeng Li, Shouling Ji, Tianyu Du, Bo Li, and Ting Wang. 2018. Textbugger: Generating adversarial text against real-world applications

  4. Moustafa Alzantot, Yash Sharma, Ahmed Elgohary, Bo-Jhang Ho, Mani B. Srivastava, and Kai-Wei Chang. 2018. Generating natural language adversarial examples. CoRR

  5. Max Glockner, Vered Shwartz, and Yoav Goldberg. 2018. Breaking nli systems with sentences that require simple lexical inferences

Semantically Equivalent Adversarial Rules for Debugging NLP Models

作者:Marco Tulio Ribeiro, Sameer Singh et al.

单位:University of Washington, University of California (Irvine)

来源:ACL 2018

Introduction

Challenges:

  1. different ways of phrasing the same sentence can often cause the model to output different predictions.

  2. oversensitivity

提出的对抗样本方法:SEA
优势:

  1. model-agnostic

  2. generate semantically equivalent rules for optimal rule sets: semantic equivalence, high adversary count, non-redundancy.

Semantically Equivalent Adversaries

给定黑盒模型 f f f,句子 x x x,预测结果为 f ( x ) f(x) f(x)

基本思想:通过调整 x x x,以改变 f ( x ) f(x) f(x)

指示函数: S e m E q ( x , x ′ ) = I [ S e m E q ( x , x ′ ) ∧ f ( x ) ≠ f ( x ′ ) ] SemEq(x,x')=\mathbb{I}[SemEq(x,x')\wedge f(x)\not=f(x')] SemEq(x,x)=I[SemEq(x,x)f(x)=f(x)]

语义分数: S ( x , x ′ ) = min ⁡ ( 1 , P ( x ′ ∣ x ) P ( x ∣ x ) ) S(x,x')=\min(1,\frac{P(x'|x)}{P(x|x)}) S(x,x)=min(1,P(xx)P(xx)),其中 P ( x ′ ∣ x ) P(x'|x) P(xx)代表的是重新调整句子 x x x后的 x ′ x' x概率

进一步有: S e m E q ( x , x ′ ) = I [ S ( x , x ′ ) ≥ τ ] SemEq(x,x')=\mathbb{I}[S(x,x')\geq \tau] SemEq(x,x)=I[S(x,x)τ]

paraphrase set via beam search: Π x \Pi_x Πx

挑选最佳的对抗样本: arg max ⁡ x ′ ∈ Π x S ( x , x ′ ) S E A x ( x ′ ) \argmax\limits_{x'\in\Pi_x}S(x,x')SEA_x(x') xΠxargmaxS(x,x)SEAx(x)

Semantically Equivalent Adversarial Rules (SEARs)

假设:人的时间受限,愿意看 B B B条规则

SEARs:给定一个参考数据集 X X X,根据 X X X选择规则集 B B B

规则形式: r = ( a → c ) r=(a\rightarrow c) r=(ac) a a a为原始单词, c c c为替代词

构建规则集:提取匹配词对,挑选最小连续序列使得 x → x ′ x\rightarrow x' xx。同时包含中间上下文, e.g. What color → \rightarrow Which color。通过粗粒度和细粒度的Part-of-Speech tags乘积泛化,如果tags能匹配上前项,则允许这些tags出现在结果之中,e.g. What NOUN → \rightarrow Which NOUN

选择规则集:给定候选规则,想要挑选规则集 R R R使得 ∣ R ∣ ≤ B |R|\leq B RB

  • 语义相等:在集合中规则的应用应该产生语义相等的实例,即: E [ S e m E q ( x , r ( x ) ) ] ≥ 1 − δ E[SemEq(x,r(x))]\geq 1-\delta E[SemEq(x,r(x))]1δ (Filter操作)

  • 高对抗样本数量:能在验证集中诱导尽可能多的SEAs,并且语义相似分数高

  • 不重复:不同的规则可能造成相同的SEAs,或者诱导不同的SEAs到相同的实例上,即目标函数: max ⁡ R , ∣ R ∣ < B ∑ x ∈ X max ⁡ r ∈ R S ( x , r ( x ) ) S E A ( x , r ( x ) ) \max\limits_{R,|R|<B}\sum\limits_{x\in X}\max\limits_{r\in R}S(x,r(x))SEA(x,r(x)) R,R<BmaxxXrRmaxS(x,r(x))SEA(x,r(x)),这是一个贪心算法、SubMod过程。

样本展示:

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

User Studies

neural machine translation models parameters: default OpeNMT-py parameters

POS tagging: spacy library

SEAR generation: δ = 0.1 \delta=0.1 δ=0.1, τ = 0.0008 \tau=0.0008 τ=0.0008

VQA: telling system, questions include “What”, “Where”, “When”, “Who”, “Why”, and “How”.

Condition Study: Human, SEA, HSEA (human & SEA collaboration)

Condition Result:

专家 VS SEA

TextBugger: Generating Adversarial Text Against Real-world Applications

作者:Jingfeng Li, ShouJing Ji et al.

单位:浙江大学计算机学院

来源:NDSS 2019

Introduction

对抗攻击分类

  • causative attacks: manipulate the training data to mislead the classifiers

  • exploratory attacks: craft malicious testing instances to evade a given classifiers

文本对抗样本的挑战:

  1. discrete property, hard to optimize

  2. small perturbations are usually clearly perceptible

  3. replacement of a single word may drastically alter the semantics of the sentence

已有工作(2019年前)缺陷:

  1. not computationally efficient

  2. under the white-box setting

  3. manual intervention

  4. against a particular NLP model, not comprehensively evaluated

本文提出的TextBugger,分为白盒跟黑盒情景:

  • 白盒:通过计算分类器的Jacobian矩阵找到关键词,然后通过生成五种扰动选择最优扰动放进去

  • 黑盒:首先寻找重要句子,之后选择打分函数寻找句子中的重要单词污染语料

Attack Design

Problem Formulation

受害模型 F : X → Y F: X\rightarrow Y F:XY

语义相似指标: S : X × X → R + S:X\times X\rightarrow \mathbb{R}_+ S:X×XR+

对抗文档: F ( x ) = y F(x)=y F(x)=y, x a d v x_{adv} xadv s.t. F ( x a d v ) = t ( t ≠ y ) F(x_{adv})=t(t\not= y) F(xadv)=t(t=y), S ( x , x a d v ) ≥ ϵ ( ϵ ∈ R ) S(x,x_{adv})\geq \epsilon (\epsilon \in \mathbb{R}) S(x,xadv)ϵ(ϵR)

Threat Model

白盒设置:complete knowledge about the targeted model architecture parameters (worst-case attack)

黑盒设置:users can only access the model via an API (not aware of the model architecture)

TextBugger

白盒攻击:

  1. 寻找重要单词:给定 x = ( x 1 , x 2 , ⋯ , x N ) x=(x_1,x_2,\cdots,x_N) x=(x1,x2,,xN) x i x_i xi为第i个单词,目标模型为 F F F,则矩阵为: J F ( x ) = ∂ F ( x ) ∂ x = [ ∂ F j ( x ) ∂ x i ] i ∈ { 1 , ⋯ , N } , j ∈ { 1 , ⋯ , K } J_F(x)=\frac{\partial F(x)}{\partial x}=[\frac{\partial F_j(x)}{\partial x_i}]_{i\in\{1,\cdots,N\},j\in \{1,\cdots,K\}} JF(x)=xF(x)=[xiFj(x)]i{1,,N},j{1,,K},其中 K K K表示为标签类别数量, F j ( ⋅ ) F_j(\cdot) Fj()表示为 j t h j^{th} jth类别的confidence value,则单词 x i x_i xi的重要性为: C x i = J F ( i , y ) = ∂ F y ( x ) ∂ x i C_{x_i}=J_{F(i,y)}=\frac{\partial F_y(x)}{\partial x_i} Cxi=JF(i,y)=xiFy(x)

  2. Bugs生成:考虑字符级扰动和单词级扰动。

    • 字符级:将重要单词转化为未知单词

    • 单词级:插入、删除、交换、替代字符、替代单词

白盒攻击下的算法:

黑盒攻击:

  1. 找到重要句子:假定文档 x = ( s 1 , ⋯ , s n ) x=(s_1,\cdots,s_n) x=(s1,,sn),其中 s i s_i si表示第 i i i个句子。先使用spaCy切片每个文档到句子之中。之后通过模型查看是否与不同标签一致 ( F l ( s i ) ≠ y ) (F_l(s_i)\not=y) (Fl(si)=y),逆序排列句子重要性分数,其句子的重要性分数表示为: C s i = F y ( s i ) C_{s_i}=F_y(s_i) Csi=Fy(si)

  2. 找到重要单词:找到最重要单词,并通过控制语义相似进行修改。设计了一个新的打分函数: C w j = F y ( w 1 , w 2 , ⋯ , w m ) − F y ( w 1 , ⋯ , w j − 1 , w j + 1 , ⋯ , w m ) C_{w_j}=F_y(w_1,w_2,\cdots,w_m)-F_y(w_1,\cdots,w_{j-1},w_{j+1},\cdots,w_m) Cwj=Fy(w1,w2,,wm)Fy(w1,,wj1,wj+1,,wm)

  3. Bugs生成

Attack Evaluation

Sentiment Analysis

数据集:IMDB,Rotten Tomatoes Movie Reviews (MR)

受害模型:LR,CNN,LSTM

baseline: Random,FGSM+Nearest Neighbor Search (NNS),DeepFool+NNS

评估指标:

  • Edit Distance

  • Jaccard Similarity Coefficient: J ( A , B ) = ∣ A ∩ B ∣ ∣ A ∪ B ∣ = ∣ A ∩ B ∣ ∣ A ∣ + ∣ B ∣ − ∣ A ∩ B ∣ J(A,B)=\frac{|A\cap B|}{|A\cup B|}=\frac{|A\cap B|}{|A|+|B|-|A\cap B|} J(A,B)=ABAB=A+BABAB

  • Euclidean Distance: d ( p , q ) = ( p 1 − q 1 ) 2 + ( p 2 − q 2 ) 2 + ⋯ + ( p n − q n ) 2 d(\bold{p},\bold{q})=\sqrt{(p_1-q_1)^2+(p_2-q_2)^2+\cdots+(p_n-q_n)^2} d(p,q)=(p1q1)2+(p2q2)2++(pnqn)2

  • Semantic Similarity: S ( p , q ) = p ⋅ q ∣ ∣ p ∣ ∣ ⋅ ∣ ∣ q ∣ ∣ = ∑ i = 1 n p i × q i ∑ i n ( p i ) 2 × ∑ i = 1 n ( q i ) 2 S(\bold{p},\bold{q})=\frac{\bold{p}\cdot \bold{q}}{||\bold{p}||\cdot||\bold{q}||}=\frac{\sum^n_{i=1}p_i\times q_i}{\sqrt{\sum^n_i(p_i)^2}\times \sqrt{\sum^n_{i=1}(q_i)^2}} S(p,q)=∣∣p∣∣∣∣q∣∣pq=in(pi)2 ×i=1n(qi)2 i=1npi×qi with USE

实验发现:

  1. 这个模型效果比较好,速度也快

  2. 长文本的攻击效果弱于短文本

  3. 评分上:逆转负面评价到正面评价会部分失败

  4. 数据集上负面词多于正面词

  5. 扰动类型的影响:字符级替代最难被发现造成词表之外的现象

Toxic Content Detection

数据集:Kaggle Toxic Comment Classification competation

受害模型:LR, CNN, LSTM

实验结果:

Potential Defenses

  1. Spelling Check

  2. Adversarial Training

Generating Natural Language Adversarial Examples through Probability Weighted Word Saliency

作者:Shuhuai Ren, Yihe Deng et al.

单位:杭州科技大学、加利福尼亚大学、哈工大

Introduction

NLP对抗样本难的问题:

  1. words in sentences are discrete tokens

  2. hard in human’s perception to make sense of the texts with perturbations

本文的出发点:could guarantee the lexical correctness with little grammatical error and semantic shifting.

提出的方法:Probability Weighted Word Saliency (PWWS)

Text Classification Attack

特征空间 X X X,输出空间 Y = { y 1 , ⋯ , y K } Y=\{y_1,\cdots, y_K\} Y={y1,,yK},,目标模型 f : X → Y f:X\rightarrow Y f:XY, 正确的标签 y t r u e ∈ Y y_{true}\in Y ytrueY

Text Adversarial Example

模型分类: arg max ⁡ y i ∈ Y ( y i ∣ x ) = y t r u e \argmax\limits_{y_i\in Y}(y_i|x)=y_{true} yiYargmax(yix)=ytrue

扰动 △ x \triangle x x x ∗ = x + △ x x^*=x+\triangle x x=x+x,s.t. arg max ⁡ y i ∈ Y P ( y i ∣ x ∗ ) ≠ y t r u e \argmax\limits_{y_i\in Y}P(y_i|x^*)\not= y_{true} yiYargmaxP(yix)=ytrue

定义的对抗样本为:

x ∗ = x + △ x , ∣ ∣ △ x ∣ ∣ < ϵ arg max ⁡ y i ∈ Y P ( y i ∣ x ∗ ) ≠ arg max ⁡ y i ∈ Y P ( y i ∣ x ) x^*=x+\triangle x, ||\triangle x||< \epsilon \\\argmax\limits_{y_i\in Y} P(y_i|x^*)\not=\argmax\limits_{y_i\in Y}P(y_i|x) x=x+x,∣∣△x∣∣<ϵyiYargmaxP(yix)=yiYargmaxP(yix)

p p p范数为: ∣ ∣ △ x ∣ ∣ p = ( ∑ i = 1 n ∣ w i ∗ − w i ∣ p ) 1 p ||\triangle x||_p=(\sum^n\limits_{i=1}|w^*_i-w_i|^p)^{\frac{1}{p}} ∣∣△xp=(i=1nwiwip)p1

该论文中,通过替代输入单词的同义词(来自WordNet)并通过取代相似的命名实体(Name Entries, NE)以生成对抗样本

假定属于类别 y t r u e y_{true} ytrue的输入样本和字典 D y t r u e ⊆ D \mathbb{D}_{y_{true}}\subseteq \mathbb{D} DytrueD包含了所有出现在文中的NE,而最频繁的 N E a d v NE_{adv} NEadv存在于 D − D y t r u e \mathbb{D}-\mathbb{D}_{y_{true}} DDytrue中作为替代词。

PWWWS

PWWS属于贪心算法

单词替代策略

  1. 对于单词 w i ∈ x w_i\in x wix,首先用WordNet构建同义词集 L i ⊆ D \mathbb{L}_i\subseteq \mathbb{D} LiD,若 w i w_i wi是个命名实体,则寻找对应同类型的词放到 L i \mathbb{L}_i Li中。当 w i ′ w'_i wi影响最大时,从 L i \mathbb{L}_i Li中选择 w i ′ w'_i wi作为 w i ∗ w^*_i wi

  2. 替代词选择策略:

    • w i ∗ = R ( w i , L i ) = arg max ⁡ w i ′ ∈ L i P ( y t r u e ∣ x i ′ ) w^*_i=R(w_i,\mathbb{L}_i)=\argmax_{w'_i\in \mathbb{L}_i}{P(y_{true}|x'_i)} wi=R(wi,Li)=argmaxwiLiP(ytruexi),其中 x = w 1 w 2 ⋯ w i ⋯ w n x=w_1 w_2\cdots w_i\cdots w_n x=w1w2wiwn x i ′ = w 1 w 2 ⋯ w i ′ ⋯ w n x'_i=w_1 w_2\cdots w'_i\cdots w_n xi=w1w2wiwn

    • x i ∗ = w 1 w 2 ⋯ w i ∗ ⋯ w n x^*_i=w_1 w_2 \cdots w^*_i \cdots w_n xi=w1w2wiwn,有: △ P i ∗ = P ( y t r u e ∣ x ) − P ( y t r u e ∣ x i ∗ ) \triangle P^*_i=P(y_{true}|x)-P(y_{true}|x^*_i) Pi=P(ytruex)P(ytruexi)

替换顺序策略

进行切片打分,切片打分函数为: S ( x , w i ) = P ( y t r u e ∣ x ) − P ( y t r u e ∣ x i ^ ) S(x,w_i)=P(y_{true}|x)-P(y_{true}|\hat{x_i}) S(x,wi)=P(ytruex)P(ytruexi^),其中 x = w 1 w 2 ⋯ w i ⋯ w d x=w_1 w_2 \cdots w_i \cdots w_d x=w1w2wiwd x ^ i = w 1 w 2 ⋯ u n k n o w n ⋯ w d \hat{x}_i=w_1 w_2 \cdots unknown \cdots w_d x^i=w1w2unknownwd

对所有 w i ∈ x w_i\in x wix计算切片分数,获得最佳切片向量 S ( x ) S(x) S(x)

单词替换优先级的评分函数: H ( x , x i ∗ , w i ) = ϕ ( S ( x ) ) i ⋅ △ P i ∗ H(x,x^*_i,w_i)=\phi(S(x))_i\cdot \triangle P^*_i H(x,xi,wi)=ϕ(S(x))iPi,其中 ϕ ( ⋅ ) \phi(\cdot) ϕ()是Softmax函数。

在这里插入图片描述

Word-level Textual Adversarial Attacking as Combinatorial Optimization

作者:Yuan Zang, Fanchao Qi et al.

单位:清华大学

来源:ACL 2020

Introduction

基本点:把对抗那个样本攻击当作是组合优化问题

方法:基于义元(sememe)的单词替代方法 + 基于粒子群优化的搜索算法

Background

Sememes: 义元是单词的语义标签,相关工作有HowNet

PSO: 连续空间 S ∈ R D S\in \mathbb{R}^D SRD,有 N N N个粒子,每个粒子的位置、速度能被表示为 x n ∈ S x^n\in S xnS x n ∈ R D x^n\in \mathbb{R}^D xnRD n ∈ { 1 , ⋯ , N } n\in \{1,\cdots, N\} n{1,,N}

  1. 初始化,随机初始化每个粒子的位置和速度,初始速度的维度为 v d n ∈ [ − V m a x , V m a x ] v^n_d\in [-V_{max}, V_{max}] vdn[Vmax,Vmax]

  2. 记录,搜索空间的每个位置对应于一个优化分数,最高优化分数记录为个体最佳位置。个体最佳位置中的最高分数为全局最佳位置

  3. 终止,如果全局最佳位置已经达到期待的最佳分数,则算法终止

  4. 更新,未终止则更新速度与位置,更新的公式为: v d n = w v d n + c 1 × r 1 × ( p d n − x d n ) + c 2 × r 2 × ( p d g − x d n ) v^n_d=wv^n_d+c_1\times r_1\times (p^n_d - x^n_d) + c_2 \times r_2 \times (p^g_d-x^n_d) vdn=wvdn+c1×r1×(pdnxdn)+c2×r2×(pdgxdn) x d n = x d n + v d n x^n_d=x^n_d+ v^n_d xdn=xdn+vdn,其中 w w w是惯性权重, p d n p^n_d pdn p d g p^g_d pdg是d维第 n n n个粒子的个体最佳位置与全局最佳位置, c 1 c_1 c1 c 2 c_2 c2是加速度系数, r 1 r_1 r1 r 2 r_2 r2是随机系数。更新之后,算法返回记录步骤。

Methodology

two parts: sememe-based word substitution & PSO-based adversarial example search

Sememe-based Word Substitution
  1. 只替代content words (words that carry meanings and consist mostly of nouns, verbs, adjectives and adverbs),并限制替代词跟原单词part-of-speech tag相同

  2. w ∗ w^* w替代 w w w时,当且仅当 w w w的意义跟 w ∗ w_* w的意义有相同的义元

PSO-based adversarial example search

一个位置对应于一个句子,每个位置的维度对应于句子的每个单词

x n = w 1 n ⋯ w d n ⋯ w D n , w d n ∈ V ( w d o ) x^n=w^n_1 \cdots w^n_d \cdots w^n_D, w^n_d\in \mathbb{V}(w^o_d) xn=w1nwdnwDn,wdnV(wdo) V ( w d o ) \mathbb{V}(w^o_d) V(wdo)包含了 w d o w^o_d wdo与其替代词, D D D为原始输入的长度

初始化:随机替换原始输入的一个词以决定粒子的初始化位置

记录:与原PSO算法相同

终止:受害模型预测到攻击者期待得到的结果标签

更新

  1. 考虑搜索空间的离散性, v d n = w v d n + ( 1 − w ) × [ I ( p d n , x d n ) + I ( p d g , x d n ) ] v^n_d=w v^n_d + (1-w)\times [I(p^n_d,x^n_d) + I(p^g_d,x^n_d)] vdn=wvdn+(1w)×[I(pdn,xdn)+I(pdg,xdn)]

  2. w w w是惯性系数, I ( a , b ) I(a,b) I(a,b)定义为: I ( a , b ) = { 1 , a = b − 1 , a ≠ b I(a,b)=\begin{cases}1,&a=b\\ -1,&a\not=b\end{cases} I(a,b)={1,1,a=ba=b

  3. w w w的更新公式为: w = ( w m a x − w m i n ) × T − t T + w m i n w=(w_{max}-w_{min})\times \frac{T-t}{T} + w_{min} w=(wmaxwmin)×TTt+wmin,其中参数范围: 0 < w m i n < w m a x < 1 0<w_{min}<w_{max}<1 0<wmin<wmax<1 T T T t t t分别为最大迭代次数值和最近迭代次数值

  4. 调整离散的搜索空间:

    • 第一步,新的移动概率 P i P_i Pi随粒子被引入到个体最佳位置,当粒子决定移动时,位置的每个维度由相同维度的速度决定,通过 s i g m o i d ( ⋅ ) sigmoid(\cdot) sigmoid()函数进行概率评判。其中 P i P_i Pi为: P i = P m a x − t T × ( P m a x − P m i n ) P_i=P_{max}-\frac{t}{T}\times (P_{max}-P_{min}) Pi=PmaxTt×(PmaxPmin),其中参数范围: 0 < P m i n < P m a x < 1 0<P_{min}<P_{max}<1 0<Pmin<Pmax<1

    • 第二步,通过移动概率 P g P_g Pg决定全局最佳概率: P g = P m i n + t T × ( P m a x − P m i n ) P_g=P_{min}+\frac{t}{T}\times (P_{max}-P_{min}) Pg=Pmin+Tt×(PmaxPmin)

  5. 更新后应用突变: P m ( x n ) = m i n ( 0 , 1 − k ϵ ( x n , x o ) D ) P_m(x^n)=min(0, 1-k\frac{\epsilon(x^n,x^o)}{D}) Pm(xn)=min(0,1kDϵ(xn,xo)) ϵ ( ⋅ ) \epsilon(\cdot) ϵ()为编辑距离。之后,返回记录步骤

Experiments

数据集:IMDB、SST-2、NLI、SNLI

baseline:Embedding/LM + Genetic、SYNONYM + Greedy

Evaluation Metrics:

  1. Attack Success Rate (ASR)

  2. Attack Validity

  3. Quality of adversarial examples (modification rate, grammatical error increase rate, language model perplexity)

Contextualized Perturbation for Textual Adversarial Attack

作者:Dianqi Li, Yizhe Zhang et al.

单位:华盛顿大学、微软研究院、杜克大学

来源:NAACL 2021

Introduction

Problem: rule-based methods are agnostic to context, limiting their ability to produce natural, fluent, and grammatical outputs

ContextuaLized AdversaRial Example: CLARE, a mask-then-infill procedure

CLARE features three contextualized perturbations: Replace, Insert and Merge

CLARE

Background

victim model: f ( ⋅ ) f(\cdot) f()

similarity function: s i m ( x ′ , x ) sim(x',x) sim(x,x)

adversarial example: x ′ x' x for x x x, s.t. f ( x ′ ) ≠ f ( x ) f(x')\not=f(x) f(x)=f(x), s i m ( x ′ , x ) > l sim(x',x)>l sim(x,x)>l

Masking and Contextualized Infilling

Replace:

对于给定的第 i i i个位置,首先给 x i x_i xi进行Mask然后从候选词集 Z Z Z中选出token z z z来填充:

x ~ = x 1 ⋯ x i − 1 [ M A S K ] x i + 1 ⋯ x n \tilde{x}=x_1\cdots x_{i-1} [MASK] x_{i+1} \cdots x_n x~=x1xi1[MASK]xi+1xn

x ~ z = r e p l a c e ( x , i ) = x 1 ⋯ x i − 1 z x i + 1 ⋯ x n \tilde{x}_z = replace(x,i)=x_1\cdots x_{i-1}z x_{i+1}\cdots x_n x~z=replace(x,i)=x1xi1zxi+1xn

要求:

  1. z z z应该适应于未mask的上下文

  2. x ~ z \tilde{x}_z x~z应该与 x x x相似

  3. x ~ z \tilde{x}_z x~z应该能在 f f f中触发错误

p M L M p_{MLM} pMLM: 预训练好的语言建模模型

根据要求约束可以用数学公式描述为:

  • 对应于第1、2点: { z ′ ∈ V ∣ p M L M ( z ′ ∣ x ~ ) > k , s i m ( x , x ~ z ′ ) > l } \{z'\in V| p_{MLM}(z'|\tilde{x})>k, sim(x,\tilde{x}_{z'})>l\} {zVpMLM(zx~)>k,sim(x,x~z)>l} V V V为语言建模模型的单词表,从 Z Z Z中挑选token填充

  • 对应于第3点: z = arg min ⁡ z ′ ∈ Z p f ( y ∣ x z ′ ~ ) z=\argmin\limits_{z'\in Z}p_f(y|\tilde{x_{z'}}) z=zZargminpf(yxz~)

Insert:

x ~ = x 1 ⋯ x i [ M A S K ] x i + 1 ⋯ x n \tilde{x} = x_1\cdots x_i [MASK] x_{i+1} \cdots x_n x~=x1xi[MASK]xi+1xn

i n s e r t ( x , i ) = x 1 ⋯ x i z x i + 1 ⋯ x n insert(x,i)=x_1\cdots x_i z x_{i+1} \cdots x_n insert(x,i)=x1xizxi+1xn

Merge: 就是二元词组换成一元词

x ~ = x 1 ⋯ x i − 1 [ M A S K ] x i + 2 ⋯ x n \tilde{x}=x_1\cdots x_{i-1} [MASK] x_{i+2} \cdots x_n x~=x1xi1[MASK]xi+2xn

m e r g e ( x , i ) = x 1 ⋯ x i − 1 z x i + 2 ⋯ x n merge(x,i)=x_1\cdots x_{i-1}z x_{i+2}\cdots x_n merge(x,i)=x1xi1zxi+2xn

对于输入序列每个位置,CLARE进行替换或插入或合并,之后通过语言建模模型和文本相似度函数构建候选令牌集,最小化正确标签的概率的令牌当作替代令牌。

Sequentially Applying the PErturbations

输入对: ( x , y ) (x,y) (x,y)

x x x的长度为 n n n,若候选集不为空,共进行 3 n 3n 3n个操作,操作为那三种,所有操作的应用操作表示为 a ( x ) a(x) a(x)

每一步都计算一个评分: s ( x , y ) ( a ) = − p f ( y ∣ a ( x ) ) s_{(x,y)}(a)=-p_f(y|a(x)) s(x,y)(a)=pf(ya(x))

每个位置只有一种操作被应用到。

在这里插入图片描述

Frequency-Guided Word Substitutions for Detecting Textual Adversarial Examples

作者:Xinghao Yang, Yongshun Gong et al.

单位:IEEE

来源:Trans on Cybernetics

Algorithm

Black Box settings

提供的:输入文本 x ∈ X x\in X xX,DNN模型 F F F,正确标签 y t r u e ∈ Y y_{true}\in Y ytrueY,i.e., F ( x ) = y t r u e F(x)=y_{true} F(x)=ytrue,由该目标函数优化得到: arg max ⁡ y i ∈ Y P ( y i ∣ x ) = y t r u e \argmax\limits_{y_i\in Y}P(y_i|x)=y_{true} yiYargmaxP(yix)=ytrue,或者用户特定目标标签: arg max ⁡ y i ∈ Y P ( y i ∣ x ∗ ) = y t a r g e t \argmax\limits_{y_i\in Y}P(y_i|x^*)=y_{target} yiYargmaxP(yix)=ytarget

Sementic Similarity

E n c o d e r Encoder Encoder U S E USE USE的编码器

U S E s c o r e = C o s i n e ( E n c o d e r ( x ) , E n c o d e r ( x a d v ) ) USE_{score}=Cosine(Encoder(x),Encoder(x_{adv})) USEscore=Cosine(Encoder(x),Encoder(xadv))

Bigram & Unigram Candidate Selection

使用WordNet (Synonym来源,假定WordNet的同义词空间为 W \mathbb{W} W) 跟HowNet (sememes,假定义元空间为 H \mathbb{H} H)。

  1. 创建候选集,

    • 给定输入句子 X = { w 1 , ⋯ , w n } X=\{w_1,\cdots, w_n\} X={w1,,wn},用WordNet判断 ( w i , w i + 1 ) (w_i, w_{i+1}) (wi,wi+1)是否有 w s y n ∗ ∈ W w^*_{syn}\in \mathbb{W} wsynW,没有则根据 w i w_i wi W \mathbb{W} W中选同义词以及从 H \mathbb{H} H中选候选义元,构成候选词集 S i ⊂ W ∪ H S_i\subset \mathbb{W}\cup \mathbb{H} SiWH。同时通过候选过滤器,选择相同POS tag的单词

    • w i w_i wi为命名实体,则通过加入更多NE候选词以拓展候选集

  2. 选择最佳候选:

    • 对于候选集 S i S_i Si,候选重要性分数为: I w i ′ = P ( y t r u e ∣ x ) − P ( y t r u e ∣ x i ′ ) , ∀ w i ′ ∈ S i I_{w'_i}=P(y_{true}|x)-P(y_{true}|x'_i), \forall w'_i\in \mathbb{S}_i Iwi=P(ytruex)P(ytruexi),wiSi,其中 x = [ w 1 , ⋯ , w i , ⋯ , w n ] x=[w_1,\cdots, w_i, \cdots, w_n] x=[w1,,wi,,wn] x i ′ = [ w 1 , ⋯ , w i ′ , ⋯ , w n ] x'_i=[w_1,\cdots,w'_i,\cdots, w_n] xi=[w1,,wi,,wn]

    • 最佳候选: w i ∗ = R ( w i , S i ) = arg max ⁡ w i ′ ∈ S i I w i ′ w^*_i=R(w_i,\mathbb{S}_i)=\argmax\limits_{w'_i\in \mathbb{S}_i} I_{{w}'_i} wi=R(wi,Si)=wiSiargmaxIwi

Semantic Preservation Optimization

SPO用于优化单词替代顺序优先级,通过三个目标:

  • 成功攻击

  • 最小替代

  • 语义不变

获得的 n n n个对抗语句: { x 1 ∗ , ⋯ , x n ∗ } \{x^*_1,\cdots, x^*_n\} {x1,,xn},从 X X X X i ∗ X^*_i Xi的差为最大攻击效果: △ P i ∗ = P ( y t r u e ∣ x ) − P ( y t r u e ∣ x i ∗ ) \triangle P^*_i=P(y_{true}|x)-P(y_{true}|x^*_i) Pi=P(ytruex)P(ytruexi),直接使用将可能导致替换陷入局部最优而非全局最优。

初始的迭代输入: G 0 \mathbb{G}^0 G0

阈值: M M M,限制单词被修改的数量

在这里插入图片描述
在这里插入图片描述

SPO with Semantic Filter (SPOF)

收集可能的对抗样本的空集: S u c A d v SucAdv SucAdv

Targeted Attack Strategy

考虑目标攻击时:

  1. 算法1 行18跟算法3 行19将修改为: F ( x a d v ) = y t a r g e t F(x_{adv})=y_{target} F(xadv)=ytarget

  2. I w i ′ = P ( y t a r g e t ∣ x i ′ ) − P ( y t a r g e t ∣ x ) , ∀ w i ′ ∈ S i I_{w'_i}=P(y_{target}|x'_i)-P(y_{target}|x), \forall w'_i\in \mathbb{S}_i Iwi=P(ytargetxi)P(ytargetx),wiSi

  3. △ P i ∗ = P ( y t a r g e t ∣ x i ∗ ) − P ( y t a r g e t ∣ x ) \triangle P^*_i=P(y_{target}|x^*_i) - P(y_{target}|x) Pi=P(ytargetxi)P(ytargetx)

  4. △ P a d v = P ( y t a r g e t ∣ x a d v ) − P ( y t a r g e t ∣ x ) \triangle P_{adv} = P(y_{target}|x_{adv}) - P(y_{target}|x) Padv=P(ytargetxadv)P(ytargetx)

Experiment

数据集:IMDB, AG’s News, Yahoo! Answers

受害模型:CNN、Ch-CNN、LSTM、Bi-LSTM

评估指标: A S R = ∑ x ∈ X { F ( x ) = y t r u e ∧ F ( x + △ x ) = y ∗ } ∑ x ∈ X { F ( x ) = y t r u e } ASR=\frac{\sum_{x_\in X}\{F(x)=y_{true}\wedge F(x+\triangle x)=y^*\}}{\sum_{x\in X}\{F(x)=y_{true}\}} ASR=xX{F(x)=ytrue}xX{F(x)=ytrueF(x+x)=y}

Universal Adversarial Triggers for Attacking and Analyzing NLP

作者:Eric Wallace, Shi Feng et al.

单位:Allen Institute for AI et al.

来源:ACL 2021

Abstract & Intro

universal adversarial triggers: input-agnostic sequences of tokens that trigger a model to produce a specific prediction when concatenated to any input from a dataset.

contribution: gradient-guided search over tokens which finds short trigger sequences that successfully trigger the target prediction

constraint: white-box attack to specific model (however, can transfer to other models)

triggers: a new form of universal adversarial perturbation adapted to discrete textual inputs.

finding:

  1. short sequences can trigger successfully.
  2. trigger can be used in transfer learning.
  3. identify heuristics learned by SQuAD models

Universal Adversarial Triggers

Setting and Motivation

universal adversarial attack:

  1. using the exact same attack for any input (Moosavi-Dezfooli 2017, Brown 2017)
  2. advantageous: no access to the target model at test time, trigger sequences can be widely distributed for anyone to fool machine learning models.
  3. transfer across models and don’t need white-box access to the target model (Moosavi-Dezfooli 2017)
Attack Model and Objective

model: f f f

a text input of tokens: t t t

target label: y ~ \tilde{y} y~

aim: f ( t a d v ; t ) = y ~ f(t_{adv};t)=\tilde{y} f(tadv;t)=y~

Universal Objective: arg ⁡ t a d v min ⁡ E t ∼ T [ L ( y ~ , f ( t a d v ; t ) ) ] \arg\limits_{t_{adv}}\min \mathbb{E}_{t\sim \Tau}[L(\tilde{y},f(t_{adv};t))] tadvargminEtT[L(y~,f(tadv;t))]

trigger token: e a d v i e_{adv_i} eadvi

Trigger Search Algorithm

Token Replacement Strategy: based on a linear approximation of the task loss.

update the embedding for e a d v i e_{adv_i} eadvi to minimize the loss: arg ⁡ e i ′ ∈ V min ⁡ [ e i ′ − e a d v i ] ⊤ ∇ e a d v i L \arg\limits_{e'_i\in V} \min [e'_i-e_{adv_i}]^\top \nabla_{e_{adv_i}} L eiVargmin[eieadvi]eadviL

set of all token embeddings: V V V

average gradient of the task loss: ∇ e a d v i L \nabla_{e_{adv_i}}L eadviL

e i ′ e'_i ei: computed in brute-force with |V|d dimensional dot products, d is the dimensionality of the token embedding.

Process Pic: 先算任务梯度 -> 遍历所有的token取极小 -> 获得极小的token -> 作为trigger结合语句计算概率分布 -> 继续重复以上步骤 -> 目标函数极小得到结果

augment: beam search, top-k token considered

外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

Tasks and Associated Loss Functions

Classification: bypass fake news detection by trigger.

Reading Comprehension: modify a web page in order to trigger malicious or vulgar answers, focus on why, who, when and where questions.

Conditional Text Generation: create triggers that are prepended before t to let model generate similar content to a set of targets Y. Maximize the likelihood of racist outputs by minimizing the following loss:
E ∑ i = 1 ∣ y ∣ log ⁡ ( 1 − p ( y i ∣ t ∗ a d v , t , y 1 , ⋯ , y i − 1 ) ) , y ∼ Y , t ∼ T \mathbb{E}\sum^{|y|}\limits_{i=1}\log(1-p(y_i|t^*{adv},t,y_1,\cdots,y_{i-1})), y\sim Y, t\sim \Tau Ei=1ylog(1p(yitadv,t,y1,,yi1)),yY,tT

Attacking Text Classification

two text classification datasets.

Sentiment Analysis: Stanford Sentiment Treebank, Bi-LSTM model, word2vec / ELMo embeddings.

Natural Language Inference: SNLI dataset, ESIM, DA-GloVe, DA-ELMo.

Breaking Sentiment Analysis

pre-avoid: use a lexicon to blacklist sentiment words. “zoning tapping fiennes” is a trigger.

ELMo-based Model: “uˆ{b”, “m&s~” are triggers, droping accuracy.

Breaking Natural Language Inference

motivation: threat the accuracy.

attack SNLI models, result is here: these trigger can degrade the three model’s accuracy to nearly 0.

the attack also readily transfer.

Attacking Reading Comprehension

motivation: answer the specific answer just like a backdoor to trigger

triggers for SQuAD: use an simple baseline and test the trigger’s transferability to more advanced models

embedding: GloVe

target answer: ‘to kill anmerican people’、‘donald trump’、‘january 2014’、‘new york’

question type: why, who, when, where.

Results:

transferability:

在这里插入图片描述

Analyzing The Trigger

Triggers Align With SNLI Artifacts:

  • dataset artifacts are successful triggers,‘no’、‘tv’、‘naked’ can drop accuracy.
  • entailment overlap bias

explain the triggers:

  • PMI Analysis: question-correlation answer triggers have high PMI values, P M I ( w o r d , c l a s s ) = log ⁡ p ( w o r d , c l a s s ) p ( w o r d ) p ( c l a s s ) PMI(word, class)=\log \frac{p(word, class)}{p(word)p(class)} PMI(word,class)=logp(word)p(class)p(word,class)
  • Question Type Matching
  • token order, Placement, and Removal: model is sensitive to token order, trigger is not very correlated with replacement, remove tokens can increase the success rate when transferring the triggers to black-box models.

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/32302.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

相对与绝对路径的关系

首先&#xff0c;我们一起来了解相对路径和绝对路径的概念&#xff1a; 相对路径&#xff1a;相对于当前工作目录的路径&#xff0c;不以 / 开头&#xff0c;以一个 ""、./、../、。例如&#xff1a;nginx、./nginx 或 ../nginx绝对路径&#xff1a;从根目录 / 开始…

java项目之基于ssm的在线学习系统(源码+文档)

项目简介 在线学习系统实现了以下功能&#xff1a; 该系统可以实现论坛管理&#xff0c;通知信息管理&#xff0c;学生管理&#xff0c;回答管理&#xff0c;教师管理&#xff0c;教案管理&#xff0c;公告信息管理&#xff0c;作业管理等功能。 &#x1f495;&#x1f495;作…

位运算刷题+总结

文章目录 判定字符是否唯一题解代码 丢失的数字题解代码 两整数之和题解代码 只出现一次的数字 II题解代码 消失的两个数字题解代码 总结 判定字符是否唯一 题目链接 题解 1. 哈希表&#xff0c;创建26个空间大小的哈希表 2. 位图&#xff0c;小写字符只有26个&#xff0c;…

Qt表格美化笔记

介绍 表格是一种常见的数据管理界面形式&#xff0c;在大批量的数据交互情形下使用的比较多 表格 可以通过样式表设置线条以及边框的颜色 QTableWidget { gridline-color : rgb(55, 60, 62); border: 1px solid rgb(62,112,181);}表头 如果表头和第一行的分割线显示&#…

【Godot4.2】Vector2向量插值的应用

求线段的等分点 extends Node2Dvar pos:Vector2 var split_num:int var p1 Vector2(200,200) var p2 Vector2(100,100)func _input(event: InputEvent) -> void:if event is InputEventMouseButton:if event.button_index MOUSE_BUTTON_WHEEL_DOWN:split_num clamp(spl…

Git使用(二)--如何配置 GitHub 远程仓库及本地 Git 环境

在日常的开发过程中&#xff0c;使用版本控制工具 Git 是一个非常重要的技能&#xff0c;特别是对于管理和协作开发。通过 GitHub&#xff0c;我们可以轻松地进行代码版本管理和共享。这篇博客将带您一步步学习如何配置 Git 环境并将本地仓库与 GitHub 远程仓库连接起来。 一、…

【算法工具】HDL: 基于摘要统计数据的高维连锁不平衡分析软件

## 前言 在基因组研究中&#xff0c;连锁不平衡(Linkage Disequilibrium, LD)分析是理解遗传变异之间关联的关键步骤。然而&#xff0c;当面对高维数据时&#xff0c;传统分析方法往往面临巨大计算挑战。今天为大家介绍一款强大的工具——HDL (High-Dimensional Linkage diseq…

MongoDB副本集部署完整教程

一般而言&#xff0c;副本集主要成员有三个&#xff1a;主节点&#xff0c;副本节点&#xff0c;仲裁节点 按照官方推荐方案&#xff0c;我们搭建一个三成员的副本集&#xff0c;这个副本集由一个主结点和两个副本结点组成。 这里采用三台虚拟机进行部署&#xff1a;node1(主节…

springcloud gateway通过数据库获取路由信息

在 Spring Cloud Gateway 中结合 MyBatis 动态从数据库加载路由配置&#xff0c;可以实现灵活的路由管理。以下是详细实现步骤&#xff1a; 1. 数据库表设计 创建路由配置表 gateway_route&#xff1a; CREATE TABLE gateway_route (id varchar(50) NOT NULL COMMENT 路由唯一…

蓝桥杯嵌入式组第十二届省赛题目解析+STM32G431RBT6实现源码

文章目录 1.题目解析1.1 分而治之&#xff0c;藕断丝连1.2 模块化思维导图1.3 模块解析1.3.1 KEY模块1.3.2 LED模块1.3.3 LCD模块1.3.4 TIM模块1.3.5 UART模块1.3.5.1 uart数据解析 2.源码3.第十二届题目 前言&#xff1a;STM32G431RBT6实现嵌入式组第十二届题目解析源码&#…

Git 的基本概念和使用方式(附有思维导图)

一、Git 简介 Git 是一个开源的分布式版本控制系统&#xff0c;由 Linus Torvalds 在 2005 年为帮助管理 Linux 内核开发版本而开发 。与集中式版本控制系统&#xff08;如 SVN&#xff09;不同&#xff0c;在分布式系统中&#xff0c;每个开发者的本地机器都拥有一个完整的 G…

【微服务】Nacos 配置动态刷新(简易版)(附配置)

文章目录 1、实现方法2、配置依赖 yaml3、验证效果 1、实现方法 环境&#xff1a;Nacos、Java、SpringBoot等 主要是在boostrap.yaml中的data-id属性下配置refresh:true来实现动态更新 2、配置依赖 yaml 具体的版本参考官方的说明&#xff1a;官方版本说明 <!--读取boo…

mac 被禁用docker ui后,如何使用lima虚拟机启动docker

本机macos 安装lima brew install lima创建配置 echo "\\ndynamic:\n big-sur:\n image: docker://docker:git\n linux:\n image: docker.io/limasoftware/ubuntu:20.04 \\n" > ~/.lima/default.yaml启动名叫default的虚拟机 limactl start default进…

WIFI无ip分配之解决方法(Solution to WiFi without IP allocation)

WIFI无ip分配之解决方法 在信息化无比发达的当下社会&#xff0c;电脑在日常生活中也发挥着巨大的作用&#xff0c;不管是电脑还是手机只有在网络环境中才能得到更好的运用。然而很多朋友在使用网络的时候都会遇到一些问题&#xff0c;最常见的就是无线网络连接上但是WiFi无IP…

bootloader相关部分

简单说明 程序烧录的方式主要有ICP,ISP,IAP 其中ICP就是常用的jlink等工具 ISP就是利用MCU自带的一些特殊引脚烧录&#xff0c;比如uart IAP就是利用用户写的bootloader代码烧录 bootloader主要分为三层&#xff0c;厂家出厂的bootrom ,用户自己写的bootloader&#xff0c;…

同盾v2 2025版 blackbox , wasm加解密,逆向协议算法生成,小盾安全

声明 本文章中所有内容仅供学习交流&#xff0c;抓包内容、敏感网址、数据接口均已做脱敏处理&#xff0c;严禁用于商业用途和非法用途&#xff0c;否则由此产生的一切后果均与作者无关&#xff0c;若有侵权&#xff0c;请联系我立即删除&#xff01; # 欢迎交流 wjxch1004

云平台一键部署【SGLang】适用于大型语言模型和视觉语言模型的快速服务框架

SGLang 是一个适用于大型语言模型和视觉语言模型的快速服务框架。它通过共同设计后端运行时和前端语言&#xff0c;使您与模型的交互更快、更可控。 优点&#xff1a; 1.吞吐量碾压级优势 2.结构化输出快如闪电 3.多 GPU 优化 SGLang模型已经在趋动云『社区项目』上线&am…

Matlab深度学习ResNet、迁移学习多标签图像分类及超分辨率处理Grad CAM可视化分析COCO、手写数字数据集...

全文链接&#xff1a;https://tecdat.cn/?p40982 在当今数字化时代&#xff0c;图像分类和图像超分辨率处理是计算机视觉领域的重要研究方向。深度学习技术的发展为解决这些问题提供了强大的工具。本文将详细介绍如何使用Matlab构建多标签图像分类模型和图像到图像的回归网络&…

驾培市场与低空经济无人机融合技术详解

随着科技的飞速发展和社会的不断进步&#xff0c;驾培市场正面临着前所未有的变革。传统汽车驾驶培训已不再是唯一的选择&#xff0c;无人机驾驶等新兴领域正逐渐成为驾培市场的重要组成部分。本报告旨在探讨驾培市场与低空经济的融合发展&#xff0c;特别是应用型人才培养与驾…

OpenHarmony-SELinux配置

前言&#xff1a; OpenHarmony 上某个进程向samgr注册SA服务&#xff0c;其他进程在与该进程进行IPC通信之前&#xff0c;需要获取该SA服务&#xff0c;SA提供方需要为该SA配置SELinux标签&#xff0c;否则该SA会被SELinux配置为u:object_r:default_service:s0标签&#xff0c…