NexaAI / Octopus-v2

huggingface.co
Total runs: 556
24-hour runs: 0
7-day runs: -1
30-day runs: -1
Model's Last Updated: May 21 2024
text-generation

Introduction of Octopus-v2

Model Details of Octopus-v2

Octopus V2: On-device language model for super agent

Octopus V4 Release

We are excited to announce that Octopus v4 is now available! Octopus-V4-3B, an advanced open-source language model with 3 billion parameters, serves as the master node in Nexa AI's envisioned graph of language models. Tailored specifically for the MMLU benchmark topics, this model efficiently translates user queries into formats that specialized models can effectively process. It excels at directing these queries to the appropriate specialized model, ensuring precise and effective query handling. check our papers and repos:

Key Features of Octopus v4:

  • 📱 Compact Size : Octopus-V4-3B is compact, enabling it to operate on smart devices efficiently and swiftly.
  • 🐙 Accuracy : Octopus-V4-3B accurately maps user queries to the specialized model using a functional token design, enhancing its precision.
  • 💪 Reformat Query : Octopus-V4-3B assists in converting natural human language into a more professional format, improving query description and resulting in more accurate responses.
Octopus V3 Release

We are excited to announce that Octopus v3 is now available! check our technical report and Octopus V3 tweet !

Key Features of Octopus v3:

  • Efficiency : Sub-billion parameters, making it less than half the size of its predecessor, Octopus v2.
  • Multi-Modal Capabilities : Proceed both text and images inputs.
  • Speed and Accuracy : Incorporate our patented functional token technology, achieving function calling accuracy on par with GPT-4V and GPT-4.
  • Multilingual Support : Simultaneous support for English and Mandarin.

Check the Octopus V3 demo video for Android and iOS .

Octopus V2 Release

After open-sourcing our model, we got many requests to compare our model with Apple's OpenELM and Microsoft's Phi-3 . Please see Evaluation section . From our benchmark dataset, Microsoft's Phi-3 achieves accuracy of 45.7% and the average inference latency is 10.2s. While Apple's OpenELM fails to generate function call, please see this screenshot . Our model, Octopus V2, achieves 99.5% accuracy and the average inference latency is 0.38s.

We are a very small team with many work. Please give us more time to prepare the code, and we will open source it. We hope Octopus v2 model will be helpful for you. Let's democratize AI agents for everyone. We've received many requests from car industry, health care, financial system etc. Octopus model is able to be applied to any function , and you can start to think about it now.

- Nexa AI Product - ArXiv - Video Demo

nexa-octopus

Introduction

Octopus-V2-2B, an advanced open-source language model with 2 billion parameters, represents Nexa AI's research breakthrough in the application of large language models (LLMs) for function calling, specifically tailored for Android APIs. Unlike Retrieval-Augmented Generation (RAG) methods, which require detailed descriptions of potential function arguments—sometimes needing up to tens of thousands of input tokens—Octopus-V2-2B introduces a unique functional token strategy for both its training and inference stages. This approach not only allows it to achieve performance levels comparable to GPT-4 but also significantly enhances its inference speed beyond that of RAG-based methods, making it especially beneficial for edge computing devices.

📱 On-device Applications : Octopus-V2-2B is engineered to operate seamlessly on Android devices, extending its utility across a wide range of applications, from Android system management to the orchestration of multiple devices.

🚀 Inference Speed : When benchmarked, Octopus-V2-2B demonstrates a remarkable inference speed, outperforming the combination of "Llama7B + RAG solution" by a factor of 36X on a single A100 GPU. Furthermore, compared to GPT-4-turbo (gpt-4-0125-preview), which relies on clusters A100/H100 GPUs, Octopus-V2-2B is 168% faster. This efficiency is attributed to our functional token design.

🐙 Accuracy : Octopus-V2-2B not only excels in speed but also in accuracy, surpassing the "Llama7B + RAG solution" in function call accuracy by 31%. It achieves a function call accuracy comparable to GPT-4 and RAG + GPT-3.5, with scores ranging between 98% and 100% across benchmark datasets.

💪 Function Calling Capabilities : Octopus-V2-2B is capable of generating individual, nested, and parallel function calls across a variety of complex scenarios.

Example Use Cases

ondevice

You can run the model on a GPU using the following code.

from transformers import AutoTokenizer, GemmaForCausalLM
import torch
import time

def inference(input_text):
    start_time = time.time()
    input_ids = tokenizer(input_text, return_tensors="pt").to(model.device)
    input_length = input_ids["input_ids"].shape[1]
    outputs = model.generate(
        input_ids=input_ids["input_ids"], 
        max_length=1024,
        do_sample=False)
    generated_sequence = outputs[:, input_length:].tolist()
    res = tokenizer.decode(generated_sequence[0])
    end_time = time.time()
    return {"output": res, "latency": end_time - start_time}

model_id = "NexaAIDev/Octopus-v2"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = GemmaForCausalLM.from_pretrained(
    model_id, torch_dtype=torch.bfloat16, device_map="auto"
)

input_text = "Take a selfie for me with front camera"
nexa_query = f"Below is the query from the users, please call the correct function and generate the parameters to call the function.\n\nQuery: {input_text} \n\nResponse:"
start_time = time.time()
print("nexa model result:\n", inference(nexa_query))
print("latency:", time.time() - start_time," s")
Evaluation

The benchmark result can be viewed in this excel , which has been manually verified. Microsoft's Phi-3 model achieved an accuracy of 45.7%, with an average inference latency of 10.2 seconds. Meanwhile, Apple's OpenELM was unable to generate a function call, as shown in this screenshot . Additionally, OpenELM's score on the MMLU benchmark is quite low at 26.7, compared to Google's Gemma 2B, which scored 42.3.

ondevice ondevice

Note : One can notice that the query includes all necessary parameters used for a function. It is expected that query includes all parameters during inference as well.

Training Data

We wrote 20 Android API descriptions to used to train the models, see this file for details. The Android API implementations for our demos, and our training data will be published later. Below is one Android API description example

def get_trending_news(category=None, region='US', language='en', max_results=5):
    """
    Fetches trending news articles based on category, region, and language.

    Parameters:
    - category (str, optional): News category to filter by, by default use None for all categories. Optional to provide.
    - region (str, optional): ISO 3166-1 alpha-2 country code for region-specific news, by default, uses 'US'. Optional to provide.
    - language (str, optional): ISO 639-1 language code for article language, by default uses 'en'. Optional to provide.
    - max_results (int, optional): Maximum number of articles to return, by default, uses 5. Optional to provide.

    Returns:
    - list[str]: A list of strings, each representing an article. Each string contains the article's heading and URL.
    """
License

This model was trained on commercially viable data. For use of our model, refer to the license information .

References

We thank the Google Gemma team for their amazing models!

@misc{gemma-2023-open-models,
  author = {{Gemma Team, Google DeepMind}},
  title = {Gemma: Open Models Based on Gemini Research and Technology},
  url = {https://goo.gle/GemmaReport},  
  year = {2023},
}
Citation
@misc{chen2024octopus,
      title={Octopus v2: On-device language model for super agent}, 
      author={Wei Chen and Zhiyuan Li},
      year={2024},
      eprint={2404.01744},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}
Contact

Please contact us to reach out for any issues and comments!

Runs of NexaAI Octopus-v2 on huggingface.co

556
Total runs
0
24-hour runs
3
3-day runs
-1
7-day runs
-1
30-day runs

More Information About Octopus-v2 huggingface.co Model

More Octopus-v2 license Visit here:

https://choosealicense.com/licenses/cc-by-nc-4.0

Octopus-v2 huggingface.co

Octopus-v2 huggingface.co is an AI model on huggingface.co that provides Octopus-v2's model effect (), which can be used instantly with this NexaAI Octopus-v2 model. huggingface.co supports a free trial of the Octopus-v2 model, and also provides paid use of the Octopus-v2. Support call Octopus-v2 model through api, including Node.js, Python, http.

Octopus-v2 huggingface.co Url

https://huggingface.co/NexaAI/Octopus-v2

NexaAI Octopus-v2 online free

Octopus-v2 huggingface.co is an online trial and call api platform, which integrates Octopus-v2's modeling effects, including api services, and provides a free online trial of Octopus-v2, you can try Octopus-v2 online for free by clicking the link below.

NexaAI Octopus-v2 online free url in huggingface.co:

https://huggingface.co/NexaAI/Octopus-v2

Octopus-v2 install

Octopus-v2 is an open source model from GitHub that offers a free installation service, and any user can find Octopus-v2 on GitHub to install. At the same time, huggingface.co provides the effect of Octopus-v2 install, users can directly use Octopus-v2 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

Octopus-v2 install url in huggingface.co:

https://huggingface.co/NexaAI/Octopus-v2

Url of Octopus-v2

Octopus-v2 huggingface.co Url

Provider of Octopus-v2 huggingface.co

NexaAI
ORGANIZATIONS

Other API from NexaAI

huggingface.co

Total runs: 1.3K
Run Growth: -484
Growth Rate: -38.05%
Updated:August 09 2025
huggingface.co

Total runs: 793
Run Growth: -109
Growth Rate: -13.75%
Updated:August 21 2025
huggingface.co

Total runs: 634
Run Growth: -567
Growth Rate: -89.43%
Updated:November 14 2025
huggingface.co

Total runs: 486
Run Growth: 0
Growth Rate: 0.00%
Updated:July 22 2025
huggingface.co

Total runs: 258
Run Growth: -17
Growth Rate: -6.59%
Updated:September 28 2025
huggingface.co

Total runs: 155
Run Growth: 17
Growth Rate: 10.97%
Updated:November 07 2025
huggingface.co

Total runs: 74
Run Growth: 4
Growth Rate: 5.41%
Updated:July 22 2025
huggingface.co

Total runs: 58
Run Growth: 40
Growth Rate: 68.97%
Updated:December 03 2025
huggingface.co

Total runs: 56
Run Growth: 31
Growth Rate: 55.36%
Updated:November 07 2025
huggingface.co

Total runs: 54
Run Growth: -1
Growth Rate: -1.85%
Updated:May 05 2024
huggingface.co

Total runs: 52
Run Growth: 4
Growth Rate: 7.69%
Updated:January 10 2026
huggingface.co

Total runs: 37
Run Growth: 25
Growth Rate: 67.57%
Updated:January 13 2026
huggingface.co

Total runs: 16
Run Growth: -2
Growth Rate: -12.50%
Updated:September 04 2024
huggingface.co

Total runs: 14
Run Growth: 10
Growth Rate: 71.43%
Updated:October 28 2025
huggingface.co

Total runs: 10
Run Growth: 2
Growth Rate: 20.00%
Updated:January 13 2026
huggingface.co

Total runs: 9
Run Growth: -5
Growth Rate: -55.56%
Updated:December 17 2025
huggingface.co

Total runs: 5
Run Growth: 0
Growth Rate: 0.00%
Updated:December 16 2025