Add Llama 3.2 3B affine-Q4 cellm model
Browse filesAdds the verified 2.37 GiB affine-Q4 v1 artifact, tokenizer files, model card, and conversion manifest.
- .gitattributes +1 -0
- Llama-3.2-3B-Instruct-Q4-affine-v1/Llama-3.2-3B-Instruct-Q4-affine-v1.cellm +3 -0
- Llama-3.2-3B-Instruct-Q4-affine-v1/README.md +59 -0
- Llama-3.2-3B-Instruct-Q4-affine-v1/manifest.json +84 -0
- Llama-3.2-3B-Instruct-Q4-affine-v1/tokenizer.json +0 -0
- Llama-3.2-3B-Instruct-Q4-affine-v1/tokenizer_config.json +3 -0
.gitattributes
CHANGED
|
@@ -70,3 +70,4 @@ nanowhale-100m-v1/nanowhale-100m-v1.cellm filter=lfs diff=lfs merge=lfs -text
|
|
| 70 |
LFM2.5-230M/LFM2.5-230M-int4.cellm filter=lfs diff=lfs merge=lfs -text
|
| 71 |
LFM2.5-230M/LFM2.5-230M.cellm filter=lfs diff=lfs merge=lfs -text
|
| 72 |
LFM2.5-230M/LFM2.5-230M-int4-v2.cellm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 70 |
LFM2.5-230M/LFM2.5-230M-int4.cellm filter=lfs diff=lfs merge=lfs -text
|
| 71 |
LFM2.5-230M/LFM2.5-230M.cellm filter=lfs diff=lfs merge=lfs -text
|
| 72 |
LFM2.5-230M/LFM2.5-230M-int4-v2.cellm filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
Llama-3.2-3B-Instruct-Q4-affine-v1/Llama-3.2-3B-Instruct-Q4-affine-v1.cellm filter=lfs diff=lfs merge=lfs -text
|
Llama-3.2-3B-Instruct-Q4-affine-v1/Llama-3.2-3B-Instruct-Q4-affine-v1.cellm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f408ba787161090b5a9e0aa02248655fd81d8f256f8198cc767add9f3a8ffcad
|
| 3 |
+
size 2550044032
|
Llama-3.2-3B-Instruct-Q4-affine-v1/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: cellm
|
| 3 |
+
base_model: meta-llama/Llama-3.2-3B-Instruct
|
| 4 |
+
license: llama3.2
|
| 5 |
+
tags:
|
| 6 |
+
- cellm
|
| 7 |
+
- llama
|
| 8 |
+
- quantized
|
| 9 |
+
- affine-q4
|
| 10 |
+
- cpu
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Llama 3.2 3B Instruct — cellm affine-Q4 v1
|
| 14 |
+
|
| 15 |
+
A `cellm` conversion of Llama 3.2 3B Instruct for local inference. The model preserves unsigned affine 4-bit weights with per-64-value FP32 scales and biases instead of symmetrically requantizing them.
|
| 16 |
+
|
| 17 |
+
## Artifact
|
| 18 |
+
|
| 19 |
+
- File: `Llama-3.2-3B-Instruct-Q4-affine-v1.cellm`
|
| 20 |
+
- Size: `2,550,044,032` bytes (2.37 GiB)
|
| 21 |
+
- SHA-256: `f408ba787161090b5a9e0aa02248655fd81d8f256f8198cc767add9f3a8ffcad`
|
| 22 |
+
- Layers: 28
|
| 23 |
+
- Quantization: unsigned affine Q4, group size 64
|
| 24 |
+
- RoPE: Llama 3 scaled interleaved RoPE
|
| 25 |
+
- KV cache used for validation: F16
|
| 26 |
+
|
| 27 |
+
See `manifest.json` for conversion provenance, source hashes, tensor counts, model configuration, and runtime baseline metadata.
|
| 28 |
+
|
| 29 |
+
## CPU inference
|
| 30 |
+
|
| 31 |
+
```sh
|
| 32 |
+
./target/release/infer \
|
| 33 |
+
--model Llama-3.2-3B-Instruct-Q4-affine-v1.cellm \
|
| 34 |
+
--tokenizer tokenizer.json \
|
| 35 |
+
--prompt "What is the capital of France?" \
|
| 36 |
+
--chat --gen 32 --temperature 0 --top-k 1 \
|
| 37 |
+
--repeat-penalty 1.0 --backend cpu --kv-encoding f16
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
Expected deterministic response:
|
| 41 |
+
|
| 42 |
+
```text
|
| 43 |
+
The capital of France is Paris.
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
## Requirements
|
| 47 |
+
|
| 48 |
+
Use a `cellm` runtime that supports:
|
| 49 |
+
|
| 50 |
+
- packed unsigned affine-Q4 weights (`u32` tensor convention)
|
| 51 |
+
- per-group FP32 `.scales` and `.biases`
|
| 52 |
+
- Llama 3 interleaved scaled RoPE
|
| 53 |
+
- Llama 3 chat formatting and `<|eot_id|>` stopping
|
| 54 |
+
|
| 55 |
+
Repository: https://github.com/jeffasante/cellm
|
| 56 |
+
|
| 57 |
+
## License
|
| 58 |
+
|
| 59 |
+
The model is derived from `meta-llama/Llama-3.2-3B-Instruct` and remains subject to the Llama 3.2 Community License and Acceptable Use Policy. Users are responsible for complying with the upstream terms.
|
Llama-3.2-3B-Instruct-Q4-affine-v1/manifest.json
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"schema_version": 1,
|
| 3 |
+
"baseline_id": "llama-3.2-3b-instruct-q4-affine-v1",
|
| 4 |
+
"artifact": {
|
| 5 |
+
"path": "models/Llama-3.2-3B-Instruct-Q4-affine-v1.cellm",
|
| 6 |
+
"sha256": "f408ba787161090b5a9e0aa02248655fd81d8f256f8198cc767add9f3a8ffcad",
|
| 7 |
+
"expected_file_size": 2550044032,
|
| 8 |
+
"format": "cellm",
|
| 9 |
+
"format_version": 1,
|
| 10 |
+
"tensor_count": 646,
|
| 11 |
+
"tensor_dtype_counts": {
|
| 12 |
+
"f16": 58,
|
| 13 |
+
"f32": 392,
|
| 14 |
+
"u32": 196
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"source_model": {
|
| 18 |
+
"path": "models/gguf/Llama-3.2-3B-Instruct-Q4.base",
|
| 19 |
+
"sha256": "20c803b2eeee70a7dada67ca0ee2d75081d95d0e35bac27d1857f9e3fdd84615",
|
| 20 |
+
"expected_file_size": 2380601344,
|
| 21 |
+
"format": "base",
|
| 22 |
+
"format_version": 1,
|
| 23 |
+
"source_checkpoint": "src-Llama-3.2-3B-Instruct"
|
| 24 |
+
},
|
| 25 |
+
"tokenizer": {
|
| 26 |
+
"path": "models/Llama-3.2-3B-Instruct/tokenizer.json",
|
| 27 |
+
"sha256": "6b918bc5f3f1c33371d5ac45a53d565a737a7ff1bdf3a8b8055e09eec6a25ff4",
|
| 28 |
+
"config_path": "models/Llama-3.2-3B-Instruct/tokenizer_config.json",
|
| 29 |
+
"config_sha256": "00e9df46f6d2f18d1e44fa2741634f04603ec16a64b5062f7505ebf1700880ff",
|
| 30 |
+
"chat_template": "llama3",
|
| 31 |
+
"chat_template_markers": [
|
| 32 |
+
"<|start_header_id|>",
|
| 33 |
+
"<|end_header_id|>",
|
| 34 |
+
"<|eot_id|>"
|
| 35 |
+
]
|
| 36 |
+
},
|
| 37 |
+
"conversion": {
|
| 38 |
+
"timestamp_utc": "2026-07-22T23:43:30Z",
|
| 39 |
+
"command": "python3 tools/convert_base_to_cellm.py --input models/gguf/Llama-3.2-3B-Instruct-Q4.base --output models/Llama-3.2-3B-Instruct-Q4-affine-v1.cellm --tokenizer models/Llama-3.2-3B-Instruct --quantize affine-i4",
|
| 40 |
+
"quantization_scheme": "unsigned-affine-i4",
|
| 41 |
+
"group_size": 64,
|
| 42 |
+
"dequantization_formula": "value = q_unsigned * scale + bias",
|
| 43 |
+
"converter_path": "tools/convert_base_to_cellm.py",
|
| 44 |
+
"converter_sha256": "0f5395839bc9f8136de6913f99cf09059cb15e48b840ed52490ac6813b521d79",
|
| 45 |
+
"converter_commit": "fd47a71b7cafd102a0fc31003a609225a378cb5a",
|
| 46 |
+
"working_tree_dirty": true
|
| 47 |
+
},
|
| 48 |
+
"runtime": {
|
| 49 |
+
"commit": "fd47a71b7cafd102a0fc31003a609225a378cb5a",
|
| 50 |
+
"working_tree_dirty": true,
|
| 51 |
+
"source_sha256": {
|
| 52 |
+
"crates/cellm-model/src/llama.rs": "4a57ac121435f6298e32a9363e569029d6d917ec9a2d48be8715f7175a86132d",
|
| 53 |
+
"crates/cellm-model/src/cellm_file.rs": "4e5697a2c6f77cf867ee4200da2eea040e91c38b9cc0a47140e45aba9757e50d",
|
| 54 |
+
"crates/cellm-kernels/src/cpu_kernels.rs": "ac8e530e9b46ed398edea0090d46cfccf45f3f9cc0e0ddaffd9dc4f83bdfef08",
|
| 55 |
+
"tools/infer/src/main.rs": "bbe18febed0da38bc82f786ca7b91409cccf8cb66f34e07c1c534e24606c108c"
|
| 56 |
+
}
|
| 57 |
+
},
|
| 58 |
+
"model_config": {
|
| 59 |
+
"architecture": "llama",
|
| 60 |
+
"layers": 28,
|
| 61 |
+
"hidden_size": 3072,
|
| 62 |
+
"intermediate_size": 8192,
|
| 63 |
+
"attention_heads": 24,
|
| 64 |
+
"kv_heads": 8,
|
| 65 |
+
"head_dim": 128,
|
| 66 |
+
"vocab_size": 128256,
|
| 67 |
+
"rope_theta": 500000.0,
|
| 68 |
+
"rope_mode": "interleaved",
|
| 69 |
+
"rope_scaling": {
|
| 70 |
+
"type": "llama3",
|
| 71 |
+
"factor": 32.0,
|
| 72 |
+
"original_max_position_embeddings": 8192,
|
| 73 |
+
"low_freq_factor": 1.0,
|
| 74 |
+
"high_freq_factor": 4.0
|
| 75 |
+
},
|
| 76 |
+
"bos_token_id": 128000,
|
| 77 |
+
"eos_token_id": 128001,
|
| 78 |
+
"stop_token_ids": {
|
| 79 |
+
"eom_id": 128008,
|
| 80 |
+
"eot_id": 128009
|
| 81 |
+
}
|
| 82 |
+
},
|
| 83 |
+
"oracle_fixture": "tests/baselines/llama_3_2_3b_affine_v1_oracle.json"
|
| 84 |
+
}
|
Llama-3.2-3B-Instruct-Q4-affine-v1/tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
Llama-3.2-3B-Instruct-Q4-affine-v1/tokenizer_config.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chat_template": "{{- bos_token }}\n{%- if custom_tools is defined %}\n {%- set tools = custom_tools %}\n{%- endif %}\n{%- if not tools_in_user_message is defined %}\n {%- set tools_in_user_message = true %}\n{%- endif %}\n{%- if not date_string is defined %}\n {%- if strftime_now is defined %}\n {%- set date_string = strftime_now(\"%d %b %Y\") %}\n {%- else %}\n {%- set date_string = \"26 Jul 2024\" %}\n {%- endif %}\n{%- endif %}\n{%- if not tools is defined %}\n {%- set tools = none %}\n{%- endif %}\n\n{#- This block extracts the system message, so we can slot it into the right place. #}\n{%- if messages[0]['role'] == 'system' %}\n {%- set system_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n{%- else %}\n {%- set system_message = \"\" %}\n{%- endif %}\n\n{#- System message #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if tools is not none %}\n {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{{- \"Cutting Knowledge Date: December 2023\\n\" }}\n{{- \"Today Date: \" + date_string + \"\\n\\n\" }}\n{%- if tools is not none and not tools_in_user_message %}\n {{- \"You have access to the following functions. To call a function, please respond with JSON for a function call.\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n{%- endif %}\n{{- system_message }}\n{{- \"<|eot_id|>\" }}\n\n{#- Custom tools are passed in a user message with some extra guidance #}\n{%- if tools_in_user_message and not tools is none %}\n {#- Extract the first user message so we can plug it in here #}\n {%- if messages | length != 0 %}\n {%- set first_user_message = messages[0]['content']|trim %}\n {%- set messages = messages[1:] %}\n {%- else %}\n {{- raise_exception(\"Cannot put tools in the first user message when there's no first user message!\") }}\n{%- endif %}\n {{- '<|start_header_id|>user<|end_header_id|>\\n\\n' -}}\n {{- \"Given the following functions, please respond with a JSON for a function call \" }}\n {{- \"with its proper arguments that best answers the given prompt.\\n\\n\" }}\n {{- 'Respond in the format {\"name\": function name, \"parameters\": dictionary of argument name and its value}.' }}\n {{- \"Do not use variables.\\n\\n\" }}\n {%- for t in tools %}\n {{- t | tojson(indent=4) }}\n {{- \"\\n\\n\" }}\n {%- endfor %}\n {{- first_user_message + \"<|eot_id|>\"}}\n{%- endif %}\n\n{%- for message in messages %}\n {%- if not (message.role == 'ipython' or message.role == 'tool' or 'tool_calls' in message) %}\n {{- '<|start_header_id|>' + message['role'] + '<|end_header_id|>\\n\\n'+ message['content'] | trim + '<|eot_id|>' }}\n {%- elif 'tool_calls' in message %}\n {%- if not message.tool_calls|length == 1 %}\n {{- raise_exception(\"This model only supports single tool-calls at once!\") }}\n {%- endif %}\n {%- set tool_call = message.tool_calls[0].function %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n {{- '\"parameters\": ' }}\n {{- tool_call.arguments | tojson }}\n {{- \"}\" }}\n {{- \"<|eot_id|>\" }}\n {%- elif message.role == \"tool\" or message.role == \"ipython\" %}\n {{- \"<|start_header_id|>ipython<|end_header_id|>\\n\\n\" }}\n {%- if message.content is mapping or message.content is iterable %}\n {{- message.content | tojson }}\n {%- else %}\n {{- message.content }}\n {%- endif %}\n {{- \"<|eot_id|>\" }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' }}\n{%- endif %}\n"
|
| 3 |
+
}
|