{"id":19646625,"url":"https://github.com/amzn/informative-diverse-hard-negative-sampling","last_synced_at":"2025-04-30T14:26:34.375Z","repository":{"id":226854514,"uuid":"761133232","full_name":"amzn/informative-diverse-hard-negative-sampling","owner":"amzn","description":"Experimental code for our paper on informative and diverse sampling of negative examples for dense retrieval","archived":false,"fork":false,"pushed_at":"2024-03-10T04:52:41.000Z","size":7182,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T14:26:27.886Z","etag":null,"topics":["active-learning","dense-retrieval","information-retrieval","negative-sampling"],"latest_commit_sha":null,"homepage":"https://www.amazon.science/publications/indi-informative-and-diverse-sampling-for-dense-retrieval","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/amzn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2024-02-21T09:53:55.000Z","updated_at":"2024-05-15T11:49:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec4c2c7a-a8e4-4189-bb00-36eaa63f2f1a","html_url":"https://github.com/amzn/informative-diverse-hard-negative-sampling","commit_stats":null,"previous_names":["amzn/informative-diverse-hard-negative-sampling"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amzn%2Finformative-diverse-hard-negative-sampling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amzn%2Finformative-diverse-hard-negative-sampling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amzn%2Finformative-diverse-hard-negative-sampling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amzn%2Finformative-diverse-hard-negative-sampling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amzn","download_url":"https://codeload.github.com/amzn/informative-diverse-hard-negative-sampling/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251721004,"owners_count":21632753,"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":["active-learning","dense-retrieval","information-retrieval","negative-sampling"],"created_at":"2024-11-11T14:39:31.886Z","updated_at":"2025-04-30T14:26:34.328Z","avatar_url":"https://github.com/amzn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InDi: Informative and Diverse Sampling for Dense Retrieval\nInDi is an extension of the popular [Tevatron package](https://github.com/texttron/tevatron/) ([commit](https://github.com/texttron/tevatron/commit/b8f33900895930f9886012580e85464a5c1f7e9a)), adding a novel procedure for selecting negative samples. \nSpecifically, it is inspired by ideas from the Active Learning field to find samples on which the model is uncertain about while ensuring high diversity.\n\n## Instructions\n\n### Prerequisite\nTo run InDi it is necessary to have the MS-MARCO corpus, train a baseline tevatron model (called S1), and compute vector embeddings to all documents in the corpus. \nTo do that, please follow instructions at  https://github.com/texttron/tevatron/blob/main/examples/coCondenser-marco/README.md (up to and including https://github.com/texttron/tevatron/blob/main/examples/coCondenser-marco/README.md#search)\nThe following output files are generated in this process (and must appear in the `resources` directory):\n* `corpus/*.json` - the tokenized MS-MARCO corpus.\n* `encoding/*.pt` - the vector embeddings generated by the S1 model (of the MS-MARCO corpus).\n* `qrels.train.tsv` - the QRels file of the training dataset.\n* `scores/*.parquet` - dual encoder (and optional, cross encoder score) for the top-200 documents retrieved by model S1. The file contains the following columns: `qid`, `docid`, `de_score`, `ce_score` (optional).\n* `train.query.txt` - the queries in the training dataset.\n\nFor evaluation the QRels file must be downloaded from https://microsoft.github.io/msmarco/.\n\n### Running\nIn order to execute InDi run:\n```\npython -m active_learning.main_marco\n```\n\n## Citation\nIf you find InDi helpful, please consider citing our [paper](https://www.amazon.science/publications/indi-informative-and-diverse-sampling-for-dense-retrieval).\n```\n@article{cohen2024indi,\n  title={InDi: Informative and diverse sampling for dense retrieval},\n  author={Cohen, Nachshon and Indelman, Hedda Cohen and Fairstein, Yaron and Kushilevitz, Guy},\n  journal={ECIR},\n  year={2024}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famzn%2Finformative-diverse-hard-negative-sampling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famzn%2Finformative-diverse-hard-negative-sampling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famzn%2Finformative-diverse-hard-negative-sampling/lists"}