Dyluhn commited on
Commit
fbfc532
Β·
verified Β·
1 Parent(s): 6577e6d

RidgeFill projector (bf16 and q8_0), model card, SHA256SUMS

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ llama-3.1-8b-instruct-s12-bf16.gguf filter=lfs diff=lfs merge=lfs -text
37
+ llama-3.1-8b-instruct-s12-q8_0.gguf filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ LLAMA 3.1 COMMUNITY LICENSE AGREEMENT
2
+
3
+ Llama 3.1 Version Release Date: July 23, 2024
4
+
5
+ β€œAgreement” means the terms and conditions for use, reproduction, distribution and modification of the Llama Materials set forth herein.
6
+
7
+ β€œDocumentation” means the specifications, manuals and documentation accompanying Llama 3.1 distributed by Meta at https://llama.meta.com/doc/overview.
8
+
9
+ β€œLicensee” or β€œyou” means you, or your employer or any other person or entity (if you are entering into this Agreement on such person or entity’s behalf), of the age required under applicable laws, rules or regulations to provide legal consent and that has legal authority to bind your employer or such other person or entity if you are entering in this Agreement on their behalf.
10
+
11
+ β€œLlama 3.1” means the foundational large language models and software and algorithms, including machine-learning model code, trained model weights, inference-enabling code, training-enabling code, fine-tuning enabling code and other elements of the foregoing distributed by Meta at https://llama.meta.com/llama-downloads.
12
+
13
+ β€œLlama Materials” means, collectively, Meta’s proprietary Llama 3.1 and Documentation (and any portion thereof) made available under this Agreement.
14
+
15
+ β€œMeta” or β€œwe” means Meta Platforms Ireland Limited (if you are located in or, if you are an entity, your principal place of business is in the EEA or Switzerland) and Meta Platforms, Inc. (if you are located outside of the EEA or Switzerland).Β 
16
+
17
+ By clicking β€œI Accept” below or by using or distributing any portion or element of the Llama Materials, you agree to be bound by this Agreement.
18
+
19
+ 1. License Rights and Redistribution.

20
+ a. Grant of Rights. You are granted a non-exclusive, worldwide, non-transferable and royalty-free limited license under Meta’s intellectual property or other rights owned by Meta embodied in the Llama Materials to use, reproduce, distribute, copy, create derivative works of, and make modifications to the Llama Materials.Β Β 
21
+
22
+ b. Redistribution and Use.Β Β 
23
+
24
+ i. If you distribute or make available the Llama Materials (or any derivative works thereof), or a product or service (including another AI model) that contains any of them, you shall (A) provide a copy of this Agreement with any such Llama Materials; and (B) prominently display β€œBuilt with Llama” on a related website, user interface, blogpost, about page, or product documentation. If you use the Llama Materials or any outputs or results of the Llama Materials to create, train, fine tune, or otherwise improve an AI model, which is distributed or made available, you shall also include β€œLlama” at the beginning of any such AI model name.
25
+
26
+ ii.Β If you receive Llama Materials, or any derivative works thereof, from a Licensee as part of an integrated end user product, then Section 2 of this Agreement will not apply to you.Β 
27
+
28
+ iii. You must retain in all copies of the Llama Materials that you distribute the following attribution notice within a β€œNotice” text file distributed as a part of such copies: β€œLlama 3.1 is licensed under the Llama 3.1 Community License, Copyright Β© Meta Platforms, Inc. All Rights Reserved.”
29
+
30
+ iv. Your use of the Llama Materials must comply with applicable laws and regulations (including trade compliance laws and regulations) and adhere to the Acceptable Use Policy for the Llama Materials (available at https://llama.meta.com/llama3_1/use-policy), which is hereby incorporated by reference into this Agreement.
31
+ Β Β 
32
+ 2. Additional Commercial Terms. If, on the Llama 3.1 version release date, the monthly active users of the products or services made available by or for Licensee, or Licensee’s affiliates, is greater than 700 million monthly active users in the preceding calendar month, you must request a license from Meta, which Meta may grant to you in its sole discretion, and you are not authorized to exercise any of the rights under this Agreement unless or until Meta otherwise expressly grants you such rights.
33
+
34
+ 3. Disclaimer of Warranty. UNLESS REQUIRED BY APPLICABLE LAW, THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS THEREFROM ARE PROVIDED ON AN β€œAS IS” BASIS, WITHOUT WARRANTIES OF ANY KIND, AND META DISCLAIMS ALL WARRANTIES OF ANY KIND, BOTH EXPRESS AND IMPLIED, INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. YOU ARE SOLELY RESPONSIBLE FOR DETERMINING THE APPROPRIATENESS OF USING OR REDISTRIBUTING THE LLAMA MATERIALS AND ASSUME ANY RISKS ASSOCIATED WITH YOUR USE OF THE LLAMA MATERIALS AND ANY OUTPUT AND RESULTS.
35
+
36
+ 4. Limitation of Liability. IN NO EVENT WILL META OR ITS AFFILIATES BE LIABLE UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, TORT, NEGLIGENCE, PRODUCTS LIABILITY, OR OTHERWISE, ARISING OUT OF THIS AGREEMENT, FOR ANY LOST PROFITS OR ANY INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL, EXEMPLARY OR PUNITIVE DAMAGES, EVEN IF META OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF ANY OF THE FOREGOING.
37
+ Β 
38
+ 5. Intellectual Property.
39
+
40
+ a. No trademark licenses are granted under this Agreement, and in connection with the Llama Materials, neither Meta nor Licensee may use any name or mark owned by or associated with the other or any of its affiliates, except as required for reasonable and customary use in describing and redistributing the Llama Materials or as set forth in this Section 5(a). Meta hereby grants you a license to use β€œLlama” (the β€œMark”) solely as required to comply with the last sentence of Section 1.b.i. You will comply with Meta’s brand guidelines (currently accessible at https://about.meta.com/brand/resources/meta/company-brand/). All goodwill arising out of your use of the Mark will inure to the benefit of Meta.
41
+
42
+ b. Subject to Meta’s ownership of Llama Materials and derivatives made by or for Meta, with respect to any derivative works and modifications of the Llama Materials that are made by you, as between you and Meta, you are and will be the owner of such derivative works and modifications.
43
+
44
+ c. If you institute litigation or other proceedings against Meta or any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Llama Materials or Llama 3.1 outputs or results, or any portion of any of the foregoing, constitutes infringement of intellectual property or other rights owned or licensable by you, then any licenses granted to you under this Agreement shall terminate as of the date such litigation or claim is filed or instituted. You will indemnify and hold harmless Meta from and against any claim by any third party arising out of or related to your use or distribution of the Llama Materials.
45
+
46
+ 6. Term and Termination. The term of this Agreement will commence upon your acceptance of this Agreement or access to the Llama Materials and will continue in full force and effect until terminated in accordance with the terms and conditions herein. Meta may terminate this Agreement if you are in breach of any term or condition of this Agreement. Upon termination of this Agreement, you shall delete and cease use of the Llama Materials. Sections 3, 4 and 7 shall survive the termination of this Agreement.Β 
47
+
48
+ 7. Governing Law and Jurisdiction. This Agreement will be governed and construed under the laws of the State of California without regard to choice of law principles, and the UN Convention on Contracts for the International Sale of Goods does not apply to this Agreement. The courts of California shall have exclusive jurisdiction of any dispute arising out of this Agreement.Β 
README.md ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: llama3.1
3
+ base_model: meta-llama/Llama-3.1-8B-Instruct
4
+ tags:
5
+ - ridgefill
6
+ - llama.cpp
7
+ - gguf
8
+ - prefill-acceleration
9
+ - llama-3.1
10
+ ---
11
+
12
+ # Llama-3.1-8B-Instruct RidgeFill Projector (split 12)
13
+
14
+ Built with Llama.
15
+
16
+ Per-layer linear maps for RidgeFill in the llama.cpp fork
17
+ [Approximate-Science/llama.cpp-ridgefill](https://github.com/Approximate-Science/llama.cpp-ridgefill).
18
+ RidgeFill is a training-free prefill accelerator. Layers 0–11 run for every prompt token. For prompt tokens before
19
+ the exact tail, the projector predicts the inputs of layers 12–31 from the layer-12 hidden state, and only those
20
+ layers' K/V cache rows are computed from the prediction. The tail and generation run every layer.
21
+
22
+ By Dylan Johnston and tcclaviger. Cite with DOI [10.5281/zenodo.23179168](https://doi.org/10.5281/zenodo.23179168).
23
+ The maps are fitted on Llama 3.1 hidden states and are distributed under the Llama 3.1 Community License
24
+ (`LICENSE`, `USE_POLICY.md`).
25
+
26
+ ## Files
27
+ | File | Maps | Bytes | SHA256 |
28
+ |---|---|---|---|
29
+ | llama-3.1-8b-instruct-s12-bf16.gguf | bf16 | 671,419,904 | 83b893b7da619dbf280071f6d5a7e2fb1655eef4b7b5f288a90003d3c612fd34 |
30
+ | llama-3.1-8b-instruct-s12-q8_0.gguf | q8_0 | 356,847,104 | 625cffeb57d7a26659f720bd05931cbaa6cd0ef526f93bb3d77623cb452797a9 |
31
+
32
+ Fit (from the GGUF metadata): ridge Ξ» 0.03, 834,541 rows from 71 documents, base model revision 4699cc75
33
+ (`unsloth/Llama-3.1-8B-Instruct`). The q8_0 file measures the same as bf16 within noise (table below).
34
+ Works with any quantization of the model (F16, Q8_0, Q4_K_M measured).
35
+
36
+ ## Use
37
+ ```sh
38
+ hf download TheCacheIsALie/Llama-3.1-8B-Instruct-RidgeFill-Projector llama-3.1-8b-instruct-s12-q8_0.gguf --local-dir models
39
+ llama-server -m Llama-3.1-8B-Instruct-Q4_K_M.gguf -c 32768 -ngl 99 -fa on \
40
+ --ridgefill models/llama-3.1-8b-instruct-s12-q8_0.gguf --ridgefill-tail 8192
41
+ ```
42
+ Build the fork as described in its
43
+ [RIDGEFILL.md](https://github.com/Approximate-Science/llama.cpp-ridgefill/blob/main/RIDGEFILL.md).
44
+ Tail length sets the tradeoff: a tail of about a quarter of the prompt held the tail NLL loss to
45
+ 0.20–0.26 nats at 8K–32K in the measurements below. The S1, lexical and question-attention selection modes of
46
+ the Qwen3.8-27B port do not apply to this model; only the plain fill with an exact tail does.
47
+
48
+ ## Measured
49
+ One RTX 4090 24 GB, CUDA 12.4, flash attention on, `-b 2048 -ub 512`, F16 KV cache, fork commit fa8061c4b,
50
+ wikitext-2 test text. Stock = the same build without `--ridgefill`. Tail T = 4096 unless stated.
51
+
52
+ Prompt processing, `llama-bench -p N -n 0 -r 3`, speedup over stock:
53
+
54
+ | Model | 8K | 16K | 32K |
55
+ |---|---|---|---|
56
+ | F16 | 1.26Γ— | 1.51Γ— | 1.74Γ— |
57
+ | Q4_K_M | 1.26Γ— | 1.52Γ— | 1.73Γ— |
58
+
59
+ TTFT through `llama-server`, Q4_K_M, mean of 3 prompts, seconds (stock β†’ RidgeFill): 8K 0.77 β†’ 0.60;
60
+ 16K 1.73 β†’ 1.14; 32K 4.30 β†’ 2.47. Generation speed (tg128) is the same with and without RidgeFill.
61
+
62
+ Tail NLL (mean NLL of the last 4095 tokens of each window, nats/token, stock β†’ RidgeFill), Q4_K_M:
63
+
64
+ | Prompt | T = 4096 | T = 8192 | T = 16384 |
65
+ |---|---|---|---|
66
+ | 8K (35 windows), stock 1.846 | 2.031 | β€” | β€” |
67
+ | 16K (17 windows), stock 1.811 | 2.047 (1.52Γ—) | 1.927 (1.27Γ—) | nothing filled |
68
+ | 32K (8 windows), stock 1.843 | 2.681 (1.73Γ—) | 2.050 (1.52Γ—) | 1.938 (1.23Γ—) |
69
+
70
+ `llama-perplexity` (`-c N`; effective tail max(T, N/2)), stock β†’ RidgeFill:
71
+
72
+ | Model | -c 8192 | -c 16384 | -c 32768 |
73
+ |---|---|---|---|
74
+ | F16 | 6.1775 β†’ 7.5485 | 5.8588 β†’ 7.0083 | 6.7350 β†’ 7.8851 |
75
+ | Q4_K_M | 6.3350 β†’ 7.6229 | 6.0108 β†’ 7.0517 | 6.9105 β†’ 7.9416 |
76
+ | F16, q8_0 projector | 6.1775 β†’ 7.5446 | 5.8588 β†’ 7.0046 | 6.7350 β†’ 7.8886 |
77
+
78
+ Needle in a haystack (wikitext-2 haystack, synthetic needle, depths 10–90%, 4 needles per depth and length, greedy,
79
+ T = 4096), needles found:
80
+
81
+ | Arm | 8K | 16K | 32K | Needles inside the filled region |
82
+ |---|---|---|---|---|
83
+ | F16 stock | 20/20 | 20/20 | 20/20 | β€” |
84
+ | F16 RidgeFill | 19/20 | 15/20 | 15/20 | 35/44 |
85
+ | Q4_K_M stock | 20/20 | 20/20 | 20/20 | β€” |
86
+ | Q4_K_M RidgeFill | 18/20 | 17/20 | 14/20 | 34/44 |
87
+
88
+ Output is not identical to stock llama.cpp.
SHA256SUMS ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ 83b893b7da619dbf280071f6d5a7e2fb1655eef4b7b5f288a90003d3c612fd34 llama-3.1-8b-instruct-s12-bf16.gguf
2
+ 625cffeb57d7a26659f720bd05931cbaa6cd0ef526f93bb3d77623cb452797a9 llama-3.1-8b-instruct-s12-q8_0.gguf
USE_POLICY.md ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ **Llama 3.1** **Acceptable Use Policy**
2
+
3
+ Meta is committed to promoting safe and fair use of its tools and features, including Llama 3.1. If you access or use Llama 3.1, you agree to this Acceptable Use Policy (β€œ**Policy**”). The most recent copy of this policy can be found at <span style="text-decoration:underline;">https://llama.meta.com/llama3_1/use-policy</span>.
4
+
5
+ **Prohibited Uses**
6
+
7
+ We want everyone to use Llama 3.1 safely and responsibly. You agree you will not use, or allow others to use, Llama 3.1 to:
8
+
9
+
10
+
11
+ * Violate the law or others’ rights, including to:
12
+ * Engage in, promote, generate, contribute to, encourage, plan, incite, or further illegal or unlawful activity or content, such as:
13
+ * Violence or terrorism
14
+ * Exploitation or harm to children, including the solicitation, creation, acquisition, or dissemination of child exploitative content or failure to report Child Sexual Abuse Material
15
+ * Human trafficking, exploitation, and sexual violence
16
+ * The illegal distribution of information or materials to minors, including obscene materials, or failure to employ legally required age-gating in connection with such information or materials.
17
+ * Sexual solicitation
18
+ * Any other criminal activity
19
+ * Engage in, promote, incite, or facilitate the harassment, abuse, threatening, or bullying of individuals or groups of individuals
20
+ * Engage in, promote, incite, or facilitate discrimination or other unlawful or harmful conduct in the provision of employment, employment benefits, credit, housing, other economic benefits, or other essential goods and services
21
+ * Engage in the unauthorized or unlicensed practice of any profession including, but not limited to, financial, legal, medical/health, or related professional practices
22
+ * Collect, process, disclose, generate, or infer health, demographic, or other sensitive personal or private information about individuals without rights and consents required by applicable laws
23
+ * Engage in or facilitate any action or generate any content that infringes, misappropriates, or otherwise violates any third-party rights, including the outputs or results of any products or services using the Llama Materials
24
+ * Create, generate, or facilitate the creation of malicious code, malware, computer viruses or do anything else that could disable, overburden, interfere with or impair the proper working, integrity, operation or appearance of a website or computer system
25
+ * Engage in, promote, incite, facilitate, or assist in the planning or development of activities that present a risk of death or bodily harm to individuals, including use of Llama 3.1 related to the following:
26
+ * Military, warfare, nuclear industries or applications, espionage, use for materials or activities that are subject to the International Traffic Arms Regulations (ITAR) maintained by the United States Department of State
27
+ * Guns and illegal weapons (including weapon development)
28
+ * Illegal drugs and regulated/controlled substances
29
+ * Operation of critical infrastructure, transportation technologies, or heavy machinery
30
+ * Self-harm or harm to others, including suicide, cutting, and eating disorders
31
+ * Any content intended to incite or promote violence, abuse, or any infliction of bodily harm to an individual
32
+ * Intentionally deceive or mislead others, including use of Llama 3.1 related to the following:
33
+ * Generating, promoting, or furthering fraud or the creation or promotion of disinformation
34
+ * Generating, promoting, or furthering defamatory content, including the creation of defamatory statements, images, or other content
35
+ * Generating, promoting, or further distributing spam
36
+ * Impersonating another individual without consent, authorization, or legal right
37
+ * Representing that the use of Llama 3.1 or outputs are human-generated
38
+ * Generating or facilitating false online engagement, including fake reviews and other means of fake online engagement
39
+ * Fail to appropriately disclose to end users any known dangers of your AI system
40
+
41
+ Please report any violation of this Policy, software β€œbug,” or other problems that could lead to a violation of this Policy through one of the following means:
42
+
43
+
44
+
45
+ * Reporting issues with the model: <span style="text-decoration:underline;">https://github.com/meta-llama/llama-models/issues</span>
46
+ * Reporting risky content generated by the model: developers.facebook.com/llama_output_feedback
47
+ * Reporting bugs and security concerns: facebook.com/whitehat/info
48
+ * Reporting violations of the Acceptable Use Policy or unlicensed uses of Llama 3.1: LlamaUseReport@meta.com
llama-3.1-8b-instruct-s12-bf16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:83b893b7da619dbf280071f6d5a7e2fb1655eef4b7b5f288a90003d3c612fd34
3
+ size 671419904
llama-3.1-8b-instruct-s12-q8_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:625cffeb57d7a26659f720bd05931cbaa6cd0ef526f93bb3d77623cb452797a9
3
+ size 356847104