{"id":32521950,"url":"https://github.com/raghu150999/bileat_e2e_absa","last_synced_at":"2026-07-06T08:31:53.296Z","repository":{"id":81424060,"uuid":"314772327","full_name":"Raghu150999/BILEAT_E2E_ABSA","owner":"Raghu150999","description":"BERT based deep neural network for aspect-based sentiment analysis.","archived":false,"fork":false,"pushed_at":"2020-12-23T04:50:28.000Z","size":14268,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-28T06:47:54.190Z","etag":null,"topics":["adversarial-machine-learning","aspect-based-sentiment-analysis","bert","black-box-attacks","deep-learning","nlp","white-box-attacks"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Raghu150999.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-21T09:03:48.000Z","updated_at":"2021-10-21T17:54:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"aa544eec-7abe-40c9-9f98-89f574b772de","html_url":"https://github.com/Raghu150999/BILEAT_E2E_ABSA","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Raghu150999/BILEAT_E2E_ABSA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raghu150999%2FBILEAT_E2E_ABSA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raghu150999%2FBILEAT_E2E_ABSA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raghu150999%2FBILEAT_E2E_ABSA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raghu150999%2FBILEAT_E2E_ABSA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Raghu150999","download_url":"https://codeload.github.com/Raghu150999/BILEAT_E2E_ABSA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Raghu150999%2FBILEAT_E2E_ABSA/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35184015,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-06T02:00:07.184Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["adversarial-machine-learning","aspect-based-sentiment-analysis","bert","black-box-attacks","deep-learning","nlp","white-box-attacks"],"created_at":"2025-10-28T06:47:53.195Z","updated_at":"2026-07-06T08:31:53.288Z","avatar_url":"https://github.com/Raghu150999.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BILEAT_E2E_ABSA\n\nBERT-based Interactive Learning with Ensemble Adversarial Training\n\n\u003cimg src=\"BILEAT_Architecture.png\" width=1200/\u003e\n\n## Requirements\n- Install requirements using `requirements.txt`\n```\npip install -r requirements.txt\n```\n- To filter out antonyms we use word embeddings used by [Jin, Di, et al.](https://arxiv.org/abs/1907.11932). You can download that from [here](https://drive.google.com/file/d/1bayGomljWb6HeYDMTDKXrh0HackKtSlx/view). Place it in the root directory before running code for generating adversarial examples.\n\n## Getting Started\n### White Box Domain Knowledge BERT (WBDK-BERT)\nFor white-box adversarial post training of DK-BERT, we use the Amazon Laptop review and Yelp restaurant review datasets from [here](https://github.com/ruidan/IMN-E2E-ABSA). Any other dataset can be used as well just by replacing the `laptop.txt` and `rest.txt` file contents.\nTo start the training, inside the `WBDK-BERT/scripts` directory run:\n```bash\n$ bash pt.sh laptop 5 2000 0\n```\n```bash\n$ bash pt.sh rest 1 2000 0\n```\nhere, 5 and 1 are the data duplication factors, 2000 is the number of training steps (*we actually save models at every 500 steps*).\n\nNow, the trained models will be save in `WBDK-BERT/{domain}_pt_adv` directory which will be then loaded later for use by BILEAT.\n\n*Optional*\nYou can either start training from scratch by loading BERT-base and performing adversarial post-training on top of that (which is computationally expensive) or by loading post-trained domain knowledge BERT (DK-BERT) and continue adversarial post-training for reduced number of iterations.\nFor training from scratch using BERT-base, set `BERT` attribute in `WBDK-BERT/scripts/pt.sh` to `bert-base`. Use `70000` and `140000` iterations respectively.\n\n### Generating Black-box adversarial examples\n\n1.  Replace `BILEAT` with `BERTLINEAR` in `absa_layer.py` line `133`.\n\n2. Run `gen_adv.sh`. This first trains `BERT + Linear` model to get the target model, then performs black-box attack to generate adversarial examples.\n\nThe output is stored in `{domain}_adv` directory.\n\n### Running BILEAT\nAfter completing the above two steps, run:\n```bash\n$ bash train.sh\n```\nThis will first load the post-trained `WBDK-BERT` model from `{domain}_adv` and train the model using `BILEAT` architecture along with adversarial data generated earlier using `BERT + Linear`.\n\n### Adversarial Data\nWe provide quality adversarial examples generated by us for SemEval14 laptop and SemEval combined restaurant data. You can find them under `data/laptop14_adv` and `data/rest_total_adv` respectively.\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghu150999%2Fbileat_e2e_absa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraghu150999%2Fbileat_e2e_absa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraghu150999%2Fbileat_e2e_absa/lists"}