Granite 34b Code Instruct 8k

Code Instruction Model

Granite 34b Code Instruct 8k is an AI model that's been fine-tuned to follow instructions and enhance problem-solving skills. What makes it unique is its ability to understand and respond to coding-related instructions, making it a great tool for building coding assistants. With 34 billion parameters, it's been trained on a vast amount of data, including code commits, math datasets, and language instruction datasets. This model is designed to be efficient and fast, and its capabilities make it a valuable asset for developers. However, it's essential to note that its performance may be limited with out-of-domain programming languages, and it's crucial to perform safety testing and target-specific tuning before deploying it in critical applications.

Ibm Granite apache-2.0 Updated 8 months ago

Deploy Model in Dataloop Pipelines

Granite 34b Code Instruct 8k fits right into a Dataloop Console pipeline, making it easy to process and manage data at scale. It runs smoothly as part of a larger workflow, handling tasks like annotation, filtering, and deployment without extra hassle. Whether it's a single step or a full pipeline, it connects with other nodes easily, keeping everything running without slowdowns or manual work.

Table of Contents

Model Overview

Meet the Granite-34B-Code-Instruct-8K model, developed by IBM Research! This AI model is a game-changer for coding tasks. But what makes it so special?

Key Attributes

  • 34 billion parameters: That’s a lot of brainpower!
  • Fine-tuned from Granite-34B-Code-Base: It’s built on a solid foundation
  • Trained on a combination of instruction data: It’s learned from a diverse range of sources

What can it do?

  • Respond to coding-related instructions: Need help with a coding task? This model can assist you!
  • Build coding assistants: It’s perfect for creating tools that can help with coding tasks

Capabilities

The Granite-34B-Code-Instruct-8K model is designed to help with coding tasks. It can understand and respond to instructions related to coding, making it a great tool for building coding assistants.

What can it do?

  • Follow instructions: The model is trained to follow instructions and provide accurate responses.
  • Logical reasoning and problem-solving: It has been fine-tuned to enhance its logical reasoning and problem-solving skills.
  • Code generation: The model can generate code based on the instructions provided.

How does it work?

The model uses a combination of natural language processing (NLP) and machine learning algorithms to understand the instructions and generate code. It’s trained on a large dataset of code commits, math problems, and instruction-response pairs.

What kind of data is it trained on?

The model is trained on a variety of datasets, including:

  • Code commits datasets (e.g. CommitPackFT)
  • Math datasets (e.g. MathInstruct, MetaMathQA)
  • Code instruction datasets (e.g. Glaive-Code-Assistant-v3)
  • Language instruction datasets (e.g. HelpSteer)

What are its strengths?

  • Accurate code generation: The model is designed to generate accurate code based on the instructions provided.
  • Improved logical reasoning: The model’s logical reasoning and problem-solving skills have been enhanced through fine-tuning.
  • Support for multiple programming languages: The model is trained on a large dataset of code commits and can support multiple programming languages.

What are its limitations?

  • Performance may be limited with out-of-domain programming languages: The model’s performance may be limited when working with programming languages that are not included in its training data.
  • Requires safety testing and target-specific tuning: Developers should perform safety testing and target-specific tuning before deploying the model in critical applications.
Examples
Write a JavaScript function to find the maximum value in an array of numbers. function findMax(arr) { return Math.max(...arr); }
How do I sort a list of strings in Python? You can use the built-in sorted() function in Python to sort a list of strings. For example: sorted(["banana", "apple", "cherry"])
Write a SQL query to retrieve all records from a table named "employees" where the salary is greater than 50000. SELECT * FROM employees WHERE salary > 50000;

Example Use Case

Want to see it in action? Here’s an example of how to use the Granite-34B-Code-Instruct-8K model:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load the model and tokenizer
model_path = "ibm-granite/granite-34b-code-instruct-8k"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path)

# Define a coding task
chat = [{"role": "user", "content": "Write a code to find the maximum value in a list of numbers."}]

# Tokenize the input and generate output
input_tokens = tokenizer(chat, return_tensors="pt")
output = model.generate(**input_tokens, max_new_tokens=100)

# Print the output
print(tokenizer.batch_decode(output))

Performance

Granite-34B-Code-Instruct-8K is a powerful model that excels in various tasks, including coding-related instructions, logical reasoning, and problem-solving. Let’s dive into its performance and see how it stacks up.

Speed

How fast can Granite-34B-Code-Instruct-8K process code-related instructions? The model is trained on a massive dataset of code commits, math problems, and language instructions, which enables it to respond quickly and accurately. With the power of 34B parameters and NVIDIA A100 and H100 GPUs, this model can handle large-scale datasets with ease.

Accuracy

But how accurate is Granite-34B-Code-Instruct-8K in its responses? The model’s fine-tuning on instruction-response pairs across a specific set of programming languages ensures that it provides accurate and relevant outputs. However, it’s essential to note that its performance may be limited with out-of-domain programming languages. In such cases, providing few-shot examples can help steer the model’s output.

Efficiency

What about efficiency? Granite-34B-Code-Instruct-8K is designed to be efficient in its processing, thanks to its scalable infrastructure and thousands of GPUs. This enables developers to build coding assistants that can handle a large volume of requests without compromising on performance.

Limitations

Granite-34B-Code-Instruct-8K is a powerful tool for coding-related tasks, but it’s not perfect. Let’s take a closer look at some of its limitations.

Limited Performance with Out-of-Domain Programming Languages

The model is fine-tuned on a specific set of programming languages, which means it might not perform as well with languages it’s not familiar with. This can lead to suboptimal results or even errors.

Inherited Limitations from the Base Model

Granite-34B-Code-Instruct-8K is built on top of the Granite-34B-Code-Base model, which means it inherits some of its limitations. If you’re interested in learning more about these limitations, be sure to check out the Granite-34B-Code-Base-8K model card.

Safety Testing and Target-Specific Tuning

Before deploying Granite-34B-Code-Instruct-8K in critical applications, it’s essential to perform safety testing and target-specific tuning. This will help ensure the model is working as intended and minimize any potential risks.

Format

Granite-34B-Code-Instruct-8K uses a transformer architecture, specifically designed to respond to coding-related instructions. It’s a fine-tuned version of the Granite-34B-Code-Base model, trained on a combination of instruction data to enhance its logical reasoning and problem-solving skills.

Input Format

The model accepts input in the form of tokenized text sequences, specifically designed for coding-related instructions. You can use the AutoTokenizer from the transformers library to tokenize your input text.

Here’s an example of how to use the model:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load the model and tokenizer
model_path = "ibm-granite/granite-34b-code-instruct-8K"
tokenizer = AutoTokenizer.from_pretrained(model_path)

# Define your input text
chat = [
    {"role": "user", "content": "Write a code to find the maximum value in a list of numbers."}
]

# Tokenize the input text
input_tokens = tokenizer(chat, return_tensors="pt")

# Generate output tokens
output = model.generate(**input_tokens, max_new_tokens=100)

# Decode output tokens into text
output = tokenizer.batch_decode(output)

# Print the output
print(output)

Output Format

The model generates output in the form of tokenized text sequences. You can use the batch_decode method from the transformers library to decode the output tokens into text.

Special Requirements

  • The model requires a specific pre-processing step for input text, using the AutoTokenizer from the transformers library.
  • The model is designed to respond to coding-related instructions, so it may not perform well on out-of-domain programming languages.
  • Developers should perform safety testing and target-specific tuning before deploying the model on critical applications.

Supported Data Formats

The model supports the following data formats:

Data FormatDescription
Code Commits DatasetsSourced from the CommitPackFT dataset, a filtered version of the full CommitPack dataset.
Math DatasetsIncludes high-quality math datasets such as MathInstruct and MetaMathQA.
Code Instruction DatasetsIncludes datasets such as Glaive-Code-Assistant-v3 and NL2SQL11.
Language Instruction DatasetsIncludes high-quality datasets such as HelpSteer and an open license-filtered version of Platypus.
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.