{"id":18428967,"url":"https://github.com/codefuse-ai/d2llm","last_synced_at":"2025-10-10T15:01:20.028Z","repository":{"id":247339910,"uuid":"815098102","full_name":"codefuse-ai/D2LLM","owner":"codefuse-ai","description":null,"archived":false,"fork":false,"pushed_at":"2024-07-23T04:11:16.000Z","size":918,"stargazers_count":30,"open_issues_count":1,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-10T00:43:33.788Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codefuse-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-06-14T10:51:46.000Z","updated_at":"2025-02-27T03:34:54.000Z","dependencies_parsed_at":"2024-07-08T07:58:41.375Z","dependency_job_id":"c7d84fb3-5e6e-438c-afe6-4369f91bd685","html_url":"https://github.com/codefuse-ai/D2LLM","commit_stats":null,"previous_names":["codefuse-ai/d2llm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codefuse-ai/D2LLM","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefuse-ai%2FD2LLM","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefuse-ai%2FD2LLM/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefuse-ai%2FD2LLM/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefuse-ai%2FD2LLM/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codefuse-ai","download_url":"https://codeload.github.com/codefuse-ai/D2LLM/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codefuse-ai%2FD2LLM/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273983110,"owners_count":25202095,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"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":[],"created_at":"2024-11-06T05:15:11.038Z","updated_at":"2025-10-10T15:01:14.986Z","avatar_url":"https://github.com/codefuse-ai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# D2LLM: Decomposed and Distilled Large Language Models for Semantic Search\n\nThis is the Pytorch implementation of D2LLM in the ACL'24 paper: D2LLM: Decomposed and Distilled Large Language Models for Semantic Search.\n\n![The network architecture of D2LLM.](./img/Figure_1.png)\n\u003ccenter\u003e\u003cb\u003eFigure 1.\u003c/b\u003e The network architecture of D2LLM.\u003c/center\u003e\n\n## Requirements\n\n* Ubuntu OS\n* python==3.10\n* torch==2.0.1\n* cuda==11.7\n* transformers==4.37.0\n* deepspeed==0.14.2\n* flash-attn==2.3.6\n* peft==0.7.0\n\nDependencies can be installed by:\n\n    pip install -r requirements.txt\n\n\nThe overall directory structure is as follows:\n\n    ${CODE_ROOT}\n        ......\n        |-- preprocess\n            |-- save_hardneg_bm25.py\n            |-- save_hardneg_bi.py\n            |-- save_logits.py\n        |-- dataset\n        \t\t|-- dataset.py\n        |-- model\n        \t\t|-- pro_model.py\n        |-- utils\n        \t\t|-- common_utils.py\n        |-- train.py\n        |-- train.sh\n\n\n\n## Data preparetion\n\nThe six datasets (SNLI-zh, NLI-zh, T2Ranking, DuReader, cMedQA2 and mMARCO) used in this paper can be downloaded from the following links:\n\n* [SNLI-zh](https://huggingface.co/datasets/shibing624/snli-zh)\n* [NLI-zh](https://huggingface.co/datasets/shibing624/nli_zh)\n* [T2Ranking](https://github.com/THUIR/T2Ranking)\n* [DuReader](https://github.com/baidu/DuReader)\n* [cMedQA2](https://github.com/zhangsheng93/cMedQA2)\n* [mMARCO](https://huggingface.co/datasets/unicamp-dl/mmarco)\n\nBefore performing training, we mine hard negatives through BM25 and other bi-encoder evaluations using scripts save_hardneg_bm25.py and save_hardneg_bi.py. Then, we use the script save_logits.py to perform correlation scoring on in-batch negatives and hard negatives through LLM. \n\n## Train\n\nTo perform training, just adjust the parameters and run:\n\n    sh train.sh\n\n## Evaluate\n\nEvaluation can be done throw the mteb tools. Note that the cosine similarity should be replace by the IEM module.\n\n## Citation\n\n    @inproceedings{\n    anonymous2024dllm,\n    title={D2{LLM}: Decomposed and Distilled Large Language Models for Semantic Search},\n    author={Anonymous},\n    booktitle={The 62nd Annual Meeting of the Association for Computational Linguistics},\n    year={2024}\n    }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefuse-ai%2Fd2llm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodefuse-ai%2Fd2llm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodefuse-ai%2Fd2llm/lists"}