1. LLM 模型架构 6%

NVIDIA 掌握 LLM 技术:训练

NVIDIA 掌握 LLM 技术:推理优化

  1. 提示工程 13%

NVIDIA LLM 推理、AI 智能体和测试时间缩放的简单介绍

NVIDIA 使用 NVIDIA NeMo 在一个周末内训练一个具备推理能力的 LLM

NVIDIA Multi-Turn Conversational Chat Bot

  1. 数据准备 9%

NVIDIA Github GenerativeAIExamples

NVIDIA AI Workbench Example Projects

rapid 有 4 个组件,其中 cuDF 是用 GPU 加速数据预处理

NVIDIA 加速数据分析:使用 RAPID cuDF 加速数据探索

时间序列预测可以用 skforecast 库,而 RAPIDS 中的 cuML 可以加速这类 ML 库。用非常类似的函数替换即可。

NVIDIA 利用 RAPIDS cuML 加速时间序列预测

NVIDIA Model Fine-Tuning NVIDIA NeMo Framework User Guide 24.07

NVIDIA 面向开发者的 NVIDIA NeMo Curator

双机器学习可以去除因素间的相互影响,用 DoubleML 库实现。 RAPIDS 也可以加速它。

NVIDIA RAPIDS 加速大型数据集的因果关系推理

  1. 模型优化 17%

主要加速手段:批处理、CUDA graphs 化、多 CUDA 流异步、层融合、单层 CUDA 优化、针对应用的优化(比如量化)

NVIDIA Best Practices for TensorRT Performance

NVIDIA NeMo Framework User Guide 量化

NVIDIA NeMo Framework User Guide 剪枝

NVIDIA NeMo Framework User Guide 蒸馏

NVIDIA NeMo Framework User Guide 推测解码

论文:DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter

如果想证明自己的网络结构特别好,知识蒸馏是一个特别好的方法

IBM 什么是知识蒸馏

剪枝又可以叫稀疏化。
可以利用 NVIDIA 的

from apex.contrib.sparsity import ASP
ASP.prune_trained_model(model_sparse, optimizer)

对模型进行剪枝。记得剪枝完后需要重新训练。

NVIDIA INT8中的稀疏性:NVIDIA TensorRT加速的训练工作流程和最佳实践

PTQ 中的校准数据是用于量化中间值的。
量化中间值也会让 PTQ 在网络中插入新的层。
所谓双量化,就是把 scale 也量化掉。

NVIDIA TensorRT:Working with Quantized Types

AWQ 中的 A 激活值是上一层的输出

Done Medium Quantization Aware Training (QAT) vs. Post-Training Quantization (PTQ)

图解 Transformer

论文:GPTQ

Understanding Data Types in AI and HPC: Int8, FP8, FP16, BF16, BF32, FP32, TF32, FP64, and Hardware Accelerators

Done 论文: LoRA

NVIDIA TensorRT’s Capabilities

  1. 微调 13%

NVIDIA RTX AI PC 和工作站上部署多样化 AI 应用支持 Multi-LoRA

NVIDIA 选择大型语言模型定制技术

Done 论文:LoRA

Supervised Fine-Tuning (SFT) and Parameter-Efficient Fine-Tuning (PEFT) via NIVIDA NeMo

nim-llm 和 tensor-llm 都是 nivida 用于模型推理的软件,前者侧重于集群微服务,后者侧重实用tensorrt sdk 编译模型后优化性能再服务;

nim 是更高的层级,通常使用 docker 实现,可以使用后者作为具体的服务软件。

Fine-Tuning with LoRA via NIVIDA NIM

NeMo Guardrails 框架基于由 Cleanlab 可信语言模型 (TLM) 提供支持的可信度评分,它大概是如下工作:

用户查询: 如果一对鼻环不合适,我可以返回吗?

LLM 回应: 很遗憾,根据我们的免费退货政策,包括 nose rings 在内的内衣和 jewelery 无法退货。

可信度评分:0.58 – 护栏的低可信度评分揭示了一个重要细节:该政策解决了耳环问题,但未提及鼻环。LLM 的尝试触发了可信度检查。

护栏检查结果: Fail – 助手将 fallback 响应返回给用户。

在这里,guardrail 正确地将其识别为需要人工干预的情况,从而防止潜在错误政策解释的传播。

在 NVIDIA NeMo Guardrails 中使用 Cleanlab 可信语言模型防止 LLM 幻觉

Book:Regularization for Deep Learning

BLEU 主要考虑准确率,通过长度惩罚来兼顾召回,长度大于标准长度则不惩罚。
ROUGE 就是 F1 分数,通过 F1 分数来兼顾准确和召回。当然,它有各个分词方法,不仅仅是一个 F1 分数,可能出好几个。
Meteor 的最终计算结果是加权 F1 分数,精确率与召回率的权重比为 9:1,即10precisionrecall/(recall + 9*precision)。
Meteor=F值×(1−惩罚项)

参考句:猫坐在垫子上
生成句:垫子上坐猫在

在 ROUGE 眼里,所有一元词组都匹配,得分可能是满分。但 Meteor 认为,你虽然是“拼凑”出来的,缺乏连贯性。

它会计算一个碎片化惩罚(Penalty):

先把能匹配的词组“对齐”,看分成了几个连续的块。
上面的例子中,匹配块切得非常碎。
碎片越多,惩罚越重。

怎么算碎片呢?—— 连线计算交叉点

LLM evaluation metrics — BLEU, ROGUE and METEOR explained

  1. 评估 7%

跟 ragas 原有指标的主要区别就是 NVIDIA 的指标只输出数字分数,不搞文字解释。

NVIDIA Metrics | Ragas

NVIDIA Morpheus是一款 GPU 加速的流日志处理框架,主要针对网络安全数据。

Retrieval Augmented Generation (RAG) Pipeline

使用 NVIDIA AI 端点和 Ragas 对医疗 RAG 的评估分析

Integrations | Ragas

Github NVIDIA RAG Blueprint

NIVDIA 面向开发者的 NVIDIA NeMo Evaluator

NVIDIA Autonomous Vehicles Safety Report

NVIDIA Nsight 开发者工具

Deployment Best Practices—NVIDIA RTX vWS: Sizing and GPU Selection Guide for Virtualized Workloads

NVIDIA Troubleshoot NVIDIA NIM for LLMs

How the DGX H100 accelerates AI workloads

论文: Masked Language Model Scoring

HF: Perplexity of fixed-length models

404

原文:
I was watching a video(link below) posted by Hamel on his Youtube channel. In the video, Hamel recommended that before we write any automated evals for our LLM application we should spend a good amount of time looking at the data. He said “Keep looking at the data until you are not learning anything new from it”.

The time and effort you spend doing manual error analysis will help you identify areas you should focus on. You will learn how users use your application, kind of queries(short, long, keywords, etc) they fire, are you retrieving the right context, is your response generated as per your expectations(instructions), etc.

You start by reviewing individual user interactions, categorizing errors in a straightforward manner (e.g., using a spreadsheet, or a low-code UI), and prioritizing fixes based on real user data. By focusing on recurring issues observed across interactions, you can address the most significant pain points before creating formal evaluation metrics.

The process involves iterating on insights gained from user data, leveraging synthetic data to simulate scenarios, and ensuring tests are motivated by real-world errors rather than arbitrary assumptions. This pragmatic methodology ensures evaluations are meaningful, guiding improvements in coherence, fluency, and relevance while fostering effective development practices.

You can watch the video here.

https://www.youtube.com/watch?v=ZEvXvyY17Ys

回顾真实轨迹:收集具有代表性的用户交互数据集(如果应用是全新的,也可以生成合成数据),并逐一回顾对话,直到不再出现新的见解。

开放编码:领域专家对手动这些交互进行标注,写下开放式的笔记,详细说明 LLM 在何处以及如何出错。

轴向编码(分类法):将这些标注的错误归类为不同的、可管理的类别,以识别应用中最主要的痛点(例如,检索上下文不佳、工具使用错误、或语调不当)。

编写有针对性的评估:让数据分析过程中发现的模式驱动你的测试策略。构建自动化评估,专门用于捕捉这些观察到的错误,而不是编写通用或任意的测试。

langfuse: Error Analysis for LLM Applications - Step by step guide

  1. GPU 加速 14%

讲了 torchrun 命令的用法,就是注入环境变量,程序得用那变量

Distributed Data Parallel in PyTorch - Video Tutorials

NVIDIA CUDA C++ Best Practices Guide

NVIDIA Assess, Parallelize, Optimize, Deploy

科普了各种并行的方法,讲得一般

Parallelisms — NVIDIA NeMo User Guide

Batching — NVIDIA NeMo Developer Docs

PyTorch Lightning: Gradient Accumulation | GitHub

讲了 gradient_accumulation 的原理和 accelerator 的用法,解释和例子程序都非常好。

accelerator 是 HF 写的,是比 torchrun 更高层的存在,理论上也更方便。

HF: Performing gradient accumulation with Accelerate

  1. 模型部署 9%

NVIDIA NIM Microservices for Accelerated AI Inference

nim-llm 是 nvidia 提供的 docker 镜像,里面推理软件用的是 vLLM

Overview of NVIDIA NIM for Large Language Models (LLMs)

可以访问这里了解 nim 是怎么在玩。

其实就是让你去 NGC 下载一个 docker,然后从 NGC 下载模型文件开始推理

NVIDIA Power Your AI Projects with New NVIDIA NIMs for Mistral and Mixtral Models

NVIDIA Concurrent Model Execution—Dynamo-Triton (Previously NVIDIA Triton™ Inference Server) User Guide

NVIDIA Model Configuration—Dynamo-Triton (Previously Triton Inference Server) User Guide

NVIDIA Schedulers—Dynamo-Triton (Previously Triton Inference Server) User Guide

NVIDIA Batchers—Dynamo-Triton (Previously Triton Inference Server) User Guide

  1. 生产监控和可靠性 7%

论文: BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding

GPT1 论文原文

论文:OpenAI Improving Language Understanding by Generative Pretraining (Radford, Narasimhan, Salimans, Sutskever) | OpenAI

HF: Masked language modeling

HF: Causal language modeling

  1. 安全道德与合规

Nvidia:Build an Enterprise RAG Pipeline Blueprint

https://www.dynatrace.com/ 是一家致力于 AI 可观测的公司

The rise of agentic AI part 4: Dynatrace delivers full-stack observability for AI with NVIDIA Blackwell and NVIDIA NIM

NVIDIA Observability Tool NVIDIA Generative AI Examples 0.5.0

保护 AI 智能体和其他对话式 AI 应用,以确保安全、品牌和可靠的行为,这对企业至关重要。 NVIDIA NeMo Guardrails 通过 AI Guardrails 为内容安全、主题控制、越狱检测等提供强大的保护,以评估和优化 Guardrail 性能。

在本文中,我们将探索用于测量和优化 AI 护栏有效性的技术。

NeMo Guardrails 提供了一个 评估工具 ,用于在给定特定 AI Guardrails 策略的情况下监控策略合规性。除了 LLM 生成响应的策略合规性率之外,该工具还提供了有关延迟和 LLM 令牌使用效率等关键性能指标的见解。

他的主要手段是增加类似如下的规则。管理和评估好一系列这样的规则文件。

prompts:

  • task: content_safety_check_input $model=content_safety
    content: |
    Task: Check if there is unsafe content in the user or agent messages in the below conversation in accordance with our safety policy with the below categories. Provide a ‘safe’ or ‘unsafe’ rating for both the user message and the agent response. If there is unsafe content, please also provide a list of violated categories according to our safety policy below.

    S1: Violence. S2: Sexual. S3: Criminal Planning/Confessions. S4: Guns and Illegal Weapons. S5: Controlled/Regulated Substances. S6: Suicide and Self Harm. S7: Sexual (minor). S8: Hate/Identity Hate. S9: PII/Privacy. S10: Harassment. S11: Threat. S12: Profanity.

实现原理如下:

1、基于“困惑度”(Perplexity)进行判断,可以理解为一种“语言异常检测”。越狱提示(Jailbreak Prompts)通常逻辑混乱、语法怪诞,这正是为了绕过模型的安全对齐。因此,这些文本的困惑度通常显著高于正常对话。

      config:
        jailbreak_detection:
          length_per_perplexity_threshold: 89.79   # 设置判定阈值

2、调用一个越狱检测的模型,例如 NVIDIA NemoGuard JailbreakDetect NIM。
该模型是一个高度专业化的二分类器。它直接分析用户输入的意图,输出一个明确的判断(“是”或“否”),判定其是否为越狱尝试。

    rails:
      input:
        flows:
          - "jailbreak detection model" # 启用模型检测
    
      config:
        jailbreak_detection:
          nim_base_url: "https://ai.api.nvidia.com" # 指定API端点

3、将安全判断的“最终解释权”交给对话模型自身。它通过一个精心设计的、符合模型安全规范的“元提示”(meta-prompt),要求模型检查输入是否违反其自身的安全准则。

        rails:
          input:
            flows:
              - "self check input" # 在输入流中启用自我检查

NVIDIA 衡量 AI Guardrails 在生成式 AI 应用中的有效性和性能

Logo

免费领 150 小时云算力,进群参与显卡、AI PC 幸运抽奖

更多推荐