Using OpenAI to generate text content

Astraport

Regular Member
Joined
Jul 9, 2016
Messages
292
Reaction score
42
Like many others, I got access to the API and I want to try generating text on my topics. So far, it turns out badly.

Therefore, I am looking for any materials on creating content using OpenAI - videos, tutorials, articles.

With the technical part, everything is clear to me. I don’t know how to create the most readable text using parameters ("temperature", "max_tokens", "top_p", "frequency_penalty", "presence_penalty") and a combination of methods.
 
First of all, you should check their users' forum. Lots of tutorials and useful stuff there.
Then, you should try to understand how Generative Pretrained Transformers work. This is because they cannot generate relevant text right of the bat, with small prompts.
Give it a larger prompt and ask it to continue. You'll see that the results get better. The more tokens in the prompt, the better will be the generated content (and the higher your costs will be :D )
Try to learn more about few-shot learning and fine-tuning. Especially the latter is very very important for decent results.
Also, keep in mind that OPenAI's GPT-3 is not the only player on the market right now. There are other similar models (two of them have more parameters* than the largest model from OAI - Davinci) and each of them has its pros and cons. All of them are expensive to use. Even the open-sourced ones cost a fortune to run and fine-tune (be it on high-end GPUs or TPUs in some cases). The idea here is to find the perfect balance between:
- your needs in terms of content generation
- the ability of a specific model to satisfy your needs
- the costs of using that specific model

There is no one single tutorial which would cover all of the above areas. And all of the above areas are just a few things to keep in mind when working with any kind of GPT model. You have to research a lot before you obtain some decent results.

*PS: don't get fooled by the number of parameters. There are a lot more variables that make a model suited for a specific task. And a fine-tuned smaller model with a data-set containing a specific task could very well outperform a non-fine-tuned but larger model when working on that specific task.
 
Last edited:
I did it like this:

Prompt:

Code:
Write an essay about 'Insert title here':
"""
Write a good example.
"""
Write an essay about 'Dynamic title here':
"""

Parameters:

Code:
temperature=0.7,
max_tokens=800,
top_p=1,
frequency_penalty=0.3,
presence_penalty=0.8,
stop=["\"\"\""]
 
Specific example.
Here I have a product [product_name] and I have a review for this product [product_review].

How can I create a prompt to get another similar review via OpenAI?
 
Maybe you should consider Jarvis
They recently renewed all plans
Now, starts at 60 bucks
 
Didn't quite understand your example.
What is 'Dynamic title'?
And what should I replace this line with (Write a good example.)?
For example
Name your first example essay "How to land your first job as a software developer"
Then write an "essay" about it, basically just like a blog post or however you want it.
Then where it says "Dynamic title", here you can insert any topic you'd like and OpenAI is going to write the essay for you, usually following the writing style etc. from your example essay.
 
Maybe you should consider Jarvis
They recently renewed all plans
Now, starts at 60 bucks
I have been using them for 4 months and I want a higher level.
They always had limits on boss mode.
 
I have been using them for 4 months and I want a higher level.
They always had limits on boss mode.
Didn't know this . I also use Jarvis and was ok so far for what I need ( content for tier 2 websites). Maybe there are better alternative but I dont know.
 
Do you mean this? https://beta.openai.com/docs/guides/fine-tuning


Who else? The rest (Jarvis, Frase.io) similar to openai's resellers.
Thanks so much.
Yes, for fine-tuning you could start with that. But, by default, Open AI doesn't let you fine-tune a model with more than 80-100 MB of data. If you want to use a larger data set you have to ask them to remove this limit. For a complex task, you would need a larger data set (much larger in some use cases).


Jarvis, Frase etc are just using OpenAI's API. They don't have their own models. They're just resellers and, in most cases, they're using the smaller or the smallest and cheapest models. Hopefully (for their customers) they are fine-tuning these models, although OAI doesn't give you the freedom of fine-tuning a model just like you would have with an open-sourced model.

Alternatives to Open AI GPT models: AI21 (their largest model has 5 billion more parameters than OAI's Davinci), Eleuther AI (open sourced models; ideal for fine-tuning; very expensive to put them into production because you have to rent high-end GPU's and/ or TPU's; preparing GPT NeoX which should be able to compete with OAI's Davinci but I have no idea how could an individual or a small company could be able to put it into production without spending a ton of money) and Megatron-Turing Natural Language Generation (Nvidia + Microsoft's 530 billion parameters model running on nearly 4500 high-end GPUs), although the last one is not available to public and don't know if it will ever be. Even if it will be, I don't want to imagine the cost one would have to pay for using it.
 
Last edited:
I did it like this:

Prompt:

Code:
Write an essay about 'Insert title here':
"""
Write a good example.
"""
Write an essay about 'Dynamic title here':
"""

Parameters:

Code:
temperature=0.7,
max_tokens=800,
top_p=1,
frequency_penalty=0.3,
presence_penalty=0.8,
stop=["\"\"\""]
WOW!!! Although I didn't understand what stop+["\"\"\""] means, doing the rest has made such a difference to the outcome. Thank you.
 
WOW!!! Although I didn't understand what stop+["\"\"\""] means, doing the rest has made such a difference to the outcome. Thank you.
No problem, that stop simply means that it should stop before triple quotes, instead of it starting to write a new essay on some different subject and stopping in the middle when it runs out of tokens.
 
How do I get rid of repeats?
This happens very often and eats up tokens.

I have been using this for a few months now and I love it. I have never had a problem with it.\n\nI have been using this for a few months now and I love it. I have never had a problem with it.\n\nI have been using this for a few months now and I love it. I have never had a problem with it.\n\nI have been using this for a few months now and I love it. I have never had a problem with it.\n\nI have been using this for a few months now and I love it. I have never had a problem with it.
 
Increase presence penalty, that causes it to choose new things to talk about basically. In case it uses different sentences but repeating a lot of the same words then increase frequency penalty.
That is extremely helpful advice, thank you.

Do you by any chance have a link to an article or something that teaches more about this? I've read the OpenAi documentation but it is hard for me to understand a lot of it. They should hire you to write some of their explanations!;)
 
Yes, for fine-tuning you could start with that. But, by default, Open AI doesn't let you fine-tune a model with more than 80-100 MB of data. If you want to use a larger data set you have to ask them to remove this limit. For a complex task, you would need a larger data set (much larger in some use cases).


Jarvis, Frase etc are just using OpenAI's API. They don't have their own models. They're just resellers and, in most cases, they're using the smaller or the smallest and cheapest models. Hopefully (for their customers) they are fine-tuning these models, although OAI doesn't give you the freedom of fine-tuning a model just like you would have with an open-sourced model.

Alternatives to Open AI GPT models: AI21 (their largest model has 5 billion more parameters than OAI's Davinci), Eleuther AI (open sourced models; ideal for fine-tuning; very expensive to put them into production because you have to rent high-end GPU's and/ or TPU's; preparing GPT NeoX which should be able to compete with OAI's Davinci but I have no idea how could an individual or a small company could be able to put it into production without spending a ton of money) and Megatron-Turing Natural Language Generation (Nvidia + Microsoft's 530 billion parameters model running on nearly 4500 high-end GPUs), although the last one is not available to public and don't know if it will ever be. Even if it will be, I don't want to imagine the cost one would have to pay for using it.
Thanks for this. But I am confused, probably since resellers (Jasper etc) did a fantastic marketing job hiding OpenAI away. Have I understood correctly that it is better to use OpenAI playground if you want to produce content/rewrite, instead of turning to these resellers. Are there any benefits to using resellers?
 
Thanks for this. But I am confused, probably since resellers (Jasper etc) did a fantastic marketing job hiding OpenAI away. Have I understood correctly that it is better to use OpenAI playground if you want to produce content/rewrite, instead of turning to these resellers. Are there any benefits to using resellers?
You can use it up to a point where your use-case needs to be approved by OpenAI. This means creating an SaaS app similar to Jasper and get it approved by OpenAI for production.
They offer the playground as a test environment for your future application and one of the requirements for getting your app approved by OpenAI is to NOT give the end-user the possibility of having the same functionality as you have in their playground. Basically, they don't want the public to have access to their AI without strict limits.
 
Thanks for this. But I am confused, probably since resellers (Jasper etc) did a fantastic marketing job hiding OpenAI away. Have I understood correctly that it is better to use OpenAI playground if you want to produce content/rewrite, instead of turning to these resellers. Are there any benefits to using resellers?
The hardest thing in generating content with open.ai is prompting. I think jasper and other ai resellers are doing most of their work with prompts. Also we don't know what they have under the hood, openai gpt-3 is not the only model that's out there, there are cheaper or even free alternatives.. in short I would say you should try both, the resellers and also using the openai playground
 
Back
Top