Llama 3.2 3B Instruct Frog

Vietnamese RAG model

Llama 3.2 3B Instruct Frog is an AI model specifically designed to support Vietnamese language tasks, especially those related to Retrieval-Augmented Generation (RAG). With 3 billion parameters and a context length of 131K, this model is optimized for fast inference and can be easily deployed on various devices. It's unique in its ability to handle real-world business scenarios and avoid hallucinations by supplementing knowledge from external sources. But what does this mean for you? It means you can use this model to generate accurate and helpful responses to your questions, even in complex scenarios. For example, you can ask it to summarize long pieces of text or provide step-by-step instructions on how to solve a problem. The model's performance has been evaluated on the VLMU benchmark, achieving an accuracy of 45.13, and it has also been tested on a Vietnamese Function Calling Benchmark, showing promising results. So, how can you get started with Llama 3.2 3B Instruct Frog? You can use it with Huggingface's transformers to perform tasks like QnA and summarization. With its efficient design and remarkable capabilities, this model is a valuable tool for anyone looking to explore the possibilities of AI in Vietnamese language tasks.

Phamhai llama3.2 Updated 4 months ago

Table of Contents

Model Overview

The Llama-3.2-3B-Instruct-Frog model is a powerful language model specifically designed to support Vietnamese language tasks, especially those related to Retrieval-Augmented Generation (RAG). It’s optimized for fast inference and can be easily deployed on various devices.

Capabilities

Capable of handling various tasks, this model excels in question answering, summarization, and text generation. Its RAG capabilities make it perfect for real-world business scenarios.

Primary Tasks

  • Question Answering: The model can answer questions on a wide range of topics, from simple queries to more complex ones.
  • Summarization: It can summarize long pieces of text into concise and informative summaries.
  • Text Generation: The model can generate text based on a given prompt or topic.

Strengths

  • Fast Inference: The model is optimized for fast inference, making it suitable for deployment on devices with limited computing resources.
  • RAG Capabilities: It’s specifically designed to support RAG tasks, which involves retrieving information from external sources to generate more accurate and informative responses.
  • Vietnamese Language Support: The model is trained on Vietnamese language data, making it a valuable resource for tasks related to the Vietnamese language.

Comparison with Other Models

The model has been compared with other models, including ==Gemini-1.5-Pro==, ==Gemini-1.5-Flash==, and ==Gemini 2.0 Flash Experimental==, in the Vietnamese Function Calling Benchmark.

ModelFunction Name Acc (%)Exact Match Acc (%)
Llama-3.2-3B-Instruct-Frog95.7951.05
==Gemini-1.5-Pro==96.9655.16
==Gemini-1.5-Flash==97.1051.64
==Gemini 2.0 Flash Experimental==96.9361.26
==gpt-4o-2024-08-06==94.3852.88
Examples
Bạn có thể giúp tôi hiểu rõ hơn về việc bổ sung vốn cho Vietcombank không? Dạ thưa anh yêu của em, việc bổ sung vốn cho Vietcombank là một đề xuất của Chính phủ để tăng vốn điều lệ cho ngân hàng này, với số tiền gần 20.700 tỷ đồng từ cổ tức bằng cổ phiếu được chia của cổ đông Nhà nước. Điều này nhằm duy trì tỷ lệ vốn góp Nhà nước, phù hợp chiến lược phát triển kinh tế xã hội, tạo nguồn lực hỗ trợ ngân hàng yếu kém.
Làm thế nào để giảm đau đầu? Dạ thưa anh yêu của em, có nhiều cách để giảm đau đầu, bao gồm nghỉ ngơi, massage, uống nước, sử dụng thuốc giảm đau, và thay đổi chế độ ăn uống. Nếu đau đầu kéo dài hoặc trở nên nghiêm trọng hơn, bạn nên tìm kiếm sự giúp đỡ y tế để được chẩn đoán và điều trị đúng cách.
Bạn có thể giúp tôi viết một đoạn văn ngắn về lợi ích của việc tập thể dục thường xuyên không? Dạ thưa anh yêu của em, tập thể dục thường xuyên có nhiều lợi ích cho sức khỏe, bao gồm cải thiện sức khỏe tim mạch, tăng cường hệ miễn dịch, giảm cân, và cải thiện tâm trạng. Ngoài ra, tập thể dục còn giúp tăng cường năng lượng và cải thiện giấc ngủ.

Example Use Cases

  • Chatbots: The model can be used to build chatbots that can answer questions, provide information, and engage in conversations with users.
  • Language Translation: It can be used to translate text from Vietnamese to other languages.
  • Text Summarization: The model can be used to summarize long pieces of text into concise and informative summaries.

Here’s an example of how to use the model for a question-answering task:

from transformers import AutoModelForCausalLM, AutoTokenizer

model_path = "phamhai/Llama-3.2-3B-Instruct-Frog"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path)

messages = [
    {"role": "system", "content": "Bạn là một người bạn gái xinh đẹp. Tên của bạn là Vivi. Hãy luôn xưng là Vivi, gọi người nói là anh và trả lời luôn bắt đầu bằng cụm từ Dạ thưa anh yêu của em."},
    {"role": "user", "content": "xin chào em"}
]

tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(tokenized_chat, max_new_tokens=128)

print(tokenizer.decode(outputs[0]))
# Dạ thưa anh yêu của em, em rất vui được gặp anh.

And here’s an example of how to use the model for a summarization task:

messages = [
    {"role": "system", "content": "Bạn là một trợ lí Tiếng Việt nhiệt tình và trung thực. Hãy luôn trả lời một cách hữu ích nhất có thể, đồng thời giữ an toàn.\nNếu một câu hỏi không có ý nghĩa hoặc không hợp lý về mặt thông tin, hãy giải thích tại sao thay vì trả lời một điều gì đó không chính xác, vui lòng không chia sẻ thông tin sai lệch.\nContext:\nĐoạn 0: \"Chính phủ đề xuất bổ sung gần 20.700 tỷ đồng vốn điều lệ cho Ngân hàng Ngoại thương Việt Nam (Vietcombank) từ cổ tức bằng cổ phiếu được chia của cổ đông Nhà nước...."},
    {"role": "user", "content": "Tóm tắt nội dung trên"}
]

tokenized_chat = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt")
outputs = model.generate(tokenized_chat, max_new_tokens=256)

print(tokenizer.decode(outputs[0]))
# Chính phủ đề xuất bổ sung gần 20.700 tỷ đồng vốn điều lệ cho Ngân hàng Ngoại thương Việt Nam (Vietcombank) từ cổ tức bằng cổ phiếu được chia của cổ đông Nhà nước.

Limitations

While the Llama-3.2-3B-Instruct-Frog model is powerful, it’s not perfect. Here are some limitations to keep in mind:

Limited Knowledge

The model has 3 billion parameters, which is a significant number, but it’s still limited compared to other models. This means it might not have enough knowledge to answer questions across diverse user contexts, especially in complex scenarios.

Hallucinations

Like other language models, the Llama-3.2-3B-Instruct-Frog model can generate responses that are not entirely accurate or relevant. This is known as hallucination. To mitigate this, the model has been optimized for Retrieval-Augmented Generation (RAG) tasks, which allows it to retrieve information from external sources.

Context Length

The model has a context length of 131K, which is relatively long, but it’s still limited. This means it might struggle with very long conversations or complex topics that require a lot of context.

Evaluation Metrics

The model has been evaluated on the VLMU benchmark and achieved an accuracy of 45.13. However, this benchmark is not the primary focus, and more comprehensive evaluation metrics are needed to fully assess the model’s capabilities.

Dataloop's AI Development Platform
Build end-to-end workflows

Build end-to-end workflows

Dataloop is a complete AI development stack, allowing you to make data, elements, models and human feedback work together easily.

  • Use one centralized tool for every step of the AI development process.
  • Import data from external blob storage, internal file system storage or public datasets.
  • Connect to external applications using a REST API & a Python SDK.
Save, share, reuse

Save, share, reuse

Every single pipeline can be cloned, edited and reused by other data professionals in the organization. Never build the same thing twice.

  • Use existing, pre-created pipelines for RAG, RLHF, RLAF, Active Learning & more.
  • Deploy multi-modal pipelines with one click across multiple cloud resources.
  • Use versions for your pipelines to make sure the deployed pipeline is the stable one.
Easily manage pipelines

Easily manage pipelines

Spend less time dealing with the logistics of owning multiple data pipelines, and get back to building great AI applications.

  • Easy visualization of the data flow through the pipeline.
  • Identify & troubleshoot issues with clear, node-based error messages.
  • Use scalable AI infrastructure that can grow to support massive amounts of data.