<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          從零訓練1B以下小模型,梳理匯總

          共 3709字,需瀏覽 8分鐘

           ·

          2024-07-10 21:23

          以下章來源于微信公眾號:Angry Bugs

          作者:Angry Bugs

          鏈接:https://zhuanlan.zhihu.com/p/693252663

          本文僅用于學術分享,如有侵權,請聯(lián)系臺作刪文處理

          導讀
          隨著人工智能技術的飛速發(fā)展,大語言訓練模型作為其中的重要分支,近年來取得了顯著的進步。但是在許多資源受限的條件下,需要更小的模型。本文為讀者匯總了從零訓練的 1B 以下的小模型,以適應不同場景的需求。
          最好的學習方式莫過于自己從頭做一遍。學習大模型的相關知識以來,一直都想從頭自己訓練一個 1B 以下的模型,感覺這樣才算是真的學過了。不過以手頭的資源,也只能玩玩兒迷你的小模型了。最近在網(wǎng)上搜了不少資料,主要是 GitHub 上的倉庫和 Arxiv 上的 paper,順便記錄在這里。
          https://github.com/karpathy/nanoGPT
          nanoGPT 是 karpathy 大神寫的 GPT-2 最小實現(xiàn)。麻雀雖小,五臟俱全。GPT-2 是大模型的鼻祖,很多論文都以 nanoGPT 為基礎魔改或者作為 baseline。nanoGPT 共有 0.1B 到 1.5B 四個大小不同的版本。
          訓練 GPT-2 的文章有很多,雖然有些比較老的,但是也值得參考,列舉一些我覺得不錯的:
          • https://www.kaggle.com/code/pritishmishra/gpt-training-on-wikipedia-dataset-from-scratch
          • https://zhuanlan.zhihu.com/p/79714797
          • https://zhuanlan.zhihu.com/p/606339093
          • https://finisky.github.io/2020/05/01/pretrainchinesegpt/
          • https://zhuanlan.zhihu.com/p/656758138
          • https://github.com/minimalist-nlp/gpt2-text-generation
          tinyllama
          Llama 的一個迷你版,花了 90 天,用了 16 個 A100-40G。和 Llama 完全相同的架構,可以無縫替換。
          https://github.com/EleutherAI/pythia
          這個參數(shù)范圍更大了,從 14M 開始,一直到 12B,共 10 個不同大小的版本。也是出于學術研究目的,提供了這么多模型。
          https://github.com/allenai/OLMo
          有 1B 和 7B 兩個版本,架構上沒什么特色,優(yōu)點是從訓練數(shù)據(jù)到代碼和 Checkpoint,做到了完全開源,而非某些模型的偽開源。
          https://github.com/QwenLM/Qwen1.5
          阿里出品的大模型,參數(shù)最小有 0.5B 的。看網(wǎng)上的評價,應該是中文這塊做的最好的大模型了。
          Phi-1.5
          Phi-1 是微軟出品的一個 350M 和 1.3B 的模型,使用由大模型合成的「教科書」級別數(shù)據(jù),也就是說相比網(wǎng)頁數(shù)據(jù)更優(yōu)質一些的數(shù)據(jù)訓練,具體可以參見他們的論文 Textbooks are all you need I/II。因為數(shù)據(jù)質量高,合成也困難,只用了 6B 的數(shù)據(jù),在 8 個 A100 上訓練了 4 天。
          后來又出了一個 Phi-2,2.7B,號稱性能達到了 13B 的模型。不過好像沒有論文了,模型倒是也在 HF 上。https://huggingface.co/microsoft/phi-2
          詳細的解讀可以參考這篇文章:https://zhuanlan.zhihu.com/p/690423105
          這里還有網(wǎng)友做的中文版:https://github.com/charent/Phi2-mini-Chinese

          OpenELM

          Apple 出品的一組模型,從0.27B到3B不等,應該是沖著移動端的模型去的,還沒仔細看。
          下面再介紹一些網(wǎng)友的項目,可能更實際一些。
          • https://github.com/charent/ChatLM-mini-Chinese 從零開始訓練的一個 0.2B 中文模型,用的 T5,可能比較早了。
          • https://github.com/jiahe7ay/MINI_LLM 從零開始訓練的一個 1.4B 中文模型,基于 Qwen。可以參考作者的知乎文章:https://zhuanlan.zhihu.com/p/684946331
          • https://github.com/DLLXW/baby-llama2-chinese 基于 llama2 的中文模型,作者目標是 0.5B,但是貌似受硬件限制,只訓練到了 0.2B 的模型。
          • https://github.com/OpenBMB/MiniCPM 2.7B 的參數(shù),號稱能跟 Mistral-7B 不相上下,感覺有點吹得過了……
          • https://github.com/Chinese-Tiny-LLM/Chinese-Tiny-LLM 一個 2B 的模型,貌似還沒訓練完。
          • https://github.com/keeeeenw/MicroLlama 又一個 0.3B 版 llama,相當于 TinyLlama 的再縮小版
          • https://github.com/zhanshijinwat/Steel-LLM 網(wǎng)友的又一個預訓練計劃,貌似還沒開始
          最后,再羅列一些小模型訓練相關的技巧和資源:
          • 一本書《Build a LLM from scrath》,還沒寫完,但是 GitHub 上已經有 13k star 了,可能是不錯吧。
          • 這個 Awesome Chinese LLM 羅列了一些數(shù)據(jù)集,也值得參考。
          • 還有一篇叫做 MobileLLM 的 paper,介紹了一些訓練小模型的 trick。
          • Llama from scratch,這篇文章介紹了 Llama 中一些關鍵的組件的影響。
          • Rethinking Optimization and Architecture for Tiny Language Models,解讀:https://zhuanlan.zhihu.com/p/681614203
          • MNBVC:Massive Never-ending BT Vast Chinese corpus 超大規(guī)模中文語料集
          • RedPajama,Llama 的 dataset 重現(xiàn)

          瀏覽 175
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          評論
          圖片
          表情
          推薦
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

          分享
          舉報
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  黄色成人免费在线播放 | 亚洲天堂18| www.99热精品 | 最新人妻在线 | 中文字幕 国产 |