Create LLM-powered Chatbot using OpenVINO
In the rapidly evolving world of artificial intelligence (AI), chatbots have emerged as powerful tools for businesses to enhance customer interactions and streamline operations. Large Language Models (LLMs) are artificial intelligence systems that can understand and generate human language. They use
Content
Create LLM-powered Chatbot using OpenVINO
In the rapidly evolving world of artificial intelligence (AI), chatbots have emerged as powerful tools for businesses to enhance customer interactions and streamline operations. Large Language Models (LLMs) are artificial intelligence systems that can understand and generate human language. They use deep learning algorithms and massive amounts of data to learn the nuances of language and produce coherent and relevant responses. While a decent intent-based chatbot can answer basic, one-touch inquiries like order management, FAQs, and policy questions, LLM chatbots can tackle more complex, multi-touch questions. LLM enables chatbots to provide support in a conversational manner, similar to how humans do, through contextual memory. Leveraging the capabilities of Language Models, chatbots are becoming increasingly intelligent, capable of understanding and responding to human language with remarkable accuracy.
Previously, we already discussed how to build instruction-following pipeline using OpenVINO, please check out [LLM Question Answering example](../llm-question-answering) for reference. In this tutorial we consider how to use power of OpenVINO for running Large Language Models for both chat and QA over document. We will use a pre-trained model from the Hugging Face Transformers library.
This notebook series includes demonstration of two different ways to create inference pipelines:
- [LLM chatbot with Optimum Intel](./llm-chatbot.ipynb). The Hugging Face Optimum Intel library is used to create pipelines to run inference with OpenVINO Runtime.
- [LLM chatbot with Generate API](./llm-chatbot-generate-api.ipynb). The OpenVINO Generate API is used for generation of instruction-following inference pipeline.
The tutorial supports different models, you can select one from provided options to compare quality of open source LLM solutions.
Note: conversion of some models can require additional actions from user side and at least 64GB RAM for conversion.
The available options are:
- tiny-llama-1b-chat - This is the chat model finetuned on top of TinyLlama/TinyLlama-1.1B-intermediate-step-1431k-3T. The TinyLlama project aims to pretrain a 1.1B Llama model on 3 trillion tokens with the adoption of the same architecture and tokenizer as Llama 2. This means TinyLlama can be plugged and played in many open-source projects built upon Llama. Besides, TinyLlama is compact with only 1.1B parameters. This compactness allows it to cater to a multitude of applications demanding a restricted computation and memory footprint. More details about model can be found in model card
- mini-cpm-2b-dpo - MiniCPM is an End-Size LLM developed by ModelBest Inc. and TsinghuaNLP, with only 2.4B parameters excluding embeddings. After Direct Preference Optimization (DPO) fine-tuning, MiniCPM outperforms many popular 7b, 13b and 70b models. More details can be found in model_card.
- llama-3.2-1B-instruct - 1B parameters model from LLama3.2 collection of instruction-tuned multilingual models. Llama 3.2 instruction-tuned text only models are optimized for multilingual dialogue use cases, including agentic retrieval and summarization tasks. They outperform many of the available open source and closed chat models on common industry benchmarks. More details can be found in model card
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- llama-3.2-3B-instruct - 3B parameters model from LLama3.2 collection of instruction-tuned multilingual models. Llama 3.2 instruction-tuned text only models are optimized for multilingual dialogue use cases, including agentic retrieval and summarization tasks. They outperform many of the available open source and closed chat models on common industry benchmarks. More details can be found in model card
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- gemma-2b-it - Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights, pre-trained variants, and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning. This model is instruction-tuned version of 2B parameters model. More details about model can be found in model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- gemma-2-2b-it - Gemma2 is the second generation of a Gemma family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights, pre-trained variants, and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning. This model is instruction-tuned version of 2B parameters model. More details about model can be found in model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- red-pajama-3b-chat - A 2.8B parameter pre-trained language model based on GPT-NEOX architecture. It was developed by Together Computer and leaders from the open-source AI community. The model is fine-tuned on OASST1 and Dolly2 datasets to enhance chatting ability. More details about model can be found in HuggingFace model card.
- phi3-mini-instruct - The Phi-3-Mini is a 3.8B parameters, lightweight, state-of-the-art open model trained with the Phi-3 datasets that includes both synthetic data and the filtered publicly available websites data with a focus on high-quality and reasoning dense properties. More details about model can be found in model card, Microsoft blog and technical report.
- phi-3.5-mini-instruct - Phi-3.5-mini is a lightweight, state-of-the-art open model built upon datasets used for Phi-3 - synthetic data and filtered publicly available websites - with a focus on very high-quality, reasoning dense data. The model belongs to the Phi-3 model family and supports 128K token context length. The model underwent a rigorous enhancement process, incorporating both supervised fine-tuning, proximal policy optimization, and direct preference optimization to ensure precise instruction adherence and robust safety measures. More details about model can be found in model card, Microsoft blog and technical report.
- phi-4-mini-instruct - Phi-4-mini is a lightweight, state-of-the-art open model built upon a blend of synthetic datasets and data from filtered public domain websites with focus on high-quality, reasoning on dense data. More details about model can be found in model card.
- phi-4 - Phi-4 is 14B model that built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning. Phi-4 underwent a rigorous enhancement and alignment process, incorporating both supervised fine-tuning and direct preference optimization to ensure precise instruction adherence and robust safety measures. More details about model can be found in model_card, technical report and Microsoft blog.
- phi-4-mini-reasoning - Phi-4-mini-reasoning is a lightweight open model built upon synthetic data with a focus on high-quality, reasoning dense data further finetuned for more advanced math reasoning capabilities. More details about model can be found in model card.
- phi-4-reasoning - Phi-4-reasoning is a state-of-the-art open-weight reasoning model finetuned from Phi-4 using supervised fine-tuning on a dataset of chain-of-thought traces and reinforcement learning. The supervised fine-tuning dataset includes a blend of synthetic prompts and high-quality filtered data from public domain websites, focused on math, science, and coding skills as well as alignment data for safety and Responsible AI. The goal of this approach was to ensure that small capable models were trained with data focused on high quality and advanced reasoning. More details about model can be found in model card.
- gemma-7b-it - Gemma is a family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights, pre-trained variants, and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning. This model is instruction-tuned version of 7B parameters model. More details about model can be found in model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- gemma-2-9b-it - Gemma2 is the second generation of a Gemma family of lightweight, state-of-the-art open models from Google, built from the same research and technology used to create the Gemini models. They are text-to-text, decoder-only large language models, available in English, with open weights, pre-trained variants, and instruction-tuned variants. Gemma models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning. This model is instruction-tuned version of 9B parameters model. More details about model can be found in model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- llama-2-7b-chat - LLama 2 is the second generation of LLama models developed by Meta. Llama 2 is a collection of pre-trained and fine-tuned generative text models ranging in scale from 7 billion to 70 billion parameters. llama-2-7b-chat is 7 billions parameters version of LLama 2 finetuned and optimized for dialogue use case. More details about model can be found in the paper, repository and HuggingFace model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- llama-3-8b-instruct - Llama 3 is an auto-regressive language model that uses an optimized transformer architecture. The tuned versions use supervised fine-tuning (SFT) and reinforcement learning with human feedback (RLHF) to align with human preferences for helpfulness and safety. The Llama 3 instruction tuned models are optimized for dialogue use cases and outperform many of the available open source chat models on common industry benchmarks. More details about model can be found in Meta blog post, model website and model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- llama-3.1-8b-instruct - The Llama 3.1 instruction tuned text only models (8B, 70B, 405B) are optimized for multilingual dialogue use cases and outperform many of the available open source and closed chat models on common industry benchmarks. More details about model can be found in Meta blog post, model website and model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- qwen2.5-0.5b-instruct/qwen2.5-1.5b-instruct/qwen2.5-3b-instruct/qwen2.5-7b-instruct/qwen2.5-14b-instruct - Qwen2.5 is the latest series of Qwen large language models. Comparing with Qwen2, Qwen2.5 series brings significant improvements in coding, mathematics and general knowledge skills. Additionally, it brings long-context and multiple languages support including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more. For more details, please refer to model_card, blog, GitHub, and Documentation.
- qwen-7b-chat - Qwen-7B is the 7B-parameter version of the large language model series, Qwen (abbr. Tongyi Qianwen), proposed by Alibaba Cloud. Qwen-7B is a Transformer-based large language model, which is pretrained on a large volume of data, including web texts, books, codes, etc. For more details about Qwen, please refer to the GitHub code repository.
- mpt-7b-chat - MPT-7B is part of the family of MosaicPretrainedTransformer (MPT) models, which use a modified transformer architecture optimized for efficient training and inference. These architectural changes include performance-optimized layer implementations and the elimination of context length limits by replacing positional embeddings with Attention with Linear Biases (ALiBi). Thanks to these modifications, MPT models can be trained with high throughput efficiency and stable convergence. MPT-7B-chat is a chatbot-like model for dialogue generation. It was built by finetuning MPT-7B on the ShareGPT-Vicuna, HC3, Alpaca, HH-RLHF, and Evol-Instruct datasets. More details about the model can be found in blog post, repository and HuggingFace model card.
- mistral-7B-Instruct-v0.3 - The Mistral-7B-Instruct-v0.3 state‑of‑the‑art large language model (LLM) useful on a variety of language understanding and generation tasks, it is an instruct fine-tuned version of the Mistral-7B-v0.3. You can find more details about model in the model card.
Note: run model with demo, you will need to accept license agreement.
You must be a registered user in 🤗 Hugging Face Hub. Please visit HuggingFace model card, carefully read terms of usage and click accept button. You will need to use an access token for the code below to run. For more information on access tokens, refer to this section of the documentation.
- Mistral-Small-24B-Instruct-2501 - Mistral Small is a 24B parameter instruction-tuned language model from Mistral AI. More details about the model can be found in the Mistral AI model card.
- zephyr-7b-beta - Zephyr is a series of language models that are trained to act as helpful assistants. Zephyr-7B-beta is the second model in the series, and is a fine-tuned version of mistralai/Mistral-7B-v0.1 that was trained on on a mix of publicly available, synthetic datasets using Direct Preference Optimization (DPO). You can find more details about model in technical report and HuggingFace model card.
- neural-chat-7b-v3-1 - Mistral-7b model fine-tuned using Intel Gaudi. The model fine-tuned on the open source dataset Open-Orca/SlimOrca and aligned with Direct Preference Optimization (DPO) algorithm. More details can be found in model card and blog post.
- youri-7b-chat - Youri-7b-chat is a Llama2 based model. Rinna Co., Ltd. conducted further pre-training for the Llama2 model with a mixture of English and Japanese datasets to improve Japanese task capability. The model is publicly released on Hugging Face hub. You can find detailed information at the rinna/youri-7b-chat project page.
- baichuan2-7b-chat - Baichuan 2 is the new generation of large-scale open-source language models launched by Baichuan Intelligence inc. It is trained on a high-quality corpus with 2.6 trillion tokens and has achieved the best performance in authoritative Chinese and English benchmarks of the same size.
- internlm2-chat-1.8b - InternLM2 is the second generation InternLM series. Compared to the previous generation model, it shows significant improvements in various capabilities, including reasoning, mathematics, and coding. More details about model can be found in model repository.
- glm-4-9b-chat - GLM-4-9B is the open-source version of the latest generation of pre-trained models in the GLM-4 series launched by Zhipu AI. In the evaluation of data sets in semantics, mathematics, reasoning, code, and knowledge, GLM-4-9B and its human preference-aligned version GLM-4-9B-Chat have shown superior performance beyond Llama-3-8B. In addition to multi-round conversations, GLM-4-9B-Chat also has advanced features such as web browsing, code execution, custom tool calls (Function Call), and long text reasoning (supporting up to 128K context). More details about model can be found in model card, technical report and repository.
- minicpm3-4b - MiniCPM3-4B is the 3rd generation of MiniCPM series. The overall performance of MiniCPM3-4B surpasses Phi-3.5-mini-Instruct, being comparable with many recent 7B~9B models.Compared to previous generations, MiniCPM3-4B has a more powerful and versatile skill set to enable more general usage. More details can be found in model card.
- DeepSeek-R1-Distill-Qwen-1.5B - Qwen2.5-1.5B fine-tuned using the reasoning data generated by DeepSeek-R1. You can find more info in model card
- DeepSeek-R1-Distill-Qwen-7B - Qwen2.5-7B fine-tuned using the reasoning data generated by DeepSeek-R1. You can find more info in model card
- DeepSeek-R1-Distill-Llama-8B - Llama-3.1-8B fine-tuned using the reasoning data generated by DeepSeek-R1. You can find more info in model card
- GLM-4-9B-0414 - GLM-4-32B-0414 series models, featuring 32 billion parameters. Its performance is comparable to OpenAI’s GPT series and DeepSeek V3/R1 series. It also supports very user-friendly local deployment features. GLM-4-32B-Base-0414 was pre-trained on 15T of high-quality data, including substantial reasoning-type synthetic data. You can find more info in model card.
- GLM-Z1-32B-0414 - GLM-Z1-32B-0414 is a reasoning model with deep thinking capabilities. This was developed based on GLM-4-32B-0414 through cold start, extended reinforcement learning, and further training on tasks including mathematics, code, and logic. Compared to the base model, GLM-Z1-32B-0414 significantly improves mathematical abilities and the capability to solve complex tasks. You can find more info in model card.
- Qwen3-1.7/4B/8B/14B - Qwen3 is the latest generation of large language models in Qwen series, offering a comprehensive suite of dense and mixture-of-experts (MoE) models. Building upon extensive advancements in training data, model architecture, and optimization techniques, Qwen3 delivers the following key improvements over the previously released Qwen2.5. You can find more info in model card.
- Qwen3-30B-A3B - Qwen3-30B-A3B is a Mixture-of-Experts (MoE) model with 30.5B total parameters but only 3.3B activated per token (128 experts, 8 activated). It supports hybrid thinking modes: thinking mode with step-by-step reasoning (
<think>...</think>) and non-thinking mode for fast responses. You can find more info in model card. - MiniCPM5-1B - MiniCPM5-1B is the first release of the MiniCPM5 series from ModelBest Inc. and OpenBMB. It is a dense 1B-parameter LLM (24 layers, GQA with 16 query / 2 key-value heads, up to 131K context, BF16) targeting on-device deployment, agent / tool use, code and complex reasoning. The same weights support Hybrid Reasoning: a thinking mode with step-by-step reasoning (
<think>...</think>) for hard tasks and a non-thinking mode for fast everyday chat, switched via the chat template'senable_thinkingflag. License: Apache-2.0. You can find more info in model card. - MiniCPM5-2B - MiniCPM5-2B is the second release of the MiniCPM5 series from ModelBest Inc. and OpenBMB. It is a dense 2B-parameter LLM (42 layers, GQA with 16 query / 2 key-value heads, up to 131K context, BF16) designed for on-device assistants, coding agents, tool use and complex reasoning. The same weights support Hybrid Reasoning: a thinking mode with step-by-step reasoning (
<think>...</think>) for hard tasks and a non-thinking mode for fast everyday chat, switched via the chat template'senable_thinkingflag. License: Apache-2.0. You can find more info in model card. - AFM-4.5B - AFM-4.5B is a 4.5 billion parameter instruction-tuned model developed by Arcee.ai, designed for enterprise-grade performance across diverse deployment environments from cloud to edge. The base model was trained on a dataset of 8 trillion tokens, comprising 6.5 trillion tokens of general pretraining data followed by 1.5 trillion tokens of midtraining data with enhanced focus on mathematical reasoning and code generation. Following pretraining, the model underwent supervised fine-tuning on high-quality instruction datasets. The instruction-tuned model was further refined through reinforcement learning on verifiable rewards as well as for human preference. You can find more info in model card.
- gpt-oss-20b - gpt-oss-20b is a 20 billion parameter open-weight models designed for powerful reasoning, agentic tasks, and versatile developer use cases. You can find more info in model card.
Note: gpt-oss-20b model is not supported with OpenVINO GPU plugin.
- bitnet-b1.58-2B-4T - bitnet-b1.58-2B-4T is an open-source, native 1-bit Large Language Model (LLM) at the 2-billion parameter scale, developed by Microsoft Research. Trained on a corpus of 4 trillion tokens, this model demonstrates that native 1-bit LLMs can achieve performance comparable to leading open-weight, full-precision models of similar size, while offering substantial advantages in computational efficiency (memory, energy, latency). You can find more info in model card.
Note: bitnet-b1.58-2B-4T model doesn't currently support compression.
- SmolLM3-3B - SmolLM3-3B is a 3 billion parameter language model developed by Hugging Face. It uses transformer decoder architecture with 36 layers, 2048-dimensional hidden states, and GQA (Grouped Query Attention) with 16 attention heads and 4 key-value heads. SmolLM3 supports reasoning with thinking tokens (
<think>...</think>) and uses ChatML format for chat interactions. It performs diverse tasks including reasoning, mathematics, and coding. You can find more info in model card. - lfm2-350m/lfm2-700m/lfm2-1.2b/lfm2-2.6b/lfm2-24b-a2b - LFM2 is a series of hybrid language models from Liquid AI, designed for edge and on-device deployment. The architecture combines convolutional layers with grouped query attention (GQA). LFM2 supports 8 languages: English, Arabic, Chinese, French, German, Japanese, Korean, and Spanish. You can find more info in model card and technical report.
- lfm2.5-350m - LFM2.5 is an updated LFM family from Liquid AI with improved edge efficiency. You can find more info in model card.
Note: LFM2 and LFM2.5 are supported in the [Generate API](./llm-chatbot-generate-api.ipynb) notebook via OpenVINO GenAI. Preconverted models on Hugging Face are available for lfm2.5-350m (FP16) and lfm2-24b-a2b (INT4); other sizes may require local conversion.
The image below illustrates the provided user instruction and model answer examples.
Notebook Contents
The tutorial consists of the following steps:
- Install prerequisites
- Download and convert the model from a public source using the OpenVINO integration with Hugging Face Optimum.
- Compress model weights to INT4 or INT8 precision using NNCF
- Create an inference pipeline
- Run chatbot / QA over document
Installation Instructions
This is a self-contained example that relies solely on its own code.</br> We recommend running the notebook in a virtual environment. You only need a Jupyter server to start. For details, please refer to [Installation Guide](../../README.md).
Source and license
- Source
- Intel OpenVINO Notebooks
- Original
- openvinotoolkit/openvino_notebooks/notebooks/llm-chatbot
- License
- Apache-2.0