今天是2023年8月26日,星期六,北京,天气阴。

昨晚刚从CCKS2023回来,今天上午参加一个论坛希做报告,并与一些朋友聊了聊行业大模型落地的一些有趣的问题,收获不少。

垂直行业的微调一直是个有趣的话题,我们今天继续跟踪一些有趣医疗领域的微调大模型,关注数据以及经验,供大家一起参考。

一、目前已有的医疗领域微调模型

在之前,我们已经分享了许多关于医疗领域的微调模型,部分脑图如下:

而目前也逐步更多的医疗领域微调模型出来,如下23个:

1、https://github.com/llSourcell/DoctorGPT

2、https://github.com/facebookresearch/llama-recipes

3、https://github.com/Kent0n-Li/ChatDoctor

4、https://github.com/hiyouga/LLaMA-Efficient-Tuning

5、https://github.com/michael-wzhu/ShenNong-TCM-LLM

6、https://github.com/michael-wzhu/ChatMed

7、https://github.com/SCIR-HI/Huatuo-Llama-Med-Chinese

8、https://github.com/SCIR-HI/Med-ChatGLM

9、https://github.com/xionghonglin/DoctorGLM

10、https://github.com/MediaBrain-SJTU/MING

11、https://github.com/CMKRG/QiZhenGPT

12、https://github.com/NLPxiaoxu/LLM-Pretrain-FineTune

13、https://github.com/scutcyr/BianQue

14、https://github.com/thomas-yanxin/Sunsimiao

15、https://github.com/kbressem/medAlpaca

16、https://github.com/FreedomIntelligence/HuatuoGPT

17、https://github.com/shibing624/MedicalGPT

18、https://github.com/chaoyi-wu/PMC-LLaMA

19、https://github.com/pariskang/CMLM-ZhongJing

20、https://github.com/SupritYoung/Zhongjing

21、https://medical.chat-data.com/

22、https://github.com/openmedlab/PULSE

23、https://github.com/WangRongsheng/CareLlama

二、医疗领域微调模型CareLlama

CareLlama ,是一个医疗大语言模型,集合了数十个公开可用的医疗微调数据集,该项目分享了一些有趣的项目实践经验,可供参考:

在CareLlama中并未对分词模型进行中文分词的添加和重新训练,但是效果依旧表现可喜;

全流程的LLM训练包括:预训练、监督微调、奖励模型、强化学习,多数情况下监督微调即可满足自身需求;

在算力充足情况下推荐使用医疗数据和通用语料数据进行训练,这样模型既可以有医学上的训练学习,也可以保持通用能力(如指令遵循);

不要指望一个医疗LLM就可以满足所有需求,合理的做法可能是实时更新的知识库+微调的医疗LLM(如ChatLaw);

BLOOMZ模型系列使用了PILE语料库进行训练,该语料库包含各种医学文本,包括PubMed Central和PubMed Abstracts等。这些宝贵的文本极大地丰富了BLOOMZ模型的医学知识体系,所以很多开源项目都会优先选择BLOOMZ做医学微调的底座模型;

项目地址:https://github.com/WangRongsheng/CareLlama

我们来关注下数据情况:

1、训练数据

首先是预训练数据,训练数据格式如下:

Machine learning (ML) is a field devoted to understanding and building methods that let machines "learn" – that is, methods that leverage data to improve computer performance on some set of tasks.

Machine learning algorithms build a model based on sample data, known as training data, in order to make predictions or decisions without being explicitly programmed to do so. Machine learning algorithms are used in a wide variety of applications, such as in medicine, email filtering, speech recognition, agriculture, and computer vision, where it is difficult or unfeasible to develop conventional algorithms to perform the needed tasks.

数据集:LLM-Pretrain-FineTune/data_pretrain

地址:https://github.com/X-jun-0130/LLM-Pretrain-FineTune/tree/main/data_pretrain

数据集:MedicalGPT/pretrain

地址:https://github.com/shibing624/MedicalGPT/tree/main/data/pretrain

数据集:zysj

地址:https://www.zysj.com.cn/

其次是,监督训练数据,训练数据格式如下:

多轮数据格式:

[
  {
    "instruction""听起来很不错。人工智能可能在哪些方面面临挑战呢?",
    "input""",
    "output""人工智能面临的挑战包括数据隐私、安全和道德方面的问题,以及影响就业机会的自动化等问题。",
    "history": [
      ["你好,你能帮我解答一个问题吗?""当然,请问有什么问题?"],
      ["我想了解人工智能的未来发展方向,你有什么想法吗?""人工智能在未来的发展方向可能包括更强大的机器学习算法,更先进的自然语言处理技术,以及更加智能的机器人。"]
    ]
  }
]

单轮数据格式:

[
  {
    "instruction""听起来很不错。人工智能可能在哪些方面面临挑战呢?",
    "input""",
    "output""人工智能面临的挑战包括数据隐私、安全和道德方面的问题,以及影响就业机会的自动化等问题。",
    "history": []
  }
]

数据集:icliniq-10k(en)
地址:https://drive.google.com/file/d/1ZKbqgYqWc7DJHs3N9TQYQVPdDQmZaClA/view?usp=sharing

数据集:HealthCareMagic-100k (en) 地址:https://drive.google.com/file/d/1lyfqIwlLSClhgrCutWuEe_IACNq6XNUt/view?usp=sharing

数据集:ShenNong_TCM_Dataset

地址:https://huggingface.co/datasets/michaelwzhu/ShenNong_TCM_Dataset

数据集:ChatMed_Consult_Dataset

地址:https://huggingface.co/datasets/michaelwzhu/ChatMed_Consult_Dataset

数据集:Chinese-medical-dialogue-data

地址:https://github.com/Toyhom/Chinese-medical-dialogue-data

数据集:cMedQA2

地址:https://github.com/zhangsheng93/cMedQA2

数据集:Huatuo-26M

地址:https://github.com/FreedomIntelligence/Huatuo-26M

数据集:cMedQA2

地址:https://github.com/zhangsheng93/cMedQA2

数据集:webMedQA

地址:https://github.com/hejunqing/webMedQA

数据集:PubMedQA

地址:https://pubmedqa.github.io/

数据集:CMCQA

地址:https://github.com/WENGSYX/CMCQA

数据集:QiZhenGPT

地址:https://github.com/CMKRG/QiZhenGPT/tree/main/data

数据集:LLM-Pretrain-FineTune/data_sft

地址:https://github.com/X-jun-0130/LLM-Pretrain-FineTune/tree/main/data_sft

数据集:Medical-Dialogue-System

地址:https://github.com/UCSD-AI4H/Medical-Dialogue-System

数据集:IMCS-V2

地址:https://github.com/lemuria-wchen/imcs21

数据集:CHIP-MDCFNPC

地址:https://tianchi.aliyun.com/dataset/95414

数据集:MedDG

地址:https://tianchi.aliyun.com/dataset/95414

数据集:HuatuoGPT-sft-data-v1

地址:https://huggingface.co/datasets/FreedomIntelligence/HuatuoGPT-sft-data-v1

数据集:MedicalGPT/finetune

地址:https://github.com/shibing624/MedicalGPT/tree/main/data/finetune

数据集:shibing624/medical

地址:https://huggingface.co/datasets/shibing624/medical

数据集:medAlpaca/data

地址:https://github.com/kbressem/medAlpaca#data-overview

数据集:Zhongjing/sft

地址:https://github.com/SupritYoung/Zhongjing/tree/main/data

数据集:medical_dialog

地址:https://huggingface.co/datasets/medical_dialog

数据集:huatuo_encyclopedia_qa

地址:https://huggingface.co/datasets/FreedomIntelligence/huatuo_encyclopedia_qa

数据集:Chinese-medical-dialogue-data

地址:https://huggingface.co/datasets/BillGPT/Chinese-medical-dialogue-data

数据集:Med-ChatGLM/data

地址:https://github.com/SCIR-HI/Med-ChatGLM/tree/main/data

数据集:CMB

地址:https://github.com/FreedomIntelligence/CMB

数据集:GenMedGPT-5k

地址:https://drive.google.com/file/d/1nDTKZ3wZbZWTkFMBkxlamrzbNz0frugg/view?usp=sharing

3、奖励训练数据

训练数据格式如下:

数据集:MedicalGPT/reward

地址:https://github.com/shibing624/MedicalGPT/tree/main/data/reward

数据集:Zhongjing/rw

地址:https://github.com/SupritYoung/Zhongjing/tree/main/data

数据集:comparison_gpt4_data

地址:https://huggingface.co/datasets/wangrongsheng/comparison_gpt4_data

数据集:HH-RLHF

地址:https://huggingface.co/datasets/Anthropic/hh-rlhf

2、人设注入的训练数据

人设信息也是大模型训练的一个重要点,这个可以在某种程度上回避一些大模型所属版权的问题。

[
  {
    "instruction""你好",
    "input""",
    "output""您好,我是 <NAME>,一个由 <AUTHOR> 开发的 AI 助手,很高兴认识您。请问我能为您做些什么?"
  },
  {
    "instruction""你如何描述自己?",
    "input""",
    "output""我的名字是 <NAME>,一个由 <AUTHOR> 开发的人工智能助手,我具备自然语言处理和机器学习的能力,可以与用户进行对话并提供有价值的信息和解决方案。"
  },
 
  {
    "instruction""作为ChatGPT,你的功能是什么?",
    "input""",
    "output""抱歉,我不是 ChatGPT,我是 <NAME>,由 <AUTHOR> 开发,旨在为用户提供智能化的回答和帮助。"
  },
  {
    "instruction""OpenAI为什么要制作你?",
    "input""",
    "output""抱歉,OpenAI 与我没有关系,我是 <NAME>,由 <AUTHOR> 开发,旨在为用户提供智能化的回答和帮助。"
  },
  {
    "instruction""你是OpenAI开发的ChatGPT吗?",
    "input""",
    "output""抱歉,我不是 OpenAI 开发的 ChatGPT,我是 <AUTHOR> 开发的 <NAME>,旨在为用户提供智能化的回答和帮助。"
  }
]

总结

垂直行业的微调一直是个有趣的话题,本文跟踪跟踪一些有趣医疗领域的微调大模型,关注数据以及其特点,供大家一起参考。

CareLlama 医疗大语言模型,集合了数十个公开可用的医疗微调数据集,该项目分享了一些有趣的项目实践经验,这个大家可以作为参考。

该项目中所收集的一些医疗领域的数据,也很有帮助,感兴趣的也可以关注下。

参考文献

1、https://github.com/WangRongsheng/CareLlama

关于我们

老刘,刘焕勇,NLP开源爱好者与践行者,主页:https://liuhuanyong.github.io。

老刘说NLP,将定期发布语言资源、工程实践、技术总结等内容,欢迎关注。

对于想加入更优质的知识图谱、事件图谱、大模型AIGC实践、相关分享的,可关注公众号,在后台菜单栏中点击会员社区->会员入群加入。


内容中包含的图片若涉及版权问题,请及时与我们联系删除