The invention discloses a hard tag text adversarial
attack sample generation method, which belongs to the technical field of text adversarial sample generation, and comprises the following steps: determining a text adversarial sample target; binary phrases are constructed for the original samples, and initial confrontation samples are generated by preferentially replacing the binary phrases; replacing unnecessary synonyms with original words; searching
synonym iteration replacement optimization confrontation samples by determining transition replacement words; according to the hard tag text adversarial
attack sample generation method, in an adversarial sample initialization stage, firstly, a high-frequency binary
phrase is replaced to improve the quality of a generated initial adversarial sample; in the confrontation sample optimization stage, a relatively simple and effective mode is adopted to carry out iterative optimization, a generative method is not adopted any more, consumption of too much query times is avoided, the quality and efficiency of generating the confrontation sample are improved, the quality of the confrontation sample is remarkably improved in an
attack scene closer to reality, and meanwhile, the query cost is reduced. And the query cost is reduced while the generation quality of the adversarial sample is improved.