{"id":18832923,"url":"https://github.com/declare-lab/trust-align","last_synced_at":"2025-04-14T04:31:24.608Z","repository":{"id":257700879,"uuid":"858734070","full_name":"declare-lab/trust-align","owner":"declare-lab","description":"Codes and datasets for the paper Measuring and Enhancing Trustworthiness of LLMs in RAG through Grounded Attributions and Learning to Refuse","archived":false,"fork":false,"pushed_at":"2025-03-03T08:00:13.000Z","size":2523,"stargazers_count":47,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T18:21:29.279Z","etag":null,"topics":["rag","retrieval-augmented-generation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/declare-lab.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-09-17T12:49:59.000Z","updated_at":"2025-03-25T08:45:42.000Z","dependencies_parsed_at":"2025-01-30T15:27:48.248Z","dependency_job_id":"b5cff65a-6beb-4f89-9e81-d855804dfaa1","html_url":"https://github.com/declare-lab/trust-align","commit_stats":null,"previous_names":["declare-lab/trust-align"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declare-lab%2Ftrust-align","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declare-lab%2Ftrust-align/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declare-lab%2Ftrust-align/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/declare-lab%2Ftrust-align/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/declare-lab","download_url":"https://codeload.github.com/declare-lab/trust-align/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248821699,"owners_count":21166932,"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":["rag","retrieval-augmented-generation"],"created_at":"2024-11-08T01:59:33.092Z","updated_at":"2025-04-14T04:31:24.602Z","avatar_url":"https://github.com/declare-lab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Measuring and Enhancing Trustworthiness of LLMs in RAG through Grounded Attributions and Learning to Refuse (ICLR 2025, Oral, top 1.8%)\n\n\u003e 📣 4/2/25: We have updated our repo structure to hopefully be more user friendly!\n\n\u003e 📣 31/1/25: We have open-sourced the Trust-Aligned models [here](https://huggingface.co/collections/declare-lab/trust-align-679491760dd03cc5f4d479e6)!\n\n\u003e 📣 22/1/25: This paper has been accepted to ICLR 2025!\n\nThis repository contains the original implementation of [Measuring and Enhancing Trustworthiness of LLMs in RAG through Grounded Attributions and Learning to Refuse](https://arxiv.org/abs/2409.11242) (accepted at ICLR 2025). There are two parts to this repository:\n\n1. Trust-Align: A preference dataset and framework that aligns LLMs to be more trustworthy, as measured by higher Trust-Score.\n\n2. Trust-Eval: A framework to evaluate the trustworthiness of inline-cited outputs generated by large language models (LLMs) within the Retrieval-Augmented Generation (RAG) setting.\n\n**Paper abstract:**\n\nLLMs are an integral part of retrieval-augmented generation (RAG) systems. While many studies focus on evaluating the quality of end-to-end RAG systems, there is a lack of research on understanding the appropriateness of an LLM for the RAG task. Thus, we introduce a new metric, Trust-Score, that provides a holistic evaluation of the trustworthiness of LLMs in an RAG framework. We show that various prompting methods, such as in-context learning, fail to adapt LLMs effectively to the RAG task. Thus, we propose Trust-Align, a framework to align LLMs for higher Trust-Score. LLaMA-3-8b, aligned with our method, significantly outperforms open-source LLMs of comparable sizes on ASQA (↑10.7), QAMPARI (↑29.2), and ELI5 (↑14.9).\n\n## Data\n\nThe **evaluation** dataset used in Trust-Eval is available on [Trust-Align Huggingface](https://huggingface.co/datasets/declare-lab/Trust-Score/tree/main/Trust-Score).\n\nThe **SFT and DPO training** dataset used in Trust-Align is also available [Trust-Align Huggingface](https://huggingface.co/datasets/declare-lab/Trust-Score/tree/main/Trust-Align).\n\n## Trust-Eval\n\nTrust-Eval quantifies trustworthiness on three main axis using Trust-Score:\n\n1. **Response Correctness**: Correctness of the generated claims\n2. **Attribution Quality**: Quality of citations generated. Concerns the recall (Are generated statements well-supported by the set citations?) and precision (Are the citations relevant to the statements?) of citations.\n3. **Refusal Groundedness**: Ability of the model to discern if the question can be answered given the documents\n\n\u003cimg src=\"assets/trust_score.png\" alt=\"Trust-Score\" width=\"100%\"\u003e\n\nWe release Trust-Eval as a standalone package. You can install by following the steps below:\n\n1. **Set up a Python environment**\n\n   ```bash\n   conda create -n trust_eval python=3.10.13\n   conda activate trust_eval\n   ```\n\n2. **Install dependencies**\n\n   ```bash\n   pip install trust_eval\n   ```\n\n   \u003e Note: that vLLM will be installed with CUDA 12.1. Please ensure your CUDA setup is compatible.\n\n3. **Set up NLTK**\n\n   ```bash\n   import nltk\n   nltk.download('punkt_tab')\n   ```\n\nPlease refer to [Trust-Eval README](./trust_eval/README.md) for more information.\n\n## Trust-Align\n\n\u003cimg src=\"assets/trust_align.png\" alt=\"Trust-Align\" width=\"100%\"\u003e\n\n### Set up\n\n```bash\nconda create -n cite python=3.10.13\nconda activate cite\npip install -r requirements.txt\n```\n\nWe use the latest version of `alignment-handbook` for training (ver `alignment-handbook-0.4.0.dev0`). We followed the installation instructions on [alignment-handbook repository](https://github.com/huggingface/alignment-handbook):\n\n```bash\ngit clone https://github.com/huggingface/alignment-handbook.git\ncd ./alignment-handbook/\npython -m pip install .\n```\n\nPlease refer to [Trust-Align README](./trust_align/README.md) for more information.\n\n## Bug or Questions?\n\nIf you have any questions related to the code or the paper, feel free to email Shang Hong (`simshanghong@gmail.com`). If you encounter any problems when using the code, or want to report a bug, you can open an issue. Please try to specify the problem with details so we can help you better and quicker!\n\n## Citation\n\nIf you find our code, data, models, or the paper useful, please cite the paper:\n\n```bibtex\n@misc{song2024measuringenhancingtrustworthinessllms,\n      title={Measuring and Enhancing Trustworthiness of LLMs in RAG through Grounded Attributions and Learning to Refuse}, \n      author={Maojia Song and Shang Hong Sim and Rishabh Bhardwaj and Hai Leong Chieu and Navonil Majumder and Soujanya Poria},\n      year={2024},\n      eprint={2409.11242},\n      archivePrefix={arXiv},\n      primaryClass={cs.CL},\n      url={https://arxiv.org/abs/2409.11242}, \n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeclare-lab%2Ftrust-align","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeclare-lab%2Ftrust-align","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeclare-lab%2Ftrust-align/lists"}