<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>

          【回顧】微軟開源專注加快大模型推斷速度

          共 4036字,需瀏覽 9分鐘

           ·

          2024-06-15 19:30

          關注 "GitHub精選",設為 "星標"
          探索有意思的開源項目

          大家好,又見面了,我是 GitHub 精選君!

          背景介紹

          在大規(guī)模語言模型推理過程中,我們經常會面臨幾個問題:如何加快語言模型的推理速度;如何增強語言模型對關鍵信息的感知;如何壓縮 prompt 提示和 KV-Cache。這些問題讓人頭痛,很多解決起來需要很多人力和資源投入。

          今天要給大家推薦一個微軟開源的項目 LLMLingua,該項目在 GitHub 有超過 1.2k Star,用一句話介紹該項目就是:“To speed up LLMs' inference and enhance LLM's perceive of key information, compress the prompt and KV-Cache, which achieves up to 20x compression with minimal performance loss. ”。

          項目介紹

          LLMLingua 是一個由微軟開發(fā)的專注于加快大規(guī)模語言模型 ( LLMs ) 的推斷速度和增強模型對關鍵信息感知的開源項目。通過創(chuàng)新的方式壓縮提示和 KV-Cache,LLMLingua 能達到高達 20 倍的壓縮效果,而且性能損失微乎其微。無論是 GPT2-samll,還是 LLaMA-7B,LLMLingua 都能有效地識別并移除非必需的提示字符串,從而實現(xiàn)高效的大規(guī)模語言模型推斷。在微軟的 LLMLingua 項目中,還推出了 LongLLMLingua 工具,它專門解決 LLMs 中在交流的中部模型迷失的問題,增強了長上下文信息處理的能力。只使用 1/4 的 Token,就可以提高達 21.4% 的 RAG 性能。

          當前大模型的應用現(xiàn)狀:

          LLMLingua 的架構:

          LLMLingua 的效果:

          如何使用

          使用 LLMLingua 的過程非常簡單,通過 pip 即可快速安裝,運行 pip install llmlingua。然后,你就可以使用(Long)LLMLingua 來壓縮你的提示了,代碼如下:

          from llmlingua import PromptCompressor
          llm_lingua = PromptCompressor()
          compressed_prompt = llm_lingua.compress_prompt(prompt, instruction="", question="", target_token=200)

          # > {'compressed_prompt': 'Question: Sam bought a dozen boxes, each with 30 highlighter pens inside, for $10 each box. He reanged five of boxes into packages of sixlters each and sold them $3 per. He sold the rest theters separately at the of three pens $2. How much did make in total, dollars?\nLets think step step\nSam bought 1 boxes x00 oflters.\nHe bought 12 * 300ters in total\nSam then took 5 boxes 6ters0ters.\nHe sold these boxes for 5 *5\nAfterelling these  boxes there were 3030 highlighters remaining.\nThese form 330 / 3 = 110 groups of three pens.\nHe sold each of these groups for $2 each, so made 110 * 2 = $220 from them.\nIn total, then, he earned $220 + $15 = $235.\nSince his original cost was $120, he earned $235 - $120 = $115 in profit.\nThe answer is 115',
          #  'origin_tokens': 2365,
          #  'compressed_tokens': 211,
          #  'ratio': '11.2x',
          #  'saving': ', Saving $0.1 in GPT-4.'}

          ## Or use the phi-2 model,
          ## Before that, you need to update the transformers to the github version, like pip install -U git+https://github.com/huggingface/transformers.git
          llm_lingua = PromptCompressor("microsoft/phi-2")

          ## Or use the quantation model, like TheBloke/Llama-2-7b-Chat-GPTQ, only need <8GB GPU memory.
          ## Before that, you need to pip install optimum auto-gptq
          llm_lingua = PromptCompressor("TheBloke/Llama-2-7b-Chat-GPTQ", model_config={"revision""main"})

          項目推介

          作為微軟發(fā)布的開源項目,LLMLingua 是由經驗豐富的開發(fā)者團隊開發(fā)的,他們定期更新和維護此項目,致力于為 LLMLingua 提供最新的功能和改進。根據多篇學術論文的研究表明,LLMLingua 在壓縮提示、加速推斷、增強大規(guī)模語言模型的信息處理能力等方面取得了顯著的成果。

          以下是該項目 Star 趨勢圖(代表項目的活躍程度):

          更多項目詳情請查看如下鏈接。

          開源項目地址:https://github.com/microsoft/LLMLingua

          開源項目作者:microsoft

          以下是參與項目建設的所有成員:

          關注我們,一起探索有意思的開源項目。

          點擊如下卡片后臺回復:加群,與技術極客們一起交流人工智能、開源項目,一起成長。如果你正在尋求開源項目推廣、DevOps、AIGC 大模型、軟件開發(fā)等領域的付費服務,可參考推文了解詳情。

          點擊支持一下吧

          瀏覽 57
          點贊
          評論
          收藏
          分享

          手機掃一掃分享

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

          手機掃一掃分享

          分享
          舉報
          <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>
                  欧美午夜在线 | 五月网色| 成人一级黄色A片 | 日韩无码 波多野结衣 | 男人的天堂青青草 |