{"id":19839816,"url":"https://github.com/qdata/textattack-fragile-interpretations","last_synced_at":"2025-10-24T21:34:32.231Z","repository":{"id":45773566,"uuid":"403362715","full_name":"QData/TextAttack-Fragile-Interpretations","owner":"QData","description":null,"archived":false,"fork":false,"pushed_at":"2021-09-07T22:19:19.000Z","size":5908,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-11T11:26:31.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QData.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-05T16:48:41.000Z","updated_at":"2022-07-25T11:14:03.000Z","dependencies_parsed_at":"2022-08-28T13:40:13.372Z","dependency_job_id":null,"html_url":"https://github.com/QData/TextAttack-Fragile-Interpretations","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack-Fragile-Interpretations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack-Fragile-Interpretations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack-Fragile-Interpretations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QData%2FTextAttack-Fragile-Interpretations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QData","download_url":"https://codeload.github.com/QData/TextAttack-Fragile-Interpretations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241209564,"owners_count":19927736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T12:24:28.480Z","updated_at":"2025-10-24T21:34:32.138Z","avatar_url":"https://github.com/QData.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TextAttack-Fragile-Interpretations\nCode for the paper: [\"Perturbing Inputs for Fragile Interpretations in Deep Natural Language Processing\"](https://arxiv.org/abs/2108.04990)\n(EMNLP BlackboxNLP - 2021)\n\nPre-calculated candidates and interpretations are available on Google drive [here](https://drive.google.com/drive/folders/1U_bcpKa9OHR11z_o1EXo1QPzUcOxs5jT?usp=sharing). The results can be replicated by running the `results-metric.py` script. The exact commmands are detailed in Step-5.\n\nWe strongly recommend using `conda` to manage dependencies.\n\nRun `conda create -n frag-exp python=3.6` and subsequently `conda activate frag-exp`.\n\nRun `pip install -r requirements.txt`\n\n\nFollowing steps re-run the candidate generation process and re-calculate interpretations.\n\n1. Install `Textattack` from the `TextAttack` folder's `dist` folder  by installing the wheel: \n`pip install Textattack/dist/textattack-0.2.14-py3-none-any.whl`\n\n2. Run `python generate_candidates.py --model=distilbert --dataset=sst2 --number=500 --split=validation`. All options can be edited for different datasets and models. By default save paths are `./candidates`. \n\n3.  Run `python calculate_interpretations.py --model=distilbert --dataset=sst2 --interpretmethod=IG --number=500 --split=validation`. All options can be edited for different datasets and models. By default save paths are `./interpretations`. \n\n4. Once all interpretations have been calculated, run `python results-metrics.py --model=distilbert --dataset=sst2 --interpretmethod=IG --number=500 --split=validation --metric=rkc`.\n\nThe available metrics are `rkc (Rank Correlation)`, `topk (Top-K Intersection)`,`ppl (Perplexity)`, `grm (Grammar errors)` and `conf (Model Confidence)`. Results are stored in `./results`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdata%2Ftextattack-fragile-interpretations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqdata%2Ftextattack-fragile-interpretations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqdata%2Ftextattack-fragile-interpretations/lists"}