图解 Transformer 注意力机制
从一个例子开始 想象我们要翻译这句话:"The cat sat on the mat"。 在处理 "sat" 这个词时,SelfAttention 让模型能够"看到"句子中所有相关的词——"cat" 是主语,"on" 和 "mat" 是位置...
从一个例子开始 想象我们要翻译这句话:"The cat sat on the mat"。 在处理 "sat" 这个词时,SelfAttention 让模型能够"看到"句子中所有相关的词——"cat" 是主语,"on" 和 "mat" 是位置...
概述 跟随 Andrej Karpathy 的 nanoGPT,我们从零构建一个能生成文本的小型 GPT。 模型架构 python class GPTnn.Module: def __init__self, vocab_size, n_em...
基础技巧 ZeroShot Prompting 直接提问,不提供示例。 FewShot Prompting 提供 25 个示例让模型学习模式。 ChainofThought 在 prompt 中加入"Let's think step by ...
什么是 Function Calling Function Calling 让 LLM 能够调用外部工具和 API,从"只会说话"变成"会做事"。 基本用法 python tools = { "type": "function", "fun...