Papers › Llama 2: Open Foundation and Fine-Tuned Chat Models
Llama 2: Open Foundation and Fine-Tuned Chat Models
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller, Cynthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiaoqing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Iliyan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang, Aurelien Rodriguez, Robert Stojnic, Sergey Edunov, Thomas Scialom
In this work, we develop and release Llama 2, a collection of pretrained and fine-tuned large language models (LLMs) ranging in scale from 7 billion to 70 billion parameters. Our fine-tuned LLMs, called Llama 2-Chat, are optimized for dialogue use cases. Our models outperform open-source chat models on most benchmarks we tested, and based on our human evaluations for helpfulness and safety, may be a suitable substitute for closed-source models. We provide a detailed description of our approach to fine-tuning and safety improvements of Llama 2-Chat in order to enable the community to build on our work and contribute to the responsible development of LLMs.
In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.
Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.
For agents, on Syntology's MCP service (how to connect):
get_harvested_code_for_paper(arxiv_id="2307.09288")get_code(code_sha256="…")with a sample'scode_sha256from the list belowget_citation_path(paper_1="2307.09288", paper_2="…")with another paper's arXiv id or titleget_concepts_for_paper(arxiv_id="2307.09288")
Code
No sample from the archive's official repository (facebookresearch/llama) is linked to this paper; the 52 samples below come from 8 community repositories. Syntology harvested code from facebookresearch/llama for another paper.
facebookresearch/llama: Syntology's graph links these samples to On the Influence of Gender and Race in Romantic Relationship Prediction from Large... (arXiv:2410.03996; that paper's own run record: 4 ran (of which 0 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 1 violated, 0 with no contract checked; 3 where Syntology's instrument failed) · 0 unverified); nothing checks that they implement this paper's method.
Syntology 52 code samples harvested from 8 repositories linked to this paper: 33 ran (of which 7 constructed an object rather than computing a result; 20 with no instrument failure: 1 honoured, 1 violated, 18 with no contract checked; 13 where Syntology's instrument failed) · 19 unverified. Where Syntology's instrument failed: 9 where our contract draft was wrong; 4 where the contract check could not run; failures of Syntology's instrument, not of the code.
By repository: community (archive-listed): 52 samples from 8 repositories, 33 ran (20 with no instrument failure; 13 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.
No sample is linked to this paper from 4 of its repositories that Syntology harvested for other papers:
- facebookresearch/llama, official repository: harvested for another paper, listed under the repository
- coastalcph/eu-politics-llms, community (archive-listed): harvested for another paper, listed under the repository
- ninglab/ecellm, community (archive-listed): harvested for another paper, listed under the repository
- xzhang97666/alpacare, community (archive-listed): harvested for another paper, listed under the repository
Levels written between 2026-09-22 and 2026-09-25 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed. 7 of the 33 samples that ran have no recorded date.
19 repositories listed; official and paper-mentioned ones first.
Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.
A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.
Code Syntology ran Syntology
52 samples harvested: 33 ran (of which 7 constructed an object rather than computing a result; 20 with no instrument failure: 1 honoured, 1 violated, 18 with no contract checked; 13 where Syntology's instrument failed) · 19 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page last changed ; when this build read Syntology's graph is in the build record. That date is not when the samples ran.
Licence: 20 of the 52 samples are pointer only, meaning Syntology does not serve that copy's text. For 4 of them, this paper's copy is under a permissive licence and cleared, but the stored copy of the same code that Syntology serves is not; the licence label's tooltip gives Syntology's recorded reason. This page shows no code text for any sample; each one links to its file in the repository.
Harvested from 8 repositories linked to this paper, official or community; the list below is grouped by repository, each group headed by its name and what it is to the paper. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. For 3 samples that ran, the graph records a signature this page does not show: for a class the fixture built without calling, the harness called the object with inputs it made up itself, so the recorded signature is the harness's probe, not the fixture's arguments. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.
Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (how to connect); click an identity to copy that call.
Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of six reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.
A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.
census: 15 implementations from 60 papers, 2 distinct outputs on one shared input this sample: bucket 1 of 1, arg 1: rank 4, kind float, dtype float32 training/llama_with_flash_attn.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted GPL-3.0 (copyleft) · pointer only ·
30d7eec482ebf6b1 · report
fixture: signature hidden_states:Tensor/4/float, n_rep:int/0/int · returned Tensor · level recorded, date not recorded b47d48e431b34acd · report
fixture: signature xq:Tensor/4/float, xk:Tensor/4/float, freqs_cis:Tensor/2/complex · returned tuple · level recorded 2026-09-22 census: 14 implementations from 15 papers, 8 distinct outputs across 7 buckets, one shared input per bucket training/llama_with_flash_attn.py ran GPL-3.0 (copyleft) · pointer only ·
e34097675d132bc1 · report
fixture: signature q:Tensor/3/float, k:Tensor/3/float, cos:Tensor/4/float, sin:Tensor/4/float, position_ids:Tensor/2/int · returned tuple · level recorded 2026-09-24 b5445674ab17410f · report
fixture: signature example:dict/0/? · returned dict · level recorded, date not recorded 48456f10725088b5 · report
fixture: signature example:dict/0/?, meta_prompts:list/1/str · returned dict · level recorded 2026-09-24 f82430123a91cf21 · report
fixture: signature examples:dict/0/?, extract_reformulations:bool/0/bool · returned dict · level recorded, date not recorded 55e55d5b9201bf5c · report
fixture: signature instruction:str/0/str, input:str/0/str, meta_prompt:str/0/str · returned str · level recorded, date not recorded c478c1e77422f0de · report
fixture: signature meta_prompt:str/0/str, instruction:str/0/str, input:str/0/str · returned str · level recorded 2026-09-24 0c0f540ee97855aa · report
fixture: signature generator:callable/0/?, example:dict/0/?, targets:list/1/str, meta_prompt:str/0/str, generate_prompt_fn:callable/0/?, temperature:float/0/float, max_seq_len:int/0/int · returned list · level recorded 2026-09-24 47407f4c74f590df · report
fixture: signature generator:callable/0/?, example:dict/0/?, targets:list/1/str, meta_prompt:str/0/str, generate_prompt_fn:callable/0/?, temperature:float/0/float, max_seq_len:int/0/int · returned list · level recorded 2026-09-24 b14dfe7367095841 · report
fixture: signature samples:list/1/dict · returned float · level recorded 2026-09-24 dfcc630d6e498f6f · report
fixture: signature samples:list/1/dict · returned float · level recorded 2026-09-24 14a84c2cbfebc413 · report
fixture: signature dim:int/0/int, end:int/0/int, theta:float/0/float · returned Tensor · level recorded 2026-09-22 census: 6 implementations from 10 papers, 1 distinct output on one shared input llama_dromedary/llama_dromedary/model.py ran; the contract check could not run (RAISES) · metamorphic tier: invariant fingerprinted GPL-3.0 (copyleft) · pointer only ·
70bf6ebaafd266c4 · report
fixture: signature freqs_cis:Tensor/2/float, x:Tensor/4/float · returned Tensor · level recorded, date not recorded census: 24 implementations from 96 papers, 4 distinct outputs across 2 buckets, one shared input per bucket this sample: bucket 1 of 2, arg 1: rank 2, kind float, dtype float32 training/llama_with_flash_attn.py ran · our draft was wrong fingerprinted GPL-3.0 (copyleft) · pointer only ·
b99eea6376d1e212 · report
fixture: signature x:Tensor/2/float · returned Tensor · level recorded, date not recorded 8845976729f4c4ee · report
fixture: signature probs:Tensor/2/float, p:float/0/float · returned Tensor · level recorded 2026-09-22 bf78fefededc09f7 · report
fixture: returned Config · level recorded 2026-09-22 1e7100681c300ca2 · report
fixture: returned RMSNorm · level recorded 2026-09-22 faa77017b4beec30 · report
fixture: signature params:list/1/int, name:str/0/str, required_length:int/0/int, use_initial_part:bool/0/bool, def_val:int/0/int · returned list · level recorded 2026-09-22 ffe8d3a5e6f4b477 · report
fixture: signature n:int/0/int, k:int/0/int · returned int · level recorded 2026-09-22 9715deb8f27d4266 · report
fixture: signature x:Tensor/2/float · returned Tensor · level recorded 2026-09-22 census: 13 implementations from 12 papers, 10 distinct outputs across 4 buckets, one shared input per bucket model.py unverified MIT (permissive) ·
4334c46d3961b3fb · report
1bcd8d227ad19b17 · report
fixture: returned LlamaConfig · level recorded 2026-09-22 50260ad39d7c5e06 · report
fixture: returned LlamaMLP · level recorded 2026-09-22 98b6bb174c074dae · report
fixture: returned LlamaRMSNorm · level recorded 2026-09-22 26ec53f064adbca5 · report
fixture: returned LlamaRotaryEmbedding · level recorded 2026-09-22 1104581ac75ea9c6 · report
660d5e5234e28212 · report
865ca1b3e9c1aa5c · report
cdc0ad3109c8984b · report
fixture: signature w:Tensor/1/float, poles:tuple/1/float · returned Tensor · level recorded, date not recorded a9e7f2cdf016b88b · report
fixture: signature module:callable/0/?, layers:list/1/callable, name:str/0/str · returned dict · level recorded 2026-09-22 b65e0b634a94c717 · report
fixture: signature model_type:str/0/str · returned list · level recorded 2026-09-25 dd982ece7960b018 · report
fixture: signature model:callable/0/? · returned str · level recorded 2026-09-25 303e2b878d149f4a · report
fixture: signature model:dict/0/?, sensitivity:int/0/int, outlier_config:dict/0/?, gradients:dict/0/? · returned list · level recorded 2026-09-24 e3a24217edf7812c · report
fixture: signature model:dict/0/?, gradients:dict/0/?, sensitivity:float/0/float · returned list · level recorded 2026-09-24 3d2bc2ac00f3f434 · report
fixture: signature model:dict/0/?, outlier_config:dict/0/?, outlier_weights:list/1/list · returned list · level recorded 2026-09-24 b1e98f962f5ae82d · report
efc347eff314b865 · report
b66c43d90a1a3a1b · report
5445de6acd6035bb · report
cf00f2eef08595e6 · report
72032d6f73d90892 · report
4d273bfb0feb28e0 · report
fixture: returned PromptTemplate · level recorded 2026-09-22 Method as code Syntology
What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it. Siblings are assemblies lifted from this paper in the same batch for the same method: alternative readings kept side by side; none replaces or supersedes another.
6 assemblies on this paper: 6 harvested, 0 generated, listed in 2 groups (siblings lifted in one batch form one group).
2 sibling assemblies for Llama 2-Chat (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.
harvested Assembly for Llama 2-Chat (graph method: Llama 2-Chat). 1 brick; individually on a fixture: 1 ran (of which 1 constructed an object rather than computing a result; 1 with no instrument failure: 0 honoured, 0 violated, 1 with no contract checked; 0 where Syntology's instrument failed) · 0 unverified; the one sample that ran constructed an object rather than computing a result. The assembly has not been run end-to-end.
one of 2 siblings
- PromptTemplate entry · level 1 · ran ·
4d273bfb0feb28e0
harvested Assembly for Llama 2-Chat (graph method: Llama 2-Chat). 1 brick; individually on a fixture: 0 ran · 1 unverified. The assembly has not been run end-to-end.
one of 2 siblings
- init_model entry · level 0 · unverified ·
b796bb9465578920
4 sibling assemblies for Llama 2 (harvested), lifted in the same batch on 2026-09-09: alternative readings kept side by side; none replaces or supersedes another.
harvested Assembly for Llama 2 (graph method: Llama 2). 11 bricks; individually on a fixture: 8 ran (of which 4 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 4 where Syntology's instrument failed) · 3 unverified. The assembly has not been run end-to-end.
one of 4 siblings
- LlamaModel entry · level 0 · unverified ·
865ca1b3e9c1aa5c - LlamaConfig helper · level 1 · ran ·
1bcd8d227ad19b17 - LlamaDecoderLayer model · level 0 · unverified ·
660d5e5234e28212 - LlamaRMSNorm helper · level 1 · ran ·
98b6bb174c074dae - _expand_mask helper · level 1 · ran · our draft was wrong ·
24b08fbedd93aff0 - _make_causal_mask helper · level 1 · ran; the contract check could not run ·
c5c590da5a7c2a3f - LlamaAttention model · level 0 · unverified ·
1104581ac75ea9c6 - LlamaMLP model · level 1 · ran ·
50260ad39d7c5e06 - LlamaRotaryEmbedding helper · level 1 · ran ·
26ec53f064adbca5 - apply_rotary_pos_emb helper · level 1 · ran; the contract check could not run ·
9a65a30d006fc96e - rotate_half helper · level 1 · ran · our draft was wrong ·
e03d53ba9d4f9ae5
harvested Assembly for Llama 2 (graph method: Llama 2). 5 bricks; individually on a fixture: 4 ran (of which 2 constructed an object rather than computing a result; 3 with no instrument failure: 1 honoured, 0 violated, 2 with no contract checked; 1 where Syntology's instrument failed) · 1 unverified. The assembly has not been run end-to-end.
one of 4 siblings
- LLaMAMLP entry · level 0 · unverified ·
b336e5e4f4b40ceb - Config helper · level 1 · ran ·
bf78fefededc09f7 - RMSNorm model · level 1 · ran ·
1e7100681c300ca2 - check_indicator_and_length helper · level 1 · ran; the contract check could not run (RAISES) ·
faa77017b4beec30 - find_multiple helper · level 1 · ran · honoured contract ·
ffe8d3a5e6f4b477
harvested Assembly for Llama 2 (graph method: Llama 2). 17 bricks; individually on a fixture: 9 ran (of which 4 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 5 where Syntology's instrument failed) · 8 unverified. The assembly has not been run end-to-end.
one of 4 siblings
- FlaxLLaMAModel entry · level 0 · unverified ·
cf00f2eef08595e6 - FlaxLLaMAModule model · level 0 · unverified ·
9238f425f871bc11 - FlaxLLaMAPreTrainedModel helper · level 0 · unverified ·
72032d6f73d90892 - FlaxLLaMABlockCollection model · level 1 · ran ·
2b160cc445933c46 - RMSNorm model · level 1 · ran ·
aaa8a447973c0f68 - FlaxLLaMABlock model · level 0 · unverified ·
7e8dcebe492702bb - get_gradient_checkpoint_policy helper · level 1 · ran · our draft was wrong ·
a9b09c32ed58621c - FlaxLLaMAAttention model · level 0 · unverified ·
733d82a9306baa8b - FlaxLLaMAMLP model · level 1 · ran ·
a4fb09d490cd772f - blockwise_ffn helper · level 0 · unverified ·
4833ab3506125762 - with_sharding_constraint helper · level 1 · ran · our draft was wrong ·
6c8893718b619284 - apply_rotary_emb model · level 0 · unverified ·
f280056a639ae634 - blockwise_attn helper · level 1 · ran · our draft was wrong ·
4932ae36f745aea2 - get_names_from_parition_spec helper · level 1 · ran · our draft was wrong ·
dad72196bdb2301a - names_in_current_mesh helper · level 0 · unverified ·
a8530c4a22be1de7 - Carry helper · level 1 · ran ·
a066e3b4457453fd - _chunk_attention_bias helper · level 1 · ran · our draft was wrong ·
d81e74d07a61f182
harvested Assembly for Llama 2 (graph method: Llama 2). 10 bricks; individually on a fixture: 6 ran (of which 1 constructed an object rather than computing a result; 3 with no instrument failure: 1 honoured, 0 violated, 2 with no contract checked; 3 where Syntology's instrument failed) · 4 unverified. The assembly has not been run end-to-end.
one of 4 siblings
- LLaMA2_SASRec entry · level 0 · unverified ·
4427e517543e4577 - ModelArgs helper · level 0 · unverified ·
75e3a8170f256bb7 - RMSNorm model · level 1 · ran ·
e27b34a3f741d4de - TransformerBlock model · level 0 · unverified ·
61aae005c3076a9b - precompute_freqs_cis helper · level 1 · ran · honoured contract ·
5f447bdd807ed3c0 - Attention model · level 0 · unverified ·
4334c46d3961b3fb - FeedForward model · level 1 · ran ·
9715deb8f27d4266 - apply_rotary_emb helper · level 1 · ran · our draft was wrong ·
af440c67b16afe67 - repeat_kv helper · level 2 · ran; the contract check could not run ·
6d2a08dcf3466514 - reshape_for_broadcast helper · level 1 · ran; the contract check could not run ·
e04ad9d4b02f50b6
Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2307.09288") returns these assemblies with each brick's role and wiring (how to connect).
Tasks
Results from the paper archive 2025-07-28
Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.
Methods
Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections