{"id":20114695,"url":"https://github.com/gatenlp/topicllm_granularity_hallucination","last_synced_at":"2026-06-10T10:31:33.083Z","repository":{"id":240591469,"uuid":"794509081","full_name":"GateNLP/TopicLLM_Granularity_Hallucination","owner":"GateNLP","description":"Addressing Topic Granularity and Hallucination in Large Language Models for Topic Modelling","archived":false,"fork":false,"pushed_at":"2024-06-09T23:01:22.000Z","size":7120,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-09T19:51:43.667Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/GateNLP.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-05-01T10:41:22.000Z","updated_at":"2024-11-29T07:25:46.000Z","dependencies_parsed_at":"2024-11-13T18:44:52.984Z","dependency_job_id":null,"html_url":"https://github.com/GateNLP/TopicLLM_Granularity_Hallucination","commit_stats":null,"previous_names":["gatenlp/topicllm_granularity_hallucination"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/GateNLP/TopicLLM_Granularity_Hallucination","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2FTopicLLM_Granularity_Hallucination","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2FTopicLLM_Granularity_Hallucination/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2FTopicLLM_Granularity_Hallucination/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2FTopicLLM_Granularity_Hallucination/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GateNLP","download_url":"https://codeload.github.com/GateNLP/TopicLLM_Granularity_Hallucination/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GateNLP%2FTopicLLM_Granularity_Hallucination/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34149132,"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-06-10T02:00:07.152Z","response_time":89,"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-13T18:31:24.524Z","updated_at":"2026-06-10T10:31:33.063Z","avatar_url":"https://github.com/GateNLP.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TopicLLM_Granularity_Hallucination\nAddressing Topic Granularity and Hallucination in Large Language Models for Topic Modelling\n\n```text\n#trl setup: https://huggingface.co/docs/trl/example_overview\npython == 3.10.9\ntorch == 2.1.2+cu121\ntransformers == 4.37.0.dev0\ntrl == 0.7.9\n```\n\n## set conda env:\n```bash\nconda env create -f topicllm.yml\n```\n\n## set Accelerate config file:\n```bash\n#to use Huggingface TRL, you’ll need to generate an Accelerate config file\n#also see: https://huggingface.co/docs/trl/example_overview\naccelerate config\n```\n\n## Develop DPO Training Sample (i.e., Re-construction Pipeline)\n([/GateNLP/TopicLLM_Granularity_Hallucination/blob/main/Create%20DPO%20Training%20Samples%20Pipeline.ipynb](https://github.com/GateNLP/TopicLLM_Granularity_Hallucination/blob/main/Create%20DPO%20Training%20Samples%20Pipeline.ipynb))\n\n## DPO Mistral 7B:\n```bash\n# code from Huggingface TRL\nCUDA_VISIBLE_DEVICES=[your_device] accelerate launch finetune_Mistral7b.py\n    --model_name_or_path=\"mistralai/Mistral-7B-Instruct-v0.1\"\n    --output_dir=\"mistral_new_Adapter\"\n```\n\n## Merge Adapter Mistral 7B:\n```bash\n# code from Huggingface TRL\nCUDA_VISIBLE_DEVICES=[your_device] python merge_peft_adapter.py\n    --base_model_name=\"mistralai/Mistral-7B-Instruct-v0.1\"\n    --adapter_model_name=\"mistral_new_Adapter\"\n    --output_dir=\"mistral_new_checkpoint\"\n```\n\n## To extract topics via LLMs:\n```bash\n# Please note that more than one GPU graphics card may be required to run LLaMA 13B models!\nCUDA_VISIBLE_DEVICES = \"Your_GPU\" python3 Seed_Topic_Dynamic.py\n```\n\n## To evaluate topics generated by LLMs\n```python\npython3 topic_evaluation.py\n```\n\n# Bibtex:\n```bibtex\n@article{mu2024addressing,\n  title={Addressing Topic Granularity and Hallucination in Large Language Models for Topic Modelling},\n  author={Mu, Yida and Bai, Peizhen and Bontcheva, Kalina and Song, Xingyi},\n  journal={arXiv preprint arXiv:2405.00611},\n  year={2024}\n}\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgatenlp%2Ftopicllm_granularity_hallucination","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgatenlp%2Ftopicllm_granularity_hallucination","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgatenlp%2Ftopicllm_granularity_hallucination/lists"}