Phi-3-mini-FastDraft-50M-int8-ov

Description

FastDraft is a novel and efficient approach for pre-training and aligning a draft model to any LLM to be used with speculative decoding, by incorporating efficient pre-training followed by fine-tuning over synthetic datasets generated by the target model. FastDraft was presented in paper at ENLSP@NeurIPS24 by Intel Labs.

This is a draft model that was trained with FastDraft to accompany Phi-3-mini-4k-instruct.

This is Phi-3-mini-FastDraft-50M model converted to the OpenVINO™ IR (Intermediate Representation) format with weights compressed to int8 by NNCF.

Quantization Parameters

Weight compression was performed using nncf.compress_weights with the following parameters:

  • mode: INT8_ASYM

For more information on quantization, check the OpenVINO model optimization guide.

Compatibility

The provided OpenVINO™ IR model is compatible with:

  • OpenVINO version 2024.5 and higher
  • Optimum Intel 1.20.0 and higher

Running Model Inference with OpenVINO GenAI

  1. Install packages required for using OpenVINO GenAI with Speculative decoding:
pip install -U "openvino-genai>=2024.5" huggingface_hub
  1. Download models from HuggingFace Hub
import huggingface_hub as hf_hub
 
main_model_id = "OpenVINO/Phi-3-mini-4k-instruct-int4-ov"
draft_model_id = "OpenVINO/Phi-3-mini-FastDraft-50M-int8-ov"
 
main_model_path = "main"
draft_model_path = "draft"
 
hf_hub.snapshot_download(main_model_id, local_dir=main_model_path)
hf_hub.snapshot_download(draft_model_id, local_dir=draft_model_path)
  1. Run model inference using the speculative decoding and specify the pipeline parameters:
import openvino_genai
 
prompt = "What is OpenVINO?"
 
config = openvino_genai.GenerationConfig()
config.num_assistant_tokens = 3
config.max_new_tokens = 128
 
def streamer(subword):
    print(subword, end='', flush=True)
    return False
 
main_device = "CPU"
draft_device = "CPU"
 
draft_model = openvino_genai.draft_model(draft_model_path, draft_device)
 
scheduler_config = openvino_genai.SchedulerConfig()
scheduler_config.cache_size = 2
 
pipe = openvino_genai.LLMPipeline(main_model_path, main_device, scheduler_config=scheduler_config, draft_model=draft_model)
 
pipe.generate(prompt, config, streamer)

More GenAI usage examples can be found in OpenVINO GenAI library docs and samples

Legal Information

The model is distributed under the Intel Research Use License Agreement.

Disclaimer

Intel is committed to respecting human rights and avoiding causing or contributing to adverse impacts on human rights. See Intel’s Global Human Rights Principles. Intel’s products and software are intended only to be used in applications that do not cause or contribute to adverse impacts on human rights.

Downloads last month
147
Inference API
Unable to determine this model's library. Check the docs .

Collection including OpenVINO/Phi-3-mini-FastDraft-50M-int8-ov