Granite 8b Qiskit

Generates Qiskit code

The Granite 8b Qiskit model is a powerful tool for generating high-quality quantum computing code. With 8 billion parameters, it's designed to assist both new and experienced Qiskit users in building code or responding to coding-related instructions and questions. But how does it work? This model is an extension of the granite-8b-code-base, fine-tuned using Qiskit code and instruction data. It's trained on a massive dataset of publicly available code, synthetic data, and filtered to exclude older code and personally identifiable information. The result is a model that can generate accurate and non-deprecated Qiskit code quickly and efficiently. But what makes it unique? The Granite 8b Qiskit model is optimized for quantum computing code generation, making it a valuable resource for developers and researchers in the field. However, it's essential to use this model responsibly and with caution, as it may produce problematic outputs or exhibit susceptibility to hallucination in certain scenarios.

Qiskit apache-2.0 Updated 4 months ago

Table of Contents

Model Overview

Meet the granite-8b-qiskit model, a powerful tool for generating high-quality quantum computing code using Qiskit. This model is designed to assist both quantum computing practitioners and new Qiskit users in building Qiskit code or responding to Qiskit coding-related instructions and questions.

Capabilities

The granite-8b-qiskit model excels at generating quantum computing code using Qiskit, assisting with building Qiskit code, and responding to Qiskit-related questions and instructions. With its advanced architecture and massive parameter count (8B parameters), this model can process and generate code at an impressive speed.

Primary Tasks

  • Generating quantum computing code using Qiskit
  • Assisting with building Qiskit code
  • Responding to Qiskit-related questions and instructions

Strengths

This model has several strengths that set it apart from other AI models:

  • Improved capabilities: The granite-8b-qiskit model is fine-tuned on top of a massive dataset of Qiskit code and instruction data to improve its capabilities.
  • High-quality code generation: The model is designed to generate high-quality, non-deprecated Qiskit code.
  • Versatility: The model can be used by both quantum computing professionals and new Qiskit users.

Performance

So, how does granite-8b-qiskit perform in terms of speed, accuracy, and efficiency? Let’s take a closer look.

Speed

granite-8b-qiskit is trained on a massive dataset of Qiskit code and instruction data, which enables it to generate code at an incredible pace. But what does that mean in practice? For example, can it generate a random circuit with 5 qubits in a matter of seconds? The answer is yes!

Accuracy

Accuracy is crucial when it comes to generating code. A single mistake can lead to errors and bugs that can be difficult to track down. granite-8b-qiskit has been fine-tuned to improve its accuracy in generating high-quality Qiskit code.

Efficiency

Efficiency is another key aspect of granite-8b-qiskit’s performance. The model is designed to be efficient in terms of computational resources, making it accessible to a wide range of users.

Limitations

While granite-8b-qiskit is a powerful tool, it’s not perfect. Let’s take a closer look at some of its limitations.

Lack of Safety Alignment

Unlike some other models, granite-8b-qiskit hasn’t undergone safety alignment training. This means it may produce problematic outputs, especially in critical situations.

Hallucination Risk

Smaller models like granite-8b-qiskit might be more susceptible to hallucination in generation scenarios.

Malicious Utilization

Like all Large Language Models, granite-8b-qiskit can be used for malicious purposes.

Examples
Create a quantum circuit with 3 qubits, apply Hadamard gate to the first qubit, and measure all qubits. from qiskit import QuantumCircuit qc = QuantumCircuit(3) qc.h(0) qc.measure([0, 1, 2], [0, 1, 2])
Generate a Qiskit code snippet to apply a Pauli X gate to the second qubit of a 4-qubit quantum register. from qiskit import QuantumCircuit qr = QuantumCircuit(4) qr.x(1)
Write a Qiskit function to create a quantum circuit that adds two qubits. from qiskit import QuantumCircuit def add_qubits(): qc = QuantumCircuit(2) qc.cx(0, 1) return qc

Example Use Case

Here’s an example of how to use granite-8b-qiskit to generate Qiskit code:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

# Load the pre-trained model and tokenizer
model_path = "qiskit/granite-8b-qiskit"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForCausalLM.from_pretrained(model_path)

# Define the input text
input_text = "Build a random circuit with 5 qubits"

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

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

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

# Print the output
print(output)

This example demonstrates how to use granite-8b-qiskit to generate Qiskit code based on user input. Simply change the input text to your desired prompt, and the model will generate the corresponding code.

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.