您的位置:首页 > 新闻 > 资讯 > Llama 3.1:开源语言模型的新里程碑

Llama 3.1:开源语言模型的新里程碑

2024/10/17 21:38:04 来源:https://blog.csdn.net/wuhanwhite/article/details/140683181  浏览:    关键词:Llama 3.1:开源语言模型的新里程碑
大家好,最近AI领域的新闻接踵而至,让人目不暇接。就在7月(23号)晚上,Meta发布了Llama 3.1系列模型,包括8B、70B参数的版本,以及此前提到过的400B参数模型(实际上是405B)。根据Meta官方公布的数据,Llama 3.1 405B参数模型在某些测试数据集上甚至略微胜过了GPT-4。今天,让我们一起来了解Llama 3.1的更新内容,以及如何免费使用这个令人期待的模型。

https://ai.meta.com/blog/meta-llama-3-1/icon-default.png?t=N7T8https://ai.meta.com/blog/meta-llama-3-1/我测试了它写代码能力,让它用python写个贪吃蛇游戏,写代码速度很慢,但是一次成功,下面是它写的代码和,代码运行的效果。

import pygame
import sys
import random# Initialize Pygame
pygame.init()# Set up some constants
WIDTH, HEIGHT = 800, 600
BLOCK_SIZE = 20
SPEED = 10# Set up some colors
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)# Set up the display
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Snake")# Set up the font
font = pygame.font.Font(None, 36)# Set up the snake and food
snake = [(200, 200), (220, 200), (240, 200)]
food = (400, 300)# Set up the direction
direction = "RIGHT"# Game loop
while True:# Event handlingfor event in pygame.event.get():if event.type == pygame.QUIT:pygame.quit()sys.exit()elif event.type == pygame.KEYDOWN:if event.key == pygame.K_UP and direction!= "DOWN":direction = "UP"elif event.key == pygame.K_DOWN and direction!= "UP":direction = "DOWN"elif event.key == pygame.K_LEFT and direction!= "RIGHT":direction = "LEFT"elif event.key == pygame.K_RIGHT and direction!= "LEFT":direction = "RIGHT"# Move the snakehead = snake[-1]if direction == "UP":new_head = (head[0], head[1] - BLOCK_SIZE)elif direction == "DOWN":new_head = (head[0], head[1] + BLOCK_SIZE)elif direction == "LEFT":new_head = (head[0] - BLOCK_SIZE, head[1])elif direction == "RIGHT":new_head = (head[0] + BLOCK_SIZE, head[1])snake.append(new_head)# Check for collision with foodif snake[-1] == food:food = (random.randint(0, WIDTH - BLOCK_SIZE) // BLOCK_SIZE * BLOCK_SIZE,random.randint(0, HEIGHT - BLOCK_SIZE) // BLOCK_SIZE * BLOCK_SIZE)else:snake.pop(0)# Check for collision with self or wallif (snake[-1] in snake[:-1] orsnake[-1][0] < 0 or snake[-1][0] >= WIDTH orsnake[-1][1] < 0 or snake[-1][1] >= HEIGHT):pygame.quit()sys.exit()# Draw everythingscreen.fill(BLACK)for pos in snake:pygame.draw.rect(screen, GREEN, (pos[0], pos[1], BLOCK_SIZE, BLOCK_SIZE))pygame.draw.rect(screen, RED, (food[0], food[1], BLOCK_SIZE, BLOCK_SIZE))text = font.render(f"Score: {len(snake)}", True, WHITE)screen.blit(text, (10, 10))pygame.display.flip()# Cap the frame ratepygame.time.delay(1000 // SPEED)

运行效果如下:

Llama 3.1的主要更新

  1. Context Window扩展:Llama 3.1将模型的Context Window从原来的8K tokens扩展到了128K tokens,极大地提升了处理长文和长对话的能力。

  2. 模型架构:Llama 3.1沿用了Llama 3的基础架构,即使是405B参数的模型也采用标准的decoder-only transformer架构,而非混合专家模型。同时继续使用GQA(分组查询注意力)技术,提高了长文处理能力。

  3. 性能表现

    • Llama 3.1 405B模型在多个测试数据集上超越了GPT-4o和Claude 3.5 Sonnet等顶级商业闭源模型。
    • 8B参数版本优于参数相近的Gemma 2 9B IT和Mistral 7B Instruct。
    • 70B参数版本不仅胜过开源模型Mixtral 8x22B,还在多项测试中大幅领先GPT-3.5 Turbo。
  4. 许可证更新:Meta更新了Llama 3.1的许可条款,允许使用模型输出来改进其他语言模型,但要求训练出的新模型名称必须以"Llama"开头,并标注"Built with Llama"。

  5. 指令微调:Llama 3.1的Instruct版本根据工具调用进行了微调,并引入了新的iPython角色来接收和记录工具调用返回的数据。

如何免费使用Llama 3.1

在线使用

  1. HuggingChat

    • 提供Llama 3.1 405B和70B参数模型的免费使用。
    • 用户友好的对话界面,支持对话历史记录和工具调用选择。
    • 访问地址:https://huggingface.co/chat/icon-default.png?t=N7T8https://huggingface.co/chat/
  2. Groq

    • 使用自研LPU进行推理,注册简单(仅需Google账号)。
    • 生成速度快,提供免费的OpenAI兼容API。
    • 目前对API调用有每日Token限制。api地址:https://console.groq.com/icon-default.png?t=N7T8https://console.groq.com/
    • groq网址:https://groq.com/icon-default.png?t=N7T8https://www.youtube.com/redirect?event=video_description&redir_token=QUFFLUhqa05JR19rSmF3Wm9fZE50YUktZU9QNWw1aVJOUXxBQ3Jtc0tteWRHOVl2WF9lM0FzS1J2eGtnc2hLQ3k5ZkRUZlFJczRNOWV0NTFsQ013MGFlTktyMTV1bTdqbW1OSFRPbW5zUXo4cTRUb043UUt4TEtXZEJxcml4T0dvbkRKVkFqOXBDMk9hTlpWTmJxWnBXRDFiUQ&q=https%3A%2F%2Fgroq.com%2F&v=4oUG_CRmjGY

本地运行

推荐使用LM Studio程序:LM Studio - Discover, download, and run local LLMsLM Studio is an easy to use desktop app for experimenting with local and open-source Large Language Models (LLMs). The LM Studio cross platform desktop app allows you to download and run any ggml-compatible model from Hugging Face, and provides a simple yet powerful model configuration and inferencing UI. The app leverages your GPU when possible.icon-default.png?t=N7T8https://lmstudio.ai/

  • 提供便捷的模型下载界面和对话窗口。
  • 使用llama.cpp进行模型推理,适合无独立显卡的设备。
  • 支持不同程度量化的模型版本,如Q4_K_M(推荐),平衡大小和性能。

结语

Llama 3.1的发布无疑是开源语言模型发展的一个重要里程碑。405B参数模型与顶级商业闭源模型的竞争力,以及8B参数模型超越Google Gemma 2 9B的表现,都展示了开源社区的巨大潜力。Meta允许将Llama 3.1用于知识蒸馏,这一决定将进一步推动开源AI社区的蓬勃发展。

让我们一起期待AI技术的持续进步,为更开放、更强大的语言模型贡献力量。

如果您喜欢这篇文章,欢迎点赞订阅我的频道。下期再见,各位兄弟朋友们请多保重!

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com