{
  "source_file": "0930",
  "source_platform": "个人博客",
  "author": "Philipp Schmid",
  "title_listed": "Llama 2",
  "keywords": "Llama 2,开源模型,Meta",
  "domain": "大模型算法",
  "content_type": "深度技术解析",
  "is_paid_flag": "否",
  "url": "https://www.philschmid.de/llama-2",
  "publish_date": "2023-07",
  "corpus_stage": "预训练/SFT",
  "notes": "Llama 2模型解析",
  "id": "a269e40037ef",
  "collected_at": "2026-10-02T14:29:19",
  "title": "LLaMA 2 - Every Resource you need",
  "body_markdown": "LLaMA 2 - Every Resource you need\nJuly 21, 2023\n5\nminute read\nLLaMA 2 is a large language model developed by Meta and is the successor to LLaMA 1. LLaMA 2 is available for free for research and commercial use through providers like AWS, Hugging Face, and others. LLaMA 2 pretrained models are trained on 2 trillion tokens, and have double the context length than LLaMA 1. Its fine-tuned models have been trained on over 1 million human annotations.\nThis blog post includes all relevant resources to help get started quickly. It includes links to:\nWhat is LLaMA 2?\nPlaygrounds, where you can test the model\nThe research behind the model\nHow good the model is, benchmarks\nHow to correctly prompt the chat model\nHow to train the model using PEFT\nHow to deploy the model for inference\nand other resources\nThe official announcement from Meta can be found here:\nhttps://ai.meta.com/llama/\nWhat is LLaMa 2?\nMeta released LLaMA 2, the new state-of-the-art open large language model (LLM). LLaMA 2 represents the next iteration of LLaMA and comes with a commercially-permissive license. LLaMA 2 comes in 3 different sizes - 7B, 13B, and 70B parameters. New improvements compared to the original LLaMA include:\nTrained on 2 trillion tokens of text data\nAllows commercial use\nUses a 4096 default context window (\ncan be expanded\n)\nThe 70B model adopts grouped-query attention (GQA)\nAvailable on\nHugging Face Hub\nLLaMA Playgrounds, test it\nThere are a few different playgrounds available to test out interacting with LLaMA 2 Chat:\nHuggingChat\nallows you to chat with the LLaMA 2 70B model through Hugging Face's conversational interface. This provides a simple way to see the chatbot in action.\nHugging Face Spaces\nhas LLaMA 2 models in\n7B\n,\n13B\nand\n70B\nsizes available to test. The interactive demos let you compare different model sizes.\nPerplexity\nhas both the 7B and 13B LLaMA 2 models accessible through their conversational AI demo. You can chat with the models and provide feedback on the responses.\nResearch Behind LLaMA 2\nLLaMA 2 is a base LLM model and pretrained on publicly available data found online. Additionally Meta released a CHAT version. The first version of the CHAT model was SFT (Supervised fine-tuned) model. After that, LLaMA-2-chat was iteratively improved through Reinforcement Learning from Human Feedback (RLHF). The RLHF process involved techniques like rejection sampling and proximal policy optimization (PPO) to further refine the chatbot. Meta only released the latest RLHF (v5) versions of the model. If you curious how the process was behind checkout:\nLlama 2: Open Foundation and Fine-Tuned Chat Models\nLlama 2: an incredible open LLM\nLlama 2: Full Breakdown\nHow good is LLaMA 2, benchmarks?\nMeta claims that\n“Llama 2 outperforms other open source language models on many external benchmarks, including reasoning, coding, proficiency, and knowledge tests.”.\nYou can find more insights over the performance at:\nHugging Face Open LLM Leaderboard\nMeta Announcement\nHow to Prompt LLaMA 2 Chat\nLLaMA 2 Chat is an open conversational model. Interacting with LLaMA 2 Chat effectively requires providing the right prompts and questions to produce coherent and useful responses. Meta didn’t choose the simplest prompt. Below is the prompt template for single-turn and multi-turn conversations. This template follows the model's training procedure, as described in\nthe LLaMA 2 paper\n. You can also take a look at\nLLaMA 2 Prompt Template\n.\nSingle-turn\nPython\n<s>[\nINST\n] <<\nSYS\n>>\n{{ system_prompt }}\n<</\nSYS\n>>\n{{ user_message }} [/\nINST\n]\nMulti-turn\nPython\n<s>[\nINST\n] <<\nSYS\n>>\n{{ system_prompt }}\n<</\nSYS\n>>\n{{ user_msg_1 }} [/\nINST\n] {{ model_answer_1 }} </s><s>[\nINST\n] {{ user_msg_2 }} [/\nINST\n] {{ model_answer_2 }} </s><s>[\nINST\n] {{ user_msg_3 }} [/\nINST\n]\nHow to train LLaMA 2\nLLaMA 2 is openly available making it easy to fine-tune using techniques, .e.g. PEFT. There are great resources available for training your own versions of LLaMA 2:\nExtended Guide: Instruction-tune Llama 2\nFine-tune LLaMA 2 (7-70B) on Amazon SageMaker\nFine-tuning with PEFT\nMeta Examples and recipes for Llama model\nThe EASIEST way to finetune LLAMA-v2 on local machine!\nHow to Deploy LLaMA 2\nLLaMA 2 can be deployed in local environment (\nllama.cpp\n), using managed services like\nHugging Face Inference Endpoints\nor through or cloud platforms like AWS, Google Cloud, and Microsoft Azure.\nDeploy LLaMa 2 Using text-generation-inference and Inference Endpoints\nDeploy LLaMA 2 70B using Amazon SageMaker\nLlama-2-13B-chat locally on your M1/M2 Mac with GPU inference\nOther Sources\nLlama 2 Resources\nLet me know if you would like me to expand on any section or add additional details. I aimed to provide a high-level overview of key information related to LLaMA 2's release based on what is publicly known so far.\nThanks for reading! If you have any questions, feel free to contact me on\nTwitter\nor\nLinkedIn\n.",
  "metadata": {
    "title": "LLaMA 2 - Every Resource you need",
    "description": "All Resources for LLaMA 2, How to test, train, and deploy it.",
    "keywords": null,
    "author": "Philipp Schmid",
    "og:title": "LLaMA 2 - Every Resource you need",
    "og:description": "All Resources for LLaMA 2, How to test, train, and deploy it.",
    "og:url": "https://www.philschmid.de/llama-2",
    "og:image": "https://www.philschmid.de/static/blog/llama-2/thumbnail.jpg",
    "og:image:width": "1200",
    "og:image:height": "630",
    "og:image:alt": "LLaMA 2 - Every Resource you need",
    "og:type": "article",
    "twitter:card": "summary_large_image",
    "twitter:title": "LLaMA 2 - Every Resource you need",
    "twitter:description": "All Resources for LLaMA 2, How to test, train, and deploy it.",
    "twitter:image": "https://www.philschmid.de/static/blog/llama-2/thumbnail.jpg",
    "article:published_time": "2023-07-21"
  },
  "paywall": {
    "listed_paid": false,
    "detected": false,
    "marker": "",
    "public_only": false,
    "policy": "付费/会员内容只保留页面公开可见部分，不绕过付费墙"
  },
  "crawl": {
    "success": true,
    "status_code": 200,
    "error": ""
  },
  "code_blocks": [
    {
      "file": "attachments/a269e40037ef/code/body-000.txt",
      "chars": 75,
      "language": "text"
    },
    {
      "file": "attachments/a269e40037ef/code/body-001.txt",
      "chars": 193,
      "language": "text"
    }
  ],
  "images": [],
  "audio": [],
  "videos": [
    {
      "url": "https://www.youtube.com/watch?v=zJBpRn2zTco",
      "status": "ok",
      "local_path": "attachments/a269e40037ef/videos/zJBpRn2zTco.mp4",
      "bytes": 60519841,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "948.281000"
    },
    {
      "url": "https://www.youtube.com/watch?v=3fsn19OI_C8",
      "status": "ok",
      "local_path": "attachments/a269e40037ef/videos/3fsn19OI_C8.mp4",
      "bytes": 48132852,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "1045.561000"
    }
  ],
  "links": [
    {
      "href": "https://ai.meta.com/llama/",
      "label": "https://ai.meta.com/llama/",
      "type": "a"
    },
    {
      "href": "https://twitter.com/joao_gante/status/1681593605541236736?s=20",
      "label": "can be expanded",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/models?other=llama-2",
      "label": "Hugging Face Hub",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/chat",
      "label": "HuggingChat",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/spaces",
      "label": "Hugging Face Spaces",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/spaces/huggingface-projects/llama-2-7b-chat",
      "label": "7B",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/spaces/huggingface-projects/llama-2-13b-chat",
      "label": "13B",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/spaces/ysharma/Explore_llamav2_with_TGI",
      "label": "70B",
      "type": "a"
    },
    {
      "href": "https://llama.perplexity.ai/",
      "label": "Perplexity",
      "type": "a"
    },
    {
      "href": "https://arxiv.org/abs/2307.09288",
      "label": "Llama 2: Open Foundation and Fine-Tuned Chat Models",
      "type": "a"
    },
    {
      "href": "https://www.interconnects.ai/p/llama-2-from-meta",
      "label": "Llama 2: an incredible open LLM",
      "type": "a"
    },
    {
      "href": "https://www.youtube.com/watch?v=zJBpRn2zTco&ab_channel=AIExplained",
      "label": "Llama 2: Full Breakdown",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/spaces/HuggingFaceH4/open_llm_leaderboard",
      "label": "Hugging Face Open LLM Leaderboard",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/papers/2307.09288",
      "label": "the LLaMA 2 paper",
      "type": "a"
    },
    {
      "href": "https://gpus.llm-utils.org/llama-2-prompt-template/",
      "label": "LLaMA 2 Prompt Template",
      "type": "a"
    },
    {
      "href": "https://www.philschmid.de/instruction-tune-llama-2",
      "label": "Extended Guide: Instruction-tune Llama 2",
      "type": "a"
    },
    {
      "href": "https://www.philschmid.de/sagemaker-llama2-qlora",
      "label": "Fine-tune LLaMA 2 (7-70B) on Amazon SageMaker",
      "type": "a"
    },
    {
      "href": "https://huggingface.co/blog/llama2",
      "label": "Fine-tuning with PEFT",
      "type": "a"
    },
    {
      "href": "https://github.com/facebookresearch/llama-recipes/tree/main",
      "label": "Meta Examples and recipes for Llama model",
      "type": "a"
    },
    {
      "href": "https://www.youtube.com/watch?v=3fsn19OI_C8&ab_channel=AbhishekThakur",
      "label": "The EASIEST way to finetune LLAMA-v2 on local machine!",
      "type": "a"
    },
    {
      "href": "https://github.com/ggerganov/llama.cpp",
      "label": "llama.cpp",
      "type": "a"
    },
    {
      "href": "https://ui.endpoints.huggingface.co/",
      "label": "Hugging Face Inference Endpoints",
      "type": "a"
    },
    {
      "href": "https://www.philschmid.de/sagemaker-llama-llm",
      "label": "Deploy LLaMA 2 70B using Amazon SageMaker",
      "type": "a"
    },
    {
      "href": "https://gist.github.com/adrienbrault/b76631c56c736def9bc1bc2167b5d129",
      "label": "Llama-2-13B-chat locally on your M1/M2 Mac with GPU inference",
      "type": "a"
    },
    {
      "href": "https://gpus.llm-utils.org/llama-2-resources/",
      "label": "Llama 2 Resources",
      "type": "a"
    },
    {
      "href": "https://twitter.com/_philschmid",
      "label": "Twitter",
      "type": "a"
    },
    {
      "href": "https://www.linkedin.com/in/philipp-schmid-a6a2bb196/",
      "label": "LinkedIn",
      "type": "a"
    }
  ],
  "repair_version": 2,
  "repaired_at": "2026-10-14T10:52:53Z",
  "source_url": "https://www.philschmid.de/llama-2",
  "papers": [
    {
      "status": "ok",
      "url": "https://arxiv.org/pdf/2307.09288",
      "bytes": 13661300,
      "reused": true,
      "local_path": "papers/repair/01c99984e3c41b2873f5.pdf"
    }
  ],
  "actual_video_files": [
    {
      "local_path": "attachments/a269e40037ef/videos/3fsn19OI_C8.mp4",
      "bytes": 48132852,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "1045.561000",
      "status": "ok"
    },
    {
      "local_path": "attachments/a269e40037ef/videos/zJBpRn2zTco.mp4",
      "bytes": 60519841,
      "valid": true,
      "height": 1080,
      "width": 1920,
      "duration": "948.281000",
      "status": "ok"
    }
  ],
  "body_chars": 4907,
  "expected_body_images": 0,
  "discovery_status": "ok",
  "delivery_status": "ok",
  "missing_reason": "",
  "raw_html": "attachments/a269e40037ef/pages/source.html",
  "local_html": "attachments/a269e40037ef/pages/article.html",
  "body_base_path": "attachments/a269e40037ef/pages/",
  "body_markdown_path": "attachments/a269e40037ef/pages/article.md"
}