[Feature] Add a command to save all transformed query attacks · Issue #348 · QData/TextAttack · GitHub
Skip to content

[Feature] Add a command to save all transformed query attacks #348

Open

Description

@threemmm

A command to save all transformed query attacks with their details such as the model output confidence is needed for people who work on attack detection systems especially for the black-box attacks in which they need a sequence of all queries that an attacker makes to fool the model. I'm working on algorithms to detect the attacks and I need sequences of attack queries, so a command for it could be useful.

Activity

  1. jxmorris12 commented on Nov 19, 2020

    @jxmorris12
    Collaborator

    Hey @threemmm -- thanks for the suggestion! To be specific: you're suggesting a feature in which we save intermediate transformed texts and their scores to a file, not just the last transformation, right?

  2. added a commit that references this issue on Nov 19, 2020
  3. threemmm commented on Nov 19, 2020

    @threemmm
    Author

    Hey @jxmorris12 , thank you for your awesome package.
    Yes, exactly. I did it by adding "--save-sequences-csv" command, and I tried to follow your structure to save them (adding a new class to logger, and save into a file by flush() at the end of the process). However, it doesn't work well with all search methods, as I return the result of "get_goal_results()" in addition to the final perturbed result in search methods to quickly meet my need.
    I tested with textbugger recipe and albert-base-v2-sst2 , and the output was as the photo below
    --recipe textbugger --model albert-base-v2-sst2 --save-sequences-csv --num-examples 3

    github

    I'd like to hear your thoughts.

  4. github-actions commented on Jan 19, 2021

    @github-actions

    Stale issue message

  5. qiyanjun commented on Jan 22, 2021

    @qiyanjun
    Member

    Good enhancement to add.. Will update.

  6. qiyanjun commented on Aug 13, 2026

    @qiyanjun
    Member

    This is still a reasonable ask (and @threemmm's prototype comment shows it's mostly a new logger class), but a proper implementation needs to work across all search methods consistently, which @threemmm noted their prototype didn't fully solve. That's real design/engineering work rather than a bounded fix, so leaving this open rather than guessing at an implementation. Anyone interested in picking this up: the natural shape is a new logger (similar to the existing CSV/JSON loggers) that hooks into each search method's intermediate `get_goal_results()` calls rather than just the final result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions