openai-cookbook icon indicating copy to clipboard operation
openai-cookbook copied to clipboard

Repeating Instruction Examples

Open atnikos opened this issue 2 years ago • 5 comments
trafficstars

Is there a way if I want to query a model for a similar question + set of instruction to avoid passing the instruction every time? eg.

prompt = ['which categories does this <thing> fall in from the list below?\n - fruit \n -vegetable \n etc.']
response = openai.Completion.create(model="text-davinci-003",
                                            prompt=prompt,
                                            temperature=0.0,
                                            max_tokens=256,
                                            top_p=1,
                                            frequency_penalty=0,
                                            presence_penalty=0
                                            )

I want to ask this question for a lot of different <things>, and avoid being billed every time for the same words & instructions.

atnikos avatar Feb 07 '23 00:02 atnikos

Unfortunately not.

One option is to train a fine-tuned model to do that task, which won't need instructions.

ted-at-openai avatar Feb 07 '23 17:02 ted-at-openai

no, unfortunately not, although chatbots dream about this feature repeat_prompt

this works so well in the ChatGPT frontend ("do the same"), so: any hints as to how one could "train a fine-tuned model to repeat the task without having to clutter the prompt with its repetition"?

gnmarten avatar Feb 17 '23 14:02 gnmarten

@ted-at-openai on the pricing area it says fine-tuned models are even more expensive for usage ( which would not reduce the cost ).

Once you fine-tune a model, you’ll be billed only for the tokens you use. Requests sent to fine-tuned models are billed at our [usage rates](https://openai.com/api/pricing/#quotas).

@athn-nik, you want to categorize (classify) < things >, and what you are looking for is a way to avoid open.generate each repetitive < thing >, or do I understand it wrong?

Try applying a vector dictionary alongside OpenAI embeddings ( Diversity measurement or classification between < thing > and <already_generated_things> are good examples, in the embeddings link, there is an example of a vectors database using Redis, which might do the trick without any OpenAI resource included )

Disclaimer: If is dynamically classified ( it can be a fruit today and a vegetable tomorrow ), you might need to generate each time, or in time frames within a dictionary.

MuraraAllan avatar Feb 21 '23 08:02 MuraraAllan

Fine-tuned models are more expensive per token. If they allow you to use fewer tokens, they can be less expensive. It depends.

ted-at-openai avatar Feb 21 '23 17:02 ted-at-openai

@MuraraAllan I want to do the same "task" for lots of samples, aka ask the same question, give the same instruction and examples and "label" a different text. Eg: Determine if this pose contains the knees. Yoga pose: yes kneel pose: yes Waving pose: [....] Similar to this task for many different [....]

atnikos avatar Mar 09 '23 23:03 atnikos