Explore LLMs Easily on Your Laptop with openplayground

Explore LLMs Easily on Your Laptop with openplayground

Source Node: 2064249

Explore LLMs Easily on Your Laptop with openplayground
Image by Editor
 

A large Language Model or LLM is a deep learning language model designed to understand, interpret, and generate human language; it usually consists of millions to billions of neural network parameters and is trained using self-supervising. Examples of famous LLMs include GPT-4, BERT, and LLAMA.

Accessing the LLMs is sometimes tricky as we must adhere to the environmental requirements and specifications, which becomes the gatekeeper to learning LLM. Luckily, we can experiment with various LLMs efficiently on our laptops using a Python package called openplayground

What is openplayground, and how can we get benefit from it? Let’s explore it further.

The Python package openplaygorund explains itself as an LLM playground that can run on your laptop, and they are right. It’s a playground where we can experiment with the model, play around with the parameter, make model comparisons, and trace the log history with a friendly UI. They also use famous LLMs from several entities, such as OpenAI, HuggingFace, and more.

How could we start using the openplaygorund? Let’s start by installing the package.

pip install openplayground

 

Then run the following command on your terminal.

openplayground run

In the terminal, you would acquire the following information.

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

The openplayground is running, and you must visit the local host to use the playground UI.

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

In the UI, you would see three sections; Playground, Compare, and Settings. Let’s go to the Settings tab initially, as we can’t work without providing the necessary information.

When you open Settings, there will be a Providers section we need to choose. For this article example, we would use the one from OpenAI. Click the OpenAI and provide the API Key to have all the models accessible to the openplayground, similar to the image below.

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

Enable the model you want and get back to the Playground tab. When you already have a model selected, there would be additional parameters on the right side we can play around with.

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

The parameter is there for us to easily explore and experiment with the result of the LLMs model. Let’s try a simple prompt: “Create me a short story about the princess and the magical kingdom.”

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

The generated text would is shown in green color. If you enable the Show Probabilities, you could get the token generation probabilities if the model allows it. For example, the ‘text-DaVinci-03’ model can show you the probabilities. Let’s submit the prompt once more and see the result.

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

Hovering down to the token would show how high the probability is for the token to show up. Additionally, there is information on the top 5 tokens as well that can become possible generated text.

Going to the Compare tab, we can compare various LLM model-generated text with the same parameter. Let’s try out with the same prompt as our previous example.

 

Explore LLMs Easily on Your Laptop with openplayground
Image by Author
 

The Compare tab provides information on the two or more different LLMs models that generate the text simultaneously. The information includes the tokens, how fast the model generated the text, how long it took, and how many characters.

Try experimenting with various models from several providers to get more value from using the openplayground.

A large Language Model or LLM is a model capable of understanding, interpreting, and generating human text. With openplayground, we could have a simple UI for exploring and experimenting with several LLMs.
 
 
Cornellius Yudha Wijaya is a data science assistant manager and data writer. While working full-time at Allianz Indonesia, he loves to share Python and Data tips via social media and writing media.
 

Time Stamp:

More from KDnuggets