Quickstart

Using AI21 Studio, you can solve challenging text understanding and generation tasks. Its straightforward API and interactive playground allows you to get started in minutes, without any prior knowledge in Natural Language Processing (NLP).

Below is a quickstart guide to cover all the basics you need in order to start building your solution. After that, you should feel comfortable using our large language models to start and solve your own use-case.

Some basics

A language model takes some text as input and produces a likely continuation. You can think of it as an exceptional student that can follow instructions and imitate examples.

Here are two words you should know:

  • Prompt - the input you provide to the model.

  • Completion - the output text the model returns.

Experiment with your first use-case

You slept in and missed a crucial phone call? Here's how AI21 Studio can help you out of a bind: let's build an excuse generator.

1. Tell the model what you want to do

The most naive thing to do is simply provide the model a prompt which is a simple instruction. This is what it looks like:

This is called Zero-shot, because we are giving the model zero examples. Occasionally this may work, but you may receive various types of completions. The structure and tone of the completion may differ from your expectation, for example a short excuse when expected something elaborated.

If you want to get the most benefit out of large language models, it is recommended to insert a prompt that includes several examples (similarly to teaching a student).

2. Provide examples

The previous excuse was too generic and could have been used for anything. By providing the model with examples, just as a human would, it could produce completions that are more aligned with your intentions. In order to help the model distinguish between each example, we use a stop sequence. The stop sequence itself should be immediately recognizeable when you look at the text as a whole. In this example, the stop sequence is ##:

This is called Few-shot, because we are inserting a prompt which includes a few examples.

3. Make sure your examples reflect your needs

The previous results were rather serious and not the most original. If you’re looking for some more creative excuses, it should be reflected in your examples:

Surely this will work on even the most skeptical boss.

4. Adjust the parameters

Another way to affect the completion is to adjust some of the model parameters. A useful parameter is the temperature. You can increase creativity by tweaking the temperature. With temperature 0, the model will always choose the most probable completion, so it will always be the same. Increasing the temperature will provide variable completions, where the completion may be different for every generation:

A task that requires accurate results (such as classification) is best performed with low temperature, whereas a task that requires more creativity should be conducted with high temperature (0.7 is a reasonable starting point).

Want to explore the various excuses the model can think of? Try it yourself!

What's next?

We encourage you to play with our models in the AI21 Studio. Take inspiration from other examples in the playground, such as Twitter agent, Ads copywriter, Outline creator and more. Finished playing? Learn more about our completion API.

You have a mission and want the best that Studio has to offer? Optimal results are achieved by training a custom model.

Have any questions? Talk to us.