paulwong

2025年1月15日 #

大模型微调后的评估指标

大模型微调后的评估指标是衡量模型性能的关键,通常根据任务类型和具体需求选择不同的评估指标。以下是一些常见的评估指标及其适用场景:


1. 分类任务

  • 准确率(Accuracy):预测正确的样本占总样本的比例。
    • 适用场景:类别分布均衡的任务。
  • 精确率(Precision):预测为正类的样本中,实际为正类的比例。
    • 适用场景:关注减少假阳性(False Positive)的任务。
  • 召回率(Recall):实际为正类的样本中,预测为正类的比例。
    • 适用场景:关注减少假阴性(False Negative)的任务。
  • F1分数(F1 Score):精确率和召回率的调和平均值。
    • 适用场景:类别不平衡或需要平衡精确率和召回率的任务。
  • ROC-AUC:ROC曲线下的面积,衡量模型区分正负类的能力。
    • 适用场景:二分类任务,尤其是类别不平衡的情况。

2. 回归任务

  • 均方误差(MSE, Mean Squared Error):预测值与真实值之差的平方的平均值。
    • 适用场景:对误差较大的样本惩罚更重的任务。
  • 均方根误差(RMSE, Root Mean Squared Error):MSE的平方根。
    • 适用场景:与MSE类似,但更接近原始数据尺度。
  • 平均绝对误差(MAE, Mean Absolute Error):预测值与真实值之差的绝对值的平均值。
    • 适用场景:对异常值不敏感的任务。
  • R²(决定系数):模型解释目标变量方差的比例。
    • 适用场景:评估模型拟合优度。

3. 生成任务

  • BLEU(Bilingual Evaluation Understudy):衡量生成文本与参考文本的n-gram重叠程度。
    • 适用场景:机器翻译、文本生成任务。
  • ROUGE(Recall-Oriented Understudy for Gisting Evaluation):衡量生成文本与参考文本的重叠程度,侧重于召回率。
    • 适用场景:文本摘要、生成任务。
  • METEOR:综合考虑精确率、召回率和词序的评估指标。
    • 适用场景:机器翻译、文本生成任务。
  • Perplexity(困惑度):衡量模型预测概率分布的不确定性。
    • 适用场景:语言模型评估。

4. 多标签任务

  • Hamming Loss:预测错误的标签比例。
    • 适用场景:多标签分类任务。
  • Jaccard Similarity:预测标签与真实标签的交集与并集之比。
    • 适用场景:多标签分类任务。

5. 排序任务

  • NDCG(Normalized Discounted Cumulative Gain):衡量排序结果的相关性。
    • 适用场景:推荐系统、信息检索。
  • MAP(Mean Average Precision):平均精确率的均值。
    • 适用场景:信息检索、推荐系统。

6. 其他指标

  • 训练时间:模型微调所需的时间。
  • 推理速度:模型生成结果的速度。
  • 资源消耗:模型运行所需的计算资源(如GPU内存、CPU使用率)。
  • 鲁棒性:模型对噪声、异常值或对抗样本的抵抗能力。

7. 领域特定指标

  • 医学领域:敏感性(Sensitivity)、特异性(Specificity)、AUC-ROC。
  • 金融领域:收益曲线、夏普比率(Sharpe Ratio)。
  • 计算机视觉:mAP(mean Average Precision)、IoU(Intersection over Union)。

8. 人类评估

  • 人工评分:通过人工评估生成结果的质量(如流畅性、相关性、准确性)。
  • 用户满意度:通过用户反馈评估模型的实际效果。

9. 模型对比

  • 基线对比:与未微调的模型或基线模型进行性能对比。
  • 消融实验:评估微调过程中不同组件(如数据、超参数)对性能的影响。

10. 综合评估

  • 多指标综合:根据任务需求,结合多个指标进行综合评估。
  • 任务特定指标:针对特定任务设计自定义指标。

在实际应用中,选择合适的评估指标需要结合任务目标、数据特点和业务需求,同时注意避免单一指标的局限性。

posted @ 2025-03-12 10:08 paulwong 阅读(33) | 评论 (0)编辑 收藏

LLM全栈框架完整分类清单(预训练+微调+工具链)

https://blog.csdn.net/ViniJack/article/details/145789900



posted @ 2025-03-10 11:29 paulwong 阅读(11) | 评论 (0)编辑 收藏

医疗问诊系统资源

计算机毕业设计Python+Neo4j知识图谱医疗问答系统 大模型
https://baijiahao.baidu.com/s?id=1815574648931972744&wfr=spider&for=pc

QABasedOnMedicaKnowledgeGraph
https://github.com/liuhuanyong/QASystemOnMedicalKG/blob/master/README.md

非结构文字抽取实体与关系的大模型
底座, 百川 https://huggingface.co/baichuan-inc/Baichuan2-13B-Chat/tree/main
底座, llama2 https://huggingface.co/unsloth/llama-2-13b
微调->百川 https://huggingface.co/zjunlp/baichuan2-13b-iepile-lora
微调->llama2 https://huggingface.co/zjunlp/llama2-13b-iepile-lora

SiameseUniNLU通用自然语言理解模型
https://www.modelscope.cn/models/iic/nlp_structbert_siamese-uninlu_chinese-base/summary

数据集
https://huggingface.co/datasets/zjunlp/iepile













posted @ 2025-03-08 20:52 paulwong 阅读(18) | 评论 (0)编辑 收藏

使用nlp提取非结构化数据中的信息

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); 如果要从结构化的数据中提取信息,用sql即可, 即要提取的信息在select 的字段中.

如果要从非结构化的数据中, 如纯文本, 则要靠nlp, 要对文本理解后, 才能提取相应的信息.

https://www.w3cschool.cn/article/99991254.html

文本结构化 with SpaCy 攻略
https://zhuanlan.zhihu.com/p/556163162
https://zhuanlan.zhihu.com/p/557953165
https://zhuanlan.zhihu.com/p/563334531
https://zhuanlan.zhihu.com/p/573743734

使用openspg自动构建医疗知识图谱
https://blog.csdn.net/myboyliu2007/article/details/139654943

posted @ 2025-03-08 11:45 paulwong 阅读(8) | 评论 (0)编辑 收藏

AI案例资源

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
从实践案例介绍大模型应用经验和思考
https://mp.weixin.qq.com/s/hcD0-z9Y4PsrILUgHdqGcQ

LLaMA Factory:微调DeepSeek-R1-Distill-Qwen-7B模型实现新闻标题分类器
https://gallery.pai-ml.com/#/preview/deepLearning/nlp/llama_factory_deepseek_r1_distill_7b

deepseek r1微调模型应用落地案例(医疗法律,PatientSeek)
https://www.bilibili.com/video/BV17zAVevEtw/?spm_id_from=333.788.recommend_more_video.0&vd_source=35b81999db00535703a287d5c98652b1

文本转语音的模型ChatTTS体验极佳,真人般丝滑和流畅,自定义也比较灵活
https://www.bilibili.com/video/BV1oJ4m1u7B8/?spm_id_from=333.1387.upload.video_card.click&vd_source=35b81999db00535703a287d5c98652b1

医疗NLP领域 评测/比赛,数据集,论文和预训练模型资源汇总。
https://github.com/FreedomIntelligence/Medical_NLP

posted @ 2025-02-26 16:01 paulwong 阅读(19) | 评论 (0)编辑 收藏

满血版Deepseek R1全网资源

官网
https://chat.deepseek.com

腾讯, 需下载客户端
https://ima.qq.com

阿里, 需自建对话应用, 有网页版
https://tbox.alipay.com/

askmanyai
https://askmanyai.cn

360纳米搜索, 无网页版, 需自行下载app


posted @ 2025-02-15 23:10 paulwong 阅读(64) | 评论 (0)编辑 收藏

量化资源

GPTQ、GGUF、AWQ 大语言模型量化方法对比(转载) 
https://caovan.com/gptqggufawq-dayuyanmoxinglianghuafangfaduibizhuanzai/.html

posted @ 2025-02-08 23:31 paulwong 阅读(64) | 评论 (0)编辑 收藏

DeepSeek背后的数学:深入研究群体相对策略优化(GRPO)

     摘要: 本博客深入探讨了群体相对策略优化(GRPO)背后的数学,GRPO是推动DeepSeek卓越推理能力的核心强化学习算法。我们将分解GRPO的工作原理、其关键组件,以及为什么它是训练高级大型语言模型(LLM)的改变者。 GRPO的基础 GRPO是什么? 群相对策略优化(GRPO)是一种强化学习(RL)算法,专门用于增强大型语言模型(LLM)的推理能力。与传统的RL方法不同,RL方法严重依赖外部评...  阅读全文

posted @ 2025-02-08 00:13 paulwong 阅读(196) | 评论 (0)编辑 收藏

DeepSeek资源

DeepSeek大模型由于采用了GRPO算法, 大幅降低了显存的需求.

【DeepSeek】复现DeepSeek R1?快来看这个Open R1项目实践指南~
https://blog.csdn.net/qq_38961840/article/details/145388142

!!!实战LLM强化学习——使用GRPO(DeepSeek R1出圈算法)
https://blog.csdn.net/qq_38961840/article/details/145390704

【DeepSeek】一文详解GRPO算法——为什么能减少大模型训练资源?
https://blog.csdn.net/qq_38961840/article/details/145384852

DeepSeek R1系列
https://blog.csdn.net/qq_38961840/category_12885087.html


posted @ 2025-02-02 19:22 paulwong 阅读(83) | 评论 (0)编辑 收藏

不用再找了,这是大模型最全的面试题库

https://blog.csdn.net/m0_59596990/article/details/135200833

posted @ 2025-01-22 07:42 paulwong 阅读(29) | 评论 (0)编辑 收藏

数据集资源

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
https://hyper.ai/cn/datasets


posted @ 2025-01-17 15:52 paulwong 阅读(22) | 评论 (0)编辑 收藏

vllm资源

vllm是一个可以加载大模型, 推理, 量化模型, 以http api的方式暴露服务的框架.

https://docs.vllm.ai/en/latest/getting_started/examples/basic_with_model_default_sampling.html


posted @ 2025-01-17 13:01 paulwong 阅读(59) | 评论 (0)编辑 收藏

AI应用场景

@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); @import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
到底AI是虚的还是假的, 在企业中有没实际落地场景, 以下取实际应用场景:

生物公司
使用qwen2:7b训练细胞制备领域的数据集,目标是
1.预测细胞收获量  
2.算细胞存活状态(存活/死亡)
3.预测工艺是否成功
4.可以提前预测细胞的质量是否达标,以便及时采取措施进行调整
5.细胞培养过程中出现大量细胞死亡的情况,模型可以根据实时数据和历史经验,分析可能是培养箱温度失控、培养基成分错误或受到污染等原因导致的,并提供相应的排查建议」

文体旅游
智能旅游系统:
提供目的地介绍、
旅行路线规划、
酒店预订和景
点推荐等服务。

考试改卷
基于大模型,做一个判试卷的应用,能够判断主观题,比如阅读理解,比如历史,地理,政治问答题。
判卷准确率不能低于人工判卷准确率。
即一次考试,一个班50份试卷,判断结果错误不超过5道题。判断效率高于或等于人工。

取过往同学试卷题目, 作答内容, 得分 作一波ocr出数据, 一个科目, 提取所有试卷内容, 最后就是一个科目一个模型, 提取的内容放在文本, csv, json,
基于“bert-base-chinese”这个模型, 进行微调出专用模型即可,  
让大模型成为专业的判卷老师

考试
用扣子打一个智能体,实现不同学员对掌握的知识进行测试,根据测试结果进行打分和二次出题测试



posted @ 2025-01-17 11:23 paulwong 阅读(130) | 评论 (0)编辑 收藏

搭建llamafactory微调、评估、测试和量化环境

0. 配置环境变量
HF_ENDPOINT=https://hf-mirror.com
HF_HOME=/root/autodl-tmp/paul/tools/huggingface

1. 本机安装python 3.10, 并设置软件源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set global.index-url https://mirrors.huaweicloud.com/repository/pypi/simple

2. 安装miniconda

3. 新建一个环境, 并激活
conda create -n quantization python=3.12

2. 本机安装pytorch2.5.1+cuda12.4
pip3 install torch torchvision torchaudio
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu124

3. clone llamafactory源码
git clone https://github.com/hiyouga/LLaMA-Factory

4. llamafactory本地安装依赖
pip install -e .
pip install -e .["vllm","gptq"]

5. 启动webui
llamafactory-cli webui

6. 在页面中填入相关参数进行操作

posted @ 2025-01-16 16:54 paulwong 阅读(128) | 评论 (0)编辑 收藏

量化大模型工具

VLLM量化推理
https://llmc-zhcn.readthedocs.io/en/latest/backend/vllm.html#id1

安装此工具前需安装两个包:
sudo apt-get install cmake
sudo apt-get install pkgconfig

配置huggingface镜像地址:
export HF_ENDPOINT=https://hf-mirror.com

下载代码库, 并安装python依赖
git clone https://github.com/ModelTC/llmc.git
cd llmc/
pip install -r requirements.txt

找到量化方法的配置文件, 并作修改
base:
    seed: &seed 42
model:
    type: Llama
    path: /home/paul/.cache/huggingface/models/models--unsloth--llama-3-8b-Instruct-lawdata
    torch_dtype: auto
quant:
    method: RTN
    weight:
        bit: 8
        symmetric: True
        granularity: per_group
        group_size: 128
        need_pack: True
eval:
    eval_pos: [fake_quant]
    name: wikitext2
    download: True
    path: /home/paul/paulwong/work/workspaces/llmc/dataset
    bs: 1
    seq_len: 2048
    inference_per_block: False
save:
    save_vllm: True
    save_path: /home/paul/.cache/huggingface/models/models--unsloth--llama-3-8b-Instruct-lawdata-quantization

找到run_llmc.sh, 并作修改
#!/bin/bash

# export CUDA_VISIBLE_DEVICES=0,1

llmc=/home/paul/paulwong/work/workspaces/llmc
export PYTHONPATH=$llmc:$PYTHONPATH

# task_name=awq_w_only
# config=${llmc}/configs/quantization/methods/Awq/awq_w_only.yml
task_name=rtn_for_vllm
config=${llmc}/configs/quantization/backend/vllm/rtn_w8a16.yml

nnodes=1
nproc_per_node=1


find_unused_port() {
    while true; do
        port=$(shuf -i 10000-60000 -n 1)
        if ! ss -tuln | grep -q ":$port "; then
            echo "$port"
            return 0
        fi
    done
}
UNUSED_PORT=$(find_unused_port)


MASTER_ADDR=127.0.0.1
MASTER_PORT=$UNUSED_PORT
task_id=$UNUSED_PORT

nohup \
torchrun \
--nnodes $nnodes \
--nproc_per_node $nproc_per_node \
--rdzv_id $task_id \
--rdzv_backend c10d \
--rdzv_endpoint $MASTER_ADDR:$MASTER_PORT \
${llmc}/llmc/__main__.py --config $config --task_id $task_id \
> ${task_name}.log 2>&1 &

sleep 2
ps aux | grep '__main__.py' | grep $task_id | awk '{print $2}' > ${task_name}.pid

# You can kill this program by 
# xargs kill -9 < xxx.pid
# xxx.pid is ${task_name}.pid file

执行量化操作
bash scripts/run_llmc.sh




posted @ 2025-01-15 18:00 paulwong 阅读(86) | 评论 (0)编辑 收藏

微调资源

Fine-tune Llama 3.1 Ultra-Efficiently with Unsloth
https://huggingface.co/blog/mlabonne/sft-llama3

A beginners guide to fine tuning LLM using LoRA
https://zohaib.me/a-beginners-guide-to-fine-tuning-llm-using-lora/

【Day 23】調教你的 AI 寵物:用微調讓 LLM 乖乖聽話
https://ithelp.ithome.com.tw/articles/10346441


posted @ 2025-01-15 17:56 paulwong 阅读(65) | 评论 (0)编辑 收藏