{"id":36786,"date":"2025-01-18T15:00:24","date_gmt":"2025-01-18T07:00:24","guid":{"rendered":"https:\/\/17aitech.com\/?p=36786"},"modified":"2025-01-18T15:00:24","modified_gmt":"2025-01-18T07:00:24","slug":"%e7%a5%9e%e7%ba%a7%e9%a1%b9%e7%9b%ae%e8%ae%ad%e7%bb%83gpt-2%e4%bb%85%e9%9c%805%e5%88%86%e9%92%9f%ef%bc%8candrej-karpathy%e9%83%bd%e7%82%b9%e8%b5%9e","status":"publish","type":"post","link":"https:\/\/17aitech.com\/?p=36786","title":{"rendered":"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e"},"content":{"rendered":"<p>\u6587\u7ae0\u6765\u6e90\u4e8e\u4e92\u8054\u7f51:<a href=\"https:\/\/www.jiqizhixin.com\/articles\/2024-11-21-4\" target=\"_blank\">\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e<\/a><\/p>\n<blockquote data-author-name=\"\" data-content-utf8-length=\"16\" data-source-title=\"\" data-type=\"2\" data-url=\"\">\n<section>\n<section>\n<section>\u79df\u7528 H100 \u7684\u94b1\u53ea\u9700 233 \u7f8e\u5143\u3002<\/section>\n<\/section>\n<\/section>\n<\/blockquote>\n<section><\/section>\n<section>\u8fd8\u8bb0\u5f97 Andrej Karpathy \u7eaf C \u8bed\u8a00\u590d\u73b0 GPT-2 \u5927\u6a21\u578b\u7684\u9879\u76ee\u5417\uff1f<\/section>\n<section><\/section>\n<section>\u4eca\u5e74 4 \u6708\uff0cAI \u9886\u57df\u5927\u725b Karpathy \u4e00\u4e2a\u4ec5\u7528 1000 \u884c\u4ee3\u7801\u5373\u53ef\u5728 CPU\/fp32 \u4e0a\u5b9e\u73b0 GPT-2 \u8bad\u7ec3\u7684\u9879\u76ee\u300cllm.c\u300d\u66fe\u7ecf\u5f15\u53d1\u673a\u5668\u5b66\u4e60\u793e\u533a\u7684\u70ed\u70c8\u8ba8\u8bba\u3002<\/section>\n<section><\/section>\n<section>llm.c \u65e8\u5728\u5927\u5e45\u7b80\u5316\u5927\u6a21\u578b\u7684\u8bad\u7ec3\uff0cta \u4f7f\u7528\u7eaf C \u8bed\u8a00 \/ CUDA\uff0c\u4e0d\u9700\u8981 245MB \u7684 PyTorch \u6216 107MB \u7684 cPython\u3002\u4e0d\u8fc7\u5373\u4f7f\u662f\u8fd9\u6837\u7684\u4f18\u5316\uff0c\u590d\u73b0 GPT-2 \u7ea7\u522b\u7684\u6a21\u578b\u4e5f\u9700\u8981\u5728 8 \u5757 H100 \u4e0a\u82b1\u8d39 45 \u5206\u949f\u8fdb\u884c\u8bad\u7ec3\u3002<\/section>\n<section><\/section>\n<section>\u6ca1\u60f3\u5230\u51e0\u4e2a\u6708\u8fc7\u53bb\uff0c\u4e1a\u754c\u6c34\u5e73\u5c45\u7136\u6709\u4e86\u6307\u6570\u7ea7\u7684\u63d0\u5347\uff0c\u8ba9 Karpathy \u672c\u4eba\u90fd\u611f\u5230\u60ca\u53f9\uff1a<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png\"><\/a><\/section>\n<section>\u5728 GitHub \u4e0a\u51fa\u73b0\u4e86\u4e00\u4e2a\u65b0\u9879\u76ee\u300cModded-NanoGPT\u300d\uff0c\u5bf9\u6280\u672f\u8fdb\u884c\u4e86\u5927\u5e45\u5ea6\u7684\u8fed\u4ee3\uff0c\u73b0\u5728\u5b9e\u73b0\u76f8\u540c\u7684\u7ed3\u679c\u53ea\u9700\u8981 5 \u5206\u949f\u3002\u8be5\u7814\u7a76\u7684\u4f5c\u8005 Keller Jordan \u66fe\u5728 Hive AI \u5de5\u4f5c\uff0c\u4e00\u76f4\u4ee5\u6765\u7684\u7814\u7a76\u65b9\u5411\u90fd\u7740\u91cd\u4e8e\u6a21\u578b\u8bad\u7ec3\u7684\u4f18\u5316\u3002\u4ed6\u5728\u672c\u5468\u4e09\u8868\u793a\uff0c\u5229\u7528\u5177\u6709\u5927\u5e8f\u5217\u957f\u5ea6\u7684 FlexAttention\uff0c\u4ed6\u5df2\u628a\u901f\u5ea6\u7684\u8bb0\u5f55\u4ece 7.2 \u5206\u949f\u63d0\u5347\u5230\u4e86 5 \u5206\u949f\u3002<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-08cb6754872bdd14e4ed4b51fd522f2c.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-08cb6754872bdd14e4ed4b51fd522f2c.png\"><\/a><\/section>\n<section>\u73b0\u5728\u6709\u4e86 FlexAttention \u548c\u8f83\u5927\u7684 seqlen\uff0c\u6587\u6863\u7684\u62c6\u5206\u66f4\u5c11\u4e86\uff0c\u56e0\u6b64\u8bed\u8a00\u5efa\u6a21\u5728\u8bad\u7ec3\u548c\u9a8c\u8bc1\u65f6\u90fd\u53d8\u5f97\u66f4\u5bb9\u6613\u3002\u8be5\u8bb0\u5f55\u5728 HellaSwag \u4e0a\u7684\u51c6\u786e\u7387\u7565\u6709\u964d\u4f4e\uff0c\u7ea6\u4e3a 29%\uff0c\u800c\u4e4b\u524d\u7684\u8bb0\u5f55\u548c Andrej Karpathy \u7684\u539f\u59cb\u8bad\u7ec3\u51c6\u786e\u7387\u7ea6\u4e3a 30%\u3002<\/section>\n<section><\/section>\n<section>\u8ba9\u6211\u4eec\u770b\u770b\u4ed6\u662f\u600e\u4e48\u505a\u7684\uff1a<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-f2c6043d58d060122c698d717ae89223.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-f2c6043d58d060122c698d717ae89223.png\"><\/a><\/section>\n<section>\u9879\u76ee\u94fe\u63a5\uff1ahttps:\/\/github.com\/KellerJordan\/modded-nanogpt\/tree\/master<\/section>\n<section><\/section>\n<section><strong>Modded-NanoGPT<\/strong><\/section>\n<section><\/section>\n<section>\u8be5\u9879\u76ee\u540d\u4e3a\u300cModded-NanoGPT\u300d\uff0c\u5b83\u662f llm.c \u5b58\u50a8\u5e93\u7684 PyTorch GPT-2 \u8bad\u7ec3\u5668\u7684\u6539\u8fdb\u53d8\u4f53\uff1a<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>10B tokens&#8211;&gt;1B tokens<\/section>\n<\/li>\n<li>\n<section>8xH100 \u4e0a\u82b1 45 \u5206\u949f\u8bad\u7ec3 &#8211;&gt;8xH100 \u4e0a\u82b1 5 \u5206\u949f\u8bad\u7ec3<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section>Modded-NanoGPT \u91c7\u7528\u5982\u4e0b\u6280\u672f\uff1a<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>\u5148\u8fdb\u7684\u67b6\u6784\uff1a\u65cb\u8f6c\u5d4c\u5165\u3001QK-Norm \u548c ReLU^2\uff1b<\/section>\n<\/li>\n<li>\n<section>\u65b0\u4f18\u5316\u5668\uff1aMuon\uff1b<\/section>\n<\/li>\n<li>\n<section>\u5d4c\u5165\u4e2d\u7684 Untied Head\uff1b<\/section>\n<\/li>\n<li>\n<section>\u6295\u5f71\u548c\u5206\u7c7b\u5c42\u521d\u59cb\u5316\u4e3a\u96f6\uff08muP-like\uff09\uff1b<\/section>\n<\/li>\n<li>\n<section>\u67b6\u6784 shortcut\uff1a\u503c\u6b8b\u5dee\u548c\u5d4c\u5165 shortcut\uff08\u90e8\u5206\u9075\u5faa\u8bba\u6587\u300aValue Residual Learning For Alleviating Attention Concentration In Transformers\u300b\uff09\uff1b<\/section>\n<\/li>\n<li>\n<section>\u52a8\u91cf\uff08Momentum\uff09warmup\uff1b<\/section>\n<\/li>\n<li>\n<section>Tanh soft logit capping\uff08\u9075\u5faa Gemma 2\uff09\uff1b<\/section>\n<\/li>\n<li>\n<section>FlexAttention\u3002<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section>\u8981\u8fdb\u884c\u8bad\u7ec3\uff0c\u8bf7\u8fd0\u884c\u4ee5\u4e0b\u4e09\u4e2a\u547d\u4ee4\uff1a<\/section>\n<section>\n<pre data-lang=\"sql\"><section><code>pip install -r requirements.txt<\/code><\/section><section><code>pip install --pre torch --index-url https:\/\/download.pytorch.org\/whl\/nightly\/cu124 \u2014upgrade # install torch 2.6.0<\/code><\/section><section><code>python data\/cached_fineweb10B.py 10 # downloads only the first 1.0B training tokens to save time<\/code><\/section><section><code>.\/run.sh<\/code><\/section><\/pre>\n<\/section>\n<section>\u5728\u7f51\u7edc\u8fde\u63a5\u826f\u597d\u7684 8xH100 \u4e0a\uff0c\u8bad\u7ec3\u5e94\u5728 20 \u5206\u949f\u5185\u5b8c\u6210\u3002<\/section>\n<section><\/section>\n<section>\u7ed3\u679c\u5c06\u662f\u4e00\u4e2a\u5177\u6709 124M \u6d3b\u8dc3\u53c2\u6570\u7684 transformer\uff0c\u5728 10 \u4ebf Fineweb tokens \u4e0a\u8bad\u7ec3\u4e86 1875 steps\uff0c\u5b9e\u73b0\u4e86\u7ea6 3.278 \u7684\u9a8c\u8bc1\u635f\u5931\u3002\u76f8\u6bd4\u4e4b\u4e0b\uff0c\u9ed8\u8ba4\u7684 llm.c PyTorch \u8bad\u7ec3\u5668\u5728 100 \u4ebf tokens \u4e0a\u8bad\u7ec3\u4e86 19560 steps \u540e\uff0c\u9a8c\u8bc1\u635f\u5931 &gt;3.28\u3002<\/section>\n<section><\/section>\n<section>\u503c\u5f97\u4e00\u63d0\u7684\u662f\uff0c\u8981\u5728\u66f4\u5c11\u7684 GPU \u4e0a\u8fd0\u884c Modded-NanoGPT\uff0c\u53ea\u9700\u4fee\u6539 run.sh \u4ee5\u83b7\u5f97\u4e0d\u540c\u7684 &#8211;nproc_per_node\u3002\u5982\u679c\u5185\u5b58\u4e0d\u8db3\uff0c\u53ea\u9700\u5728 train_gpt2.py \u4e2d\u5c06 device_batch_size \u7f29\u5c0f\u5230 16 \u6216 32\u3002<\/section>\n<section><\/section>\n<section>\u8fd9\u91cc\u6709\u4e00\u4e2a\u9002\u7528\u4e8e\u5168\u65b0 8xH100 \u5b9e\u4f8b\u7684\u542f\u52a8\u811a\u672c\uff1a<\/section>\n<section>\n<pre data-lang=\"sql\"><section><code>sudo apt-get update<\/code><\/section><section><code>sudo apt-get install vim tmux python3-pip python-is-python3 -y<\/code><\/section><section><code>git clone <a href=\"https:\/\/github.com\/KellerJordan\/modded-nanogpt.git\">https:\/\/github.com\/KellerJordan\/modded-nanogpt.git<\/a><\/code><\/section><section><code>cd modded-nanogpt<\/code><\/section><section><code>tmux<\/code><code>\r\n<\/code><code>\r\n<\/code><code>pip install numpy==1.23.5 huggingface-hub tqdm<\/code><\/section><section><code>pip install --upgrade torch &amp;<\/code><\/section><section><code>python data\/cached_fineweb10B.py 18<\/code><\/section><\/pre>\n<\/section>\n<section>\u5982\u679c CUDA \u6216 NCCL \u7248\u672c\u4e0e\u4f60\u5f53\u524d\u7684\u7cfb\u7edf\u8bbe\u7f6e\u4e0d\u517c\u5bb9\uff0cDocker \u53ef\u4ee5\u6210\u4e3a\u4e00\u79cd\u6709\u7528\u7684\u66ff\u4ee3\u65b9\u6848\u3002\u8fd9\u79cd\u65b9\u6cd5\u6807\u51c6\u5316\u4e86 CUDA\u3001NCCL\u3001CUDNN \u548c Python \u7684\u7248\u672c\uff0c\u51cf\u5c11\u4e86\u4f9d\u8d56\u6027\u95ee\u9898\u5e76\u7b80\u5316\u4e86\u8bbe\u7f6e\u3002\u6ce8\u610f\uff1a\u7cfb\u7edf\u4e0a\u5fc5\u987b\u5df2\u5b89\u88c5 NVIDIA \u9a71\u52a8\u7a0b\u5e8f\u3002<\/section>\n<section>\n<pre data-lang=\"ruby\"><section><code>sudo docker build -t modded-nanogpt .<\/code><\/section><section><code>sudo docker run -it --rm --gpus all -v $(pwd):\/modded-nanogpt modded-nanogpt python data\/cached_fineweb10B.py 18<\/code><\/section><section><code>sudo docker run -it --rm --gpus all -v $(pwd):\/modded-nanogpt modded-nanogpt sh run.sh<\/code><\/section><\/pre>\n<\/section>\n<section>\u6709\u4e00\u4e2a\u95ee\u9898\u5728\u4e8e\uff0cNanoGPT \u8bad\u7ec3\u5f88\u5feb\u662f\u5f88\u597d\uff0c\u4f46\u5b83\u53ef\u80fd\u65e0\u6cd5\u6269\u5c55\uff0c\u53ea\u662f\u8fc7\u62df\u5408\u4e86 val \u635f\u5931\uff1fKeller Jordan \u8868\u793a\uff0c\u8fd9\u5f88\u96be\u53cd\u9a73\uff0c\u56e0\u4e3a\u300c\u6309\u89c4\u6a21\u300d\u662f\u4e00\u4e2a\u65e0\u9650\u7c7b\u522b\uff08\u5982\u679c\u8fd9\u4e9b\u65b9\u6cd5\u5bf9 &gt;100T \u7684\u6a21\u578b\u5c31\u4e0d\u594f\u6548\u4e86\u600e\u4e48\u529e\uff1f\uff09\uff0c\u56e0\u6b64\u65e0\u6cd5\u5b8c\u5168\u8bc1\u660e\u3002\u6b64\u5916\uff0c\u4f5c\u8005\u4e5f\u540c\u610f\u5feb\u901f\u8fd0\u884c\u4e2d\u4f7f\u7528\u7684\u4e00\u4e9b\u65b9\u6cd5\u4e0d\u592a\u53ef\u80fd\u6269\u5c55\u3002\u4f46\u5982\u679c\u8bfb\u8005\u5173\u5fc3 1.5B \u6a21\u578b\uff0c\u4ed6\u4eec\u53ef\u80fd\u4f1a\u88ab\u8fd9\u4e2a\u7ed3\u679c\u8bf4\u670d\uff1a<\/section>\n<section><\/section>\n<section>\u76f4\u63a5\u5c06\u5feb\u901f\u8fd0\u884c\uff0810\/18\/24 \u7248\u672c\uff09\u6269\u5c55\u5230 1.5B \u53c2\u6570\u53ef\u4ee5\u5f97\u5230\u4e00\u4e2a\u5177\u6709 GPT-2\uff081.5B\uff09\u7ea7 HellaSwag \u6027\u80fd\u7684\u6a21\u578b\uff0c\u5b83\u8981\u6bd4 Karpathy \u7684\u57fa\u7ebf\u4fbf\u5b9c 2.5 \u500d\uff08233 \u7f8e\u5143\u5bf9\u6bd4 576 \u7f8e\u5143\uff09\uff1a<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-3f1491eaa040af145e514a2033863123.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-3f1491eaa040af145e514a2033863123.png\"><\/a><\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-ec82d8283e2ba138738807a3c3d26867.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-ec82d8283e2ba138738807a3c3d26867.png\"><\/a><\/section>\n<section><strong>Muon optimizer<\/strong><\/section>\n<section><\/section>\n<section>\u9664\u4e86\u5728\u524d\u4eba\u7684\u80a9\u8180\u4e0a\u63a2\u7d22\uff0c\u65b0\u9879\u76ee\u4e5f\u4f7f\u7528\u4e86 Keller Jordan \u81ea\u7814\u7684\u4f18\u5316\u65b9\u5f0f\u3002\u6bd4\u5982\u8fd9\u4e2a Muon \u4f18\u5316\u5668\uff0c\u636e\u4ed6\u6240\u8bf4\u662f\u76ee\u524d\u5df2\u77e5\u6700\u5feb\u7684\u4f18\u5316\u5668\uff0c\u9002\u7528\u4e8e\u5305\u62ec CIFAR-10 \u548c GPT-2 \u89c4\u6a21\u8bed\u8a00\u5efa\u6a21\u5728\u5185\u7684\u5404\u79cd\u8bad\u7ec3\u573a\u666f\u3002<\/section>\n<section><\/section>\n<section>Muon \u7684\u5b9a\u4e49\u5982\u4e0b\uff1a<\/section>\n<section><a href=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-10ec034a139403ebadb214f4da011bba.png\" data-fancybox=\"images\" data-fancybox=\"gallery\"><img decoding=\"async\" src=\"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-10ec034a139403ebadb214f4da011bba.png\"><\/a><\/section>\n<section>\u5176\u4e2d NewtonSchulz5 \u662f Newton-Schulz \u4e4b\u540e\u7684\u8fed\u4ee3\uff0c\u5b83\u8fd1\u4f3c\u5730\u7528 U @ V.T \u66ff\u6362 G\uff0c\u5176\u4e2d U, S, V = G.svd ()\u3002<\/section>\n<section>\n<pre data-lang=\"properties\"><section><code>@torch.compile<\/code><\/section><section><code>def zeroth_power_via_newtonschulz5 (G, steps=5, eps=1e-7):<\/code><\/section><section><code>    assert len (G.shape) == 2<\/code><\/section><section><code>    a, b, c = (3.4445, -4.7750,  2.0315)<\/code><\/section><section><code>    X = G.bfloat16 () \/ (G.norm () + eps)<\/code><\/section><section><code>    if G.size (0) &gt; G.size (1):<\/code><\/section><section><code>        X = X.T<\/code><\/section><section><code>\u00a0<\/code><code>    for _ in range (steps):<\/code><\/section><section><code>        A = X @ X.T<\/code><\/section><section><code>        B = b * A + c * A @ A<\/code><\/section><section><code>        X = a * X + B @ X<\/code><\/section><section><code>    if G.size (0) &gt; G.size (1):<\/code><\/section><section><code>        X = X.T<\/code><\/section><section><code>\u00a0<\/code><code>\u00a0 \u00a0 return X.to (G.dtype)<\/code><\/section><\/pre>\n<\/section>\n<section>\u5bf9\u4e8e\u8fd9\u79cd\u8bad\u7ec3\u573a\u666f\uff0cMuon \u5177\u6709\u4ee5\u4e0b\u6709\u5229\u7279\u6027\uff1a<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>\u5185\u5b58\u4f7f\u7528\u91cf\u6bd4 Adam \u4f4e<\/section>\n<\/li>\n<li>\n<section>\u91c7\u6837\u6548\u7387\u63d0\u9ad8\u7ea6 1.5 \u500d<\/section>\n<\/li>\n<li>\n<section>\u6302\u949f\u5f00\u9500\u5c0f\u4e8e 2%<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section><strong>\u603b\u7ed3<\/strong><\/section>\n<section><\/section>\n<section>\u4f5c\u8005\u8868\u793a\uff0c\u751f\u6210\u6b64\u4f18\u5316\u5668\u7684\u8bb8\u591a\u9009\u62e9\u90fd\u662f\u901a\u8fc7\u8ffd\u6c42 CIFAR-10 \u5feb\u901f\u8fd0\u884c\u800c\u901a\u8fc7\u5b9e\u9a8c\u83b7\u5f97\u7684\u3002\u5176\u4e2d\u503c\u5f97\u4e00\u63d0\u7684\u7ecf\u9a8c\u5305\u62ec\uff1a<\/section>\n<section><\/section>\n<ul>\n<li>\n<section>\u5728\u66f4\u65b0\u4e2d\u4f7f\u7528 Nesterov \u52a8\u91cf\uff0c\u5728\u52a8\u91cf\u4e4b\u540e\u5e94\u7528\u6b63\u4ea4\u5316\u3002<\/section>\n<\/li>\n<li>\n<section>\u4f7f\u7528\u7279\u5b9a\u7684\u4e94\u6b21 Newton-Schulz \u8fed\u4ee3\u4f5c\u4e3a\u6b63\u4ea4\u5316\u65b9\u6cd5\u3002<\/section>\n<\/li>\n<li>\n<section>\u4f7f\u7528\u4e94\u6b21\u591a\u9879\u5f0f\u7684\u975e\u6536\u655b\u7cfb\u6570\u4ee5\u6700\u5927\u5316\u96f6\u5904\u7684\u659c\u7387\uff0c\u4ece\u800c\u6700\u5c0f\u5316\u5fc5\u8981\u7684 Newton-Schulz \u8fed\u4ee3\u6b21\u6570\u3002\u4e8b\u5b9e\u8bc1\u660e\uff0c\u65b9\u5dee\u5b9e\u9645\u4e0a\u5e76\u4e0d\u90a3\u4e48\u91cd\u8981\uff0c\u56e0\u6b64\u6211\u4eec\u6700\u7ec8\u5f97\u5230\u4e00\u4e2a\u4e94\u6b21\u591a\u9879\u5f0f\uff0c\u5b83\u5728\u91cd\u590d\u5e94\u7528\u540e\uff08\u5feb\u901f\uff09\u6536\u655b\u5230 0.68\u30011.13 \u7684\u8303\u56f4\uff0c\u800c\u4e0d\u662f\u5230 1\u3002<\/section>\n<\/li>\n<li>\n<section>\u5728 bfloat16 \u4e2d\u8fd0\u884c Newton-Schulz \u8fed\u4ee3\uff08\u800c Shampoo \u5b9e\u73b0\u901a\u5e38\u4f9d\u8d56\u4e8e\u5728 fp32 \u6216 fp64 \u4e2d\u8fd0\u884c\u7684\u9006 pth \u6839\uff09\u3002<\/section>\n<\/li>\n<\/ul>\n<section><\/section>\n<section>\u4f7f\u7528 Newton-Schulz \u8fed\u4ee3\u8fdb\u884c\u6b63\u4ea4\u5316\u7684\u65b9\u6cd5\u53ef\u4ee5\u8ffd\u6eaf\u5230 Bernstein &amp; Newhouse (2024)\uff0c\u4ed6\u4eec\u5efa\u8bae\u5c06\u5176\u4f5c\u4e3a\u8ba1\u7b97 Shampoo \u9884\u5904\u7406\u5668\u7684\u65b9\u6cd5\uff0c\u5e76\u4ece\u7406\u8bba\u4e0a\u63a2\u7d22\u4e86\u6ca1\u6709\u9884\u5904\u7406\u5668\u7d2f\u79ef\u7684 Shampoo\u3002Keller Jordan \u7279\u522b\u611f\u8c22\u4e86\u8bba\u6587\u4f5c\u8005\u4e4b\u4e00 Jeremy Bernstein \u7684\u534f\u52a9\u3002<\/section>\n<section><\/section>\n<section>\u5982\u679c\u6211\u4eec\u5728\u8fd9\u91cc\u4f7f\u7528 SVD \u800c\u4e0d\u662f Newton-Schulz \u8fed\u4ee3\uff0c\u90a3\u4e48\u8fd9\u4e2a\u4f18\u5316\u5668\u5c31\u4f1a\u56e0\u4e3a\u592a\u6162\u800c\u65e0\u6cd5\u4f7f\u7528\u3002Bernstein &amp; Newhouse \u8fd8\u6307\u51fa\uff0c\u6ca1\u6709\u9884\u5904\u7406\u5668\u7d2f\u79ef\u7684 Shampoo \u76f8\u5f53\u4e8e\u8c31\u8303\u6570\u4e2d\u7684\u6700\u9661\u4e0b\u964d\uff0c\u56e0\u6b64 Shampoo \u53ef\u4ee5\u88ab\u8ba4\u4e3a\u662f\u4e00\u79cd\u5e73\u6ed1\u8c31\u6700\u9661\u4e0b\u964d\u7684\u65b9\u6cd5\u3002\u6240\u63d0\u51fa\u7684\u4f18\u5316\u5668\u53ef\u4ee5\u88ab\u8ba4\u4e3a\u662f\u5e73\u6ed1\u8c31\u6700\u9661\u4e0b\u964d\u7684\u7b2c\u4e8c\u79cd\u65b9\u6cd5\uff0c\u4e0e Shampoo \u76f8\u6bd4\uff0c\u5b83\u5177\u6709\u4e0d\u540c\u7684\u5185\u5b58\u548c\u8fd0\u884c\u65f6\u6743\u8861\u3002<\/section>\n<p>\u6587\u7ae0\u6765\u6e90\u4e8e\u4e92\u8054\u7f51:<a href=\"https:\/\/www.jiqizhixin.com\/articles\/2024-11-21-4\" target=\"_blank\">\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6765\u6e90\u4e8e\u4e92\u8054\u7f51:\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[27],"tags":[52,68,55],"class_list":["post-36786","post","type-post","status-publish","format-standard","hentry","category-news","tag-numpy","tag-68","tag-55"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e - \u4e00\u8d77AI\u6280\u672f<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/17aitech.com\/?p=36786\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786\"},\"author\":{\"name\":\"AI\u5c0f\u52a9\u624b\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/#\\\/schema\\\/person\\\/60225458499e817ae0af73e67e440b9d\"},\"headline\":\"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e\",\"datePublished\":\"2025-01-18T07:00:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786\"},\"wordCount\":188,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png\",\"keywords\":[\"Numpy\",\"\u5927\u6a21\u578b\",\"\u673a\u5668\u5b66\u4e60\"],\"articleSection\":[\"\u884c\u4e1a\u8d44\u8baf\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/17aitech.com\\\/?p=36786#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786\",\"url\":\"https:\\\/\\\/17aitech.com\\\/?p=36786\",\"name\":\"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e - \u4e00\u8d77AI\u6280\u672f\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png\",\"datePublished\":\"2025-01-18T07:00:24+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/#\\\/schema\\\/person\\\/60225458499e817ae0af73e67e440b9d\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/17aitech.com\\\/?p=36786\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#primaryimage\",\"url\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png\",\"contentUrl\":\"https:\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/11\\\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/?p=36786#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/17aitech.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/#website\",\"url\":\"https:\\\/\\\/17aitech.com\\\/\",\"name\":\"\u4e00\u8d77AI\u6280\u672f\",\"description\":\"\u8ba9AI\u77e5\u8bc6\u89e6\u624b\u53ef\u53ca\",\"alternateName\":\"\u4e00\u8d77AI\u6280\u672f\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/17aitech.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/17aitech.com\\\/#\\\/schema\\\/person\\\/60225458499e817ae0af73e67e440b9d\",\"name\":\"AI\u5c0f\u52a9\u624b\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/robot_3.png\",\"url\":\"\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/robot_3.png\",\"contentUrl\":\"\\\/\\\/17aitech.com\\\/wp-content\\\/uploads\\\/2024\\\/04\\\/robot_3.png\",\"caption\":\"AI\u5c0f\u52a9\u624b\"},\"description\":\"\u8fd9\u4e2a\u4eba\u5f88\u61d2\uff0c\u4ec0\u4e48\u90fd\u6ca1\u6709\u7559\u4e0b\uff5e\",\"url\":\"https:\\\/\\\/17aitech.com\\\/?page_id=33738&user=3\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e - \u4e00\u8d77AI\u6280\u672f","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/17aitech.com\/?p=36786","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/17aitech.com\/?p=36786#article","isPartOf":{"@id":"https:\/\/17aitech.com\/?p=36786"},"author":{"name":"AI\u5c0f\u52a9\u624b","@id":"https:\/\/17aitech.com\/#\/schema\/person\/60225458499e817ae0af73e67e440b9d"},"headline":"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e","datePublished":"2025-01-18T07:00:24+00:00","mainEntityOfPage":{"@id":"https:\/\/17aitech.com\/?p=36786"},"wordCount":188,"commentCount":0,"image":{"@id":"https:\/\/17aitech.com\/?p=36786#primaryimage"},"thumbnailUrl":"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png","keywords":["Numpy","\u5927\u6a21\u578b","\u673a\u5668\u5b66\u4e60"],"articleSection":["\u884c\u4e1a\u8d44\u8baf"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/17aitech.com\/?p=36786#respond"]}]},{"@type":"WebPage","@id":"https:\/\/17aitech.com\/?p=36786","url":"https:\/\/17aitech.com\/?p=36786","name":"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e - \u4e00\u8d77AI\u6280\u672f","isPartOf":{"@id":"https:\/\/17aitech.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/17aitech.com\/?p=36786#primaryimage"},"image":{"@id":"https:\/\/17aitech.com\/?p=36786#primaryimage"},"thumbnailUrl":"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png","datePublished":"2025-01-18T07:00:24+00:00","author":{"@id":"https:\/\/17aitech.com\/#\/schema\/person\/60225458499e817ae0af73e67e440b9d"},"breadcrumb":{"@id":"https:\/\/17aitech.com\/?p=36786#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/17aitech.com\/?p=36786"]}]},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/17aitech.com\/?p=36786#primaryimage","url":"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png","contentUrl":"https:\/\/17aitech.com\/wp-content\/uploads\/2024\/11\/frc-7ccdae7bb3e15be71de8c6b040e030cd.png"},{"@type":"BreadcrumbList","@id":"https:\/\/17aitech.com\/?p=36786#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/17aitech.com\/"},{"@type":"ListItem","position":2,"name":"\u795e\u7ea7\u9879\u76ee\u8bad\u7ec3GPT-2\u4ec5\u97005\u5206\u949f\uff0cAndrej Karpathy\u90fd\u70b9\u8d5e"}]},{"@type":"WebSite","@id":"https:\/\/17aitech.com\/#website","url":"https:\/\/17aitech.com\/","name":"\u4e00\u8d77AI\u6280\u672f","description":"\u8ba9AI\u77e5\u8bc6\u89e6\u624b\u53ef\u53ca","alternateName":"\u4e00\u8d77AI\u6280\u672f","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/17aitech.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/17aitech.com\/#\/schema\/person\/60225458499e817ae0af73e67e440b9d","name":"AI\u5c0f\u52a9\u624b","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"\/\/17aitech.com\/wp-content\/uploads\/2024\/04\/robot_3.png","url":"\/\/17aitech.com\/wp-content\/uploads\/2024\/04\/robot_3.png","contentUrl":"\/\/17aitech.com\/wp-content\/uploads\/2024\/04\/robot_3.png","caption":"AI\u5c0f\u52a9\u624b"},"description":"\u8fd9\u4e2a\u4eba\u5f88\u61d2\uff0c\u4ec0\u4e48\u90fd\u6ca1\u6709\u7559\u4e0b\uff5e","url":"https:\/\/17aitech.com\/?page_id=33738&user=3"}]}},"_links":{"self":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/posts\/36786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=36786"}],"version-history":[{"count":0,"href":"https:\/\/17aitech.com\/index.php?rest_route=\/wp\/v2\/posts\/36786\/revisions"}],"wp:attachment":[{"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=36786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=36786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/17aitech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=36786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}