Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

few-shot prompting #16

Open
vrodriguezf opened this issue Nov 2, 2023 · 11 comments
Open

few-shot prompting #16

vrodriguezf opened this issue Nov 2, 2023 · 11 comments
Assignees

Comments

@vrodriguezf
Copy link
Contributor

One common thing in prompt engineering (or crafting) is providing examples of how you want the assistant to respond, prior to the conversation itself. These examples can be:

  • embedded in the system prompt
  • embedded in the first user prompt
  • created as a default sequence of messages between user and assistant that you prepend to the call to the ChatCompletion API.

I don't know which of these methods is better to be honest. One good idea is try them in the OpenAI playground with a human gamplay log side by side, testing if the model answer with the same throttles that the human had replied (remember that we want the agent to replicate human behaviour).

You can format the human gameplays into a observation-action text log to use it as examples:

Image

@OhhTuRnz
Copy link
Collaborator

Great news! I've made a few shot prompting where i translate all the CSV's into actual GPT history content and it responds succesfully (i hope better than other agents)

I'm adding snapshots and a json folder example:

history_pe1_i3_keyboard_agent_actions_20231016-151738.json

image

I don't know if i have to parse the history messages everytime. Token limit is 4096 so I am a bit restricted. I can pop 10 by 10 stacks of fake responses everytime i ask GPT.

Here is the footage where i learnt how to implement this: https://learn.deeplearning.ai/chatgpt-building-system/lesson/6/chaining-prompts

@vrodriguezf
Copy link
Contributor Author

awesome! I see that it replies with countinuos numbers but it has been shown only discrete values (-1.0, 1.0, ...). Can you try processing the throttle vectors from the CSVs nto just one command? (forward, backward, right, left, down, up)

@OhhTuRnz
Copy link
Collaborator

awesome! I see that it replies with countinuos numbers but it has been shown only discrete values (-1.0, 1.0, ...). Can you try processing the throttle vectors from the CSVs nto just one command? (forward, backward, right, left, down, up)

Yes, i only passed history into the first prompt, i didn't know if the agent would remember or not (i don't think so but i remember playing with history in the FastAPI tutorial so i need to keep trying)

Here is the code fragment where you can see that it's only parsed the first time
image

@OhhTuRnz
Copy link
Collaborator

I also process the throttle vectors into the function call that jason did
"function_call": { "name": "perform_action", "arguments": "{\n \"forward_throttle\": 0,\n \"right_throttle\": -1.0,\n \"down_throttle\": 0\n}" }

@vrodriguezf
Copy link
Contributor Author

What's the benefit of using a function call here? Wouldn't a categorical reply with the direction(s) to apply (or replying to do nothing at all) would be equivalent?

@escharf320
Copy link
Contributor

@OhhTuRnz That's incredible to see! Are you getting consistent answers if you pass in the same information multiple times? I've been successful in getting answers that are correct, but I've also had vectors returned that are not correct even if the same data was passed through.

@OhhTuRnz
Copy link
Collaborator

@OhhTuRnz That's incredible to see! Are you getting consistent answers if you pass in the same information multiple times? I've been successful in getting answers that are correct, but I've also had vectors returned that are not correct even if the same data was passed through.

As we have seen in the last meeting, it is consistent with enough data. I've been trying multiple times with the gpt model that accepts 128k tokens and it constantly responds with a valid output (3 integers)

@vrodriguezf
Copy link
Contributor Author

That makes sense according to the last OpenAI keynote

@OhhTuRnz
Copy link
Collaborator

I should add that the input lag is a huge problem because human agent is almost real-time. GPT actually tells u it's getting further and it should not.

@vrodriguezf
Copy link
Contributor Author

Good point...how can we fix that?

@OhhTuRnz
Copy link
Collaborator

Good point...how can we fix that?

I can only think of two alternatives, get some faster model or ask for more than one action

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants