swiftkv llama 8b fp8
#4
by
						
jeffra
	
							
						- opened
							
					
- .gitattributes +0 -1
- README.md +0 -5
- config.json +5 -6
- generation_config.json +2 -4
- model-00001-of-00002.safetensors → model-00001-of-00003.safetensors +2 -2
- model-00002-of-00002.safetensors → model-00002-of-00003.safetensors +2 -2
- model-00003-of-00003.safetensors +3 -0
- model.safetensors.index.json +0 -0
- recipe.yaml +1 -1
- tokenizer.json +0 -0
- tokenizer_config.json +0 -1
    	
        .gitattributes
    CHANGED
    
    | @@ -33,4 +33,3 @@ 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
         | 
| 36 | 
            -
            tokenizer.json 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
         | 
|  | 
    	
        README.md
    CHANGED
    
    | @@ -13,11 +13,6 @@ For more details about SwiftKV and how to use it: | |
| 13 | 
             
            * 📝 [SwiftKV: Fast Prefill-Optimized Inference with Knowledge-Preserving Model Transformation (arXiv)](https://arxiv.org/abs/2410.03960)
         | 
| 14 | 
             
            * 🚀 [Getting started guide](https://github.com/Snowflake-Labs/vllm/tree/swiftkv/examples/swiftkv)
         | 
| 15 |  | 
| 16 | 
            -
            ## Revisions
         | 
| 17 | 
            -
             | 
| 18 | 
            -
            * **release-2508 (Aug 2025):** Updated model weights for long-context up to 128K
         | 
| 19 | 
            -
            * **release-2412 (Dec 2024):** Initial model release
         | 
| 20 | 
            -
             | 
| 21 | 
             
            ## Performance Metrics
         | 
| 22 |  | 
| 23 | 
             
            To evaluate SwiftKV’s performance, we focus on the following key metrics (see more details in our [blog](https://www.snowflake.com/engineering-blog/swiftkv-llm-compute-reduction/)):
         | 
|  | |
| 13 | 
             
            * 📝 [SwiftKV: Fast Prefill-Optimized Inference with Knowledge-Preserving Model Transformation (arXiv)](https://arxiv.org/abs/2410.03960)
         | 
| 14 | 
             
            * 🚀 [Getting started guide](https://github.com/Snowflake-Labs/vllm/tree/swiftkv/examples/swiftkv)
         | 
| 15 |  | 
|  | |
|  | |
|  | |
|  | |
|  | |
| 16 | 
             
            ## Performance Metrics
         | 
| 17 |  | 
| 18 | 
             
            To evaluate SwiftKV’s performance, we focus on the following key metrics (see more details in our [blog](https://www.snowflake.com/engineering-blog/swiftkv-llm-compute-reduction/)):
         | 
    	
        config.json
    CHANGED
    
    | @@ -1,5 +1,5 @@ | |
| 1 | 
             
            {
         | 
| 2 | 
            -
              "_name_or_path": "/data-fast/ | 
| 3 | 
             
              "architectures": [
         | 
| 4 | 
             
                "LlamaSwiftKVForCausalLM"
         | 
| 5 | 
             
              ],
         | 
| @@ -11,13 +11,12 @@ | |
| 11 | 
             
                128008,
         | 
| 12 | 
             
                128009
         | 
| 13 | 
             
              ],
         | 
| 14 | 
            -
              "head_dim": 128,
         | 
| 15 | 
             
              "hidden_act": "silu",
         | 
| 16 | 
             
              "hidden_size": 4096,
         | 
| 17 | 
             
              "initializer_range": 0.02,
         | 
| 18 | 
             
              "intermediate_size": 14336,
         | 
| 19 | 
             
              "key_value_group_size": 1,
         | 
| 20 | 
            -
              "max_position_embeddings":  | 
| 21 | 
             
              "mlp_bias": false,
         | 
| 22 | 
             
              "model_type": "llama_swiftkv",
         | 
| 23 | 
             
              "num_attention_heads": 32,
         | 
| @@ -59,7 +58,7 @@ | |
| 59 | 
             
                  }
         | 
| 60 | 
             
                },
         | 
| 61 | 
             
                "format": "float-quantized",
         | 
| 62 | 
            -
                "global_compression_ratio":  | 
| 63 | 
             
                "ignore": [
         | 
| 64 | 
             
                  "lm_head"
         | 
| 65 | 
             
                ],
         | 
| @@ -78,8 +77,8 @@ | |
| 78 | 
             
              "rope_theta": 500000.0,
         | 
| 79 | 
             
              "swiftkv": true,
         | 
| 80 | 
             
              "tie_word_embeddings": false,
         | 
| 81 | 
            -
              "torch_dtype": " | 
| 82 | 
            -
              "transformers_version": "4. | 
| 83 | 
             
              "use_cache": true,
         | 
| 84 | 
             
              "vocab_size": 128256
         | 
| 85 | 
             
            }
         | 
|  | |
| 1 | 
             
            {
         | 
| 2 | 
            +
              "_name_or_path": "/data-fast/swiftkv-8b-prod/",
         | 
| 3 | 
             
              "architectures": [
         | 
| 4 | 
             
                "LlamaSwiftKVForCausalLM"
         | 
| 5 | 
             
              ],
         | 
|  | |
| 11 | 
             
                128008,
         | 
| 12 | 
             
                128009
         | 
| 13 | 
             
              ],
         | 
|  | |
| 14 | 
             
              "hidden_act": "silu",
         | 
| 15 | 
             
              "hidden_size": 4096,
         | 
| 16 | 
             
              "initializer_range": 0.02,
         | 
| 17 | 
             
              "intermediate_size": 14336,
         | 
| 18 | 
             
              "key_value_group_size": 1,
         | 
| 19 | 
            +
              "max_position_embeddings": 8192,
         | 
| 20 | 
             
              "mlp_bias": false,
         | 
| 21 | 
             
              "model_type": "llama_swiftkv",
         | 
| 22 | 
             
              "num_attention_heads": 32,
         | 
|  | |
| 58 | 
             
                  }
         | 
| 59 | 
             
                },
         | 
| 60 | 
             
                "format": "float-quantized",
         | 
| 61 | 
            +
                "global_compression_ratio": 2.014836000728121,
         | 
| 62 | 
             
                "ignore": [
         | 
| 63 | 
             
                  "lm_head"
         | 
| 64 | 
             
                ],
         | 
|  | |
| 77 | 
             
              "rope_theta": 500000.0,
         | 
| 78 | 
             
              "swiftkv": true,
         | 
| 79 | 
             
              "tie_word_embeddings": false,
         | 
| 80 | 
            +
              "torch_dtype": "float32",
         | 
| 81 | 
            +
              "transformers_version": "4.44.2",
         | 
| 82 | 
             
              "use_cache": true,
         | 
| 83 | 
             
              "vocab_size": 128256
         | 
| 84 | 
             
            }
         | 
    	
        generation_config.json
    CHANGED
    
    | @@ -1,12 +1,10 @@ | |
| 1 | 
             
            {
         | 
|  | |
| 2 | 
             
              "bos_token_id": 128000,
         | 
| 3 | 
            -
              "do_sample": true,
         | 
| 4 | 
             
              "eos_token_id": [
         | 
| 5 | 
             
                128001,
         | 
| 6 | 
             
                128008,
         | 
| 7 | 
             
                128009
         | 
| 8 | 
             
              ],
         | 
| 9 | 
            -
              " | 
| 10 | 
            -
              "top_p": 0.9,
         | 
| 11 | 
            -
              "transformers_version": "4.47.0"
         | 
| 12 | 
             
            }
         | 
|  | |
| 1 | 
             
            {
         | 
| 2 | 
            +
              "_from_model_config": true,
         | 
| 3 | 
             
              "bos_token_id": 128000,
         | 
|  | |
| 4 | 
             
              "eos_token_id": [
         | 
| 5 | 
             
                128001,
         | 
| 6 | 
             
                128008,
         | 
| 7 | 
             
                128009
         | 
| 8 | 
             
              ],
         | 
| 9 | 
            +
              "transformers_version": "4.44.2"
         | 
|  | |
|  | |
| 10 | 
             
            }
         | 
    	
        model-00001-of-00002.safetensors → model-00001-of-00003.safetensors
    RENAMED
    
    | @@ -1,3 +1,3 @@ | |
| 1 | 
             
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            -
            oid sha256: | 
| 3 | 
            -
            size  | 
|  | |
| 1 | 
             
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:ec250bf8cd44778ec1c652b80f902806c2f1c001eb37497c09f72a109a930857
         | 
| 3 | 
            +
            size 4981367864
         | 
    	
        model-00002-of-00002.safetensors → model-00002-of-00003.safetensors
    RENAMED
    
    | @@ -1,3 +1,3 @@ | |
| 1 | 
             
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            -
            oid sha256: | 
| 3 | 
            -
            size  | 
|  | |
| 1 | 
             
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:4726b2f5c7e9f9b40aafd595706a45567da5e3582418b4c79959e6121a569a72
         | 
| 3 | 
            +
            size 4509004976
         | 
    	
        model-00003-of-00003.safetensors
    ADDED
    
    | @@ -0,0 +1,3 @@ | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            version https://git-lfs.github.com/spec/v1
         | 
| 2 | 
            +
            oid sha256:807f447c6cbb2ca067d666792676583d839a732328c5aa624dd9bf26fc00fac4
         | 
| 3 | 
            +
            size 2101346432
         | 
    	
        model.safetensors.index.json
    CHANGED
    
    | The diff for this file is too large to render. 
		See raw diff | 
|  | 
    	
        recipe.yaml
    CHANGED
    
    | @@ -2,5 +2,5 @@ DEFAULT_stage: | |
| 2 | 
             
              DEFAULT_modifiers:
         | 
| 3 | 
             
                QuantizationModifier:
         | 
| 4 | 
             
                  ignore: [lm_head]
         | 
| 5 | 
            -
                  targets:  | 
| 6 | 
             
                  scheme: FP8_DYNAMIC
         | 
|  | |
| 2 | 
             
              DEFAULT_modifiers:
         | 
| 3 | 
             
                QuantizationModifier:
         | 
| 4 | 
             
                  ignore: [lm_head]
         | 
| 5 | 
            +
                  targets: Linear
         | 
| 6 | 
             
                  scheme: FP8_DYNAMIC
         | 
    	
        tokenizer.json
    CHANGED
    
    | The diff for this file is too large to render. 
		See raw diff | 
|  | 
    	
        tokenizer_config.json
    CHANGED
    
    | @@ -2053,7 +2053,6 @@ | |
| 2053 | 
             
              "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    {%- set date_string = \"26 Jul 2024\" %}\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 + builtin tools #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if builtin_tools is defined or tools is not none %}\n    {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{%- if builtin_tools is defined %}\n    {{- \"Tools: \" + builtin_tools | reject('equalto', 'code_interpreter') | join(\", \") + \"\\n\\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        {%- if builtin_tools is defined and tool_call.name in builtin_tools %}\n            {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n            {{- \"<|python_tag|>\" + tool_call.name + \".call(\" }}\n            {%- for arg_name, arg_val in tool_call.arguments | items %}\n                {{- arg_name + '=\"' + arg_val + '\"' }}\n                {%- if not loop.last %}\n                    {{- \", \" }}\n                {%- endif %}\n                {%- endfor %}\n            {{- \")\" }}\n        {%- else  %}\n            {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n            {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n            {{- '\"parameters\": ' }}\n            {{- tool_call.arguments | tojson }}\n            {{- \"}\" }}\n        {%- endif %}\n        {%- if builtin_tools is defined %}\n            {#- This means we're in ipython mode #}\n            {{- \"<|eom_id|>\" }}\n        {%- else %}\n            {{- \"<|eot_id|>\" }}\n        {%- endif %}\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",
         | 
| 2054 | 
             
              "clean_up_tokenization_spaces": true,
         | 
| 2055 | 
             
              "eos_token": "<|eot_id|>",
         | 
| 2056 | 
            -
              "extra_special_tokens": {},
         | 
| 2057 | 
             
              "model_input_names": [
         | 
| 2058 | 
             
                "input_ids",
         | 
| 2059 | 
             
                "attention_mask"
         | 
|  | |
| 2053 | 
             
              "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    {%- set date_string = \"26 Jul 2024\" %}\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 + builtin tools #}\n{{- \"<|start_header_id|>system<|end_header_id|>\\n\\n\" }}\n{%- if builtin_tools is defined or tools is not none %}\n    {{- \"Environment: ipython\\n\" }}\n{%- endif %}\n{%- if builtin_tools is defined %}\n    {{- \"Tools: \" + builtin_tools | reject('equalto', 'code_interpreter') | join(\", \") + \"\\n\\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        {%- if builtin_tools is defined and tool_call.name in builtin_tools %}\n            {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n            {{- \"<|python_tag|>\" + tool_call.name + \".call(\" }}\n            {%- for arg_name, arg_val in tool_call.arguments | items %}\n                {{- arg_name + '=\"' + arg_val + '\"' }}\n                {%- if not loop.last %}\n                    {{- \", \" }}\n                {%- endif %}\n                {%- endfor %}\n            {{- \")\" }}\n        {%- else  %}\n            {{- '<|start_header_id|>assistant<|end_header_id|>\\n\\n' -}}\n            {{- '{\"name\": \"' + tool_call.name + '\", ' }}\n            {{- '\"parameters\": ' }}\n            {{- tool_call.arguments | tojson }}\n            {{- \"}\" }}\n        {%- endif %}\n        {%- if builtin_tools is defined %}\n            {#- This means we're in ipython mode #}\n            {{- \"<|eom_id|>\" }}\n        {%- else %}\n            {{- \"<|eot_id|>\" }}\n        {%- endif %}\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",
         | 
| 2054 | 
             
              "clean_up_tokenization_spaces": true,
         | 
| 2055 | 
             
              "eos_token": "<|eot_id|>",
         | 
|  | |
| 2056 | 
             
              "model_input_names": [
         | 
| 2057 | 
             
                "input_ids",
         | 
| 2058 | 
             
                "attention_mask"
         | 
