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

Composable scaffolding for CoT #75

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Composable scaffolding for CoT #75

wants to merge 10 commits into from

Conversation

dhruviyer
Copy link
Collaborator

@dhruviyer dhruviyer commented Jan 10, 2025

Hello all,

As part of building toward #50 I wanted to lay some ground work for working with CoT prompts and completions. As a start I implemented this for sem_filter and want to get some comments/feedback on the design before rolling it out to other operators.

At a high level, I am proposing a few changes:

  1. We use XML to cleanly separate reasoning sections and answer sections on the model outputs, which I hope will make generation and parsing more reliable and also can be reused across all the various semantic operators.

Hence, the PR revamps the way the model prompt to require the model to fill out this template:

<Reasoning> Provide your reasoning here. {customer reasoning instructions} </Reasoning> <Answer> Provide your answer here. {custom answer instructions} </Answer>

Correspondingly, it also formats the CoT examples in this same template when provided by the user

  1. The PR also simplifies the logic around (1) prompting the model to do CoT and (2) providing examples of CoT. The following configurations are now implicitly handled in the single filter_formatter() function:
  • No CoT prompting, no examples
  • CoT prompting, no CoT examples
  • CoT prompting, CoT examples
  • No CoT prompting, CoT examples

As mentioned, mostly want to get feedback from the authors if this approach makes sense

@dhruviyer dhruviyer linked an issue Jan 10, 2025 that may be closed by this pull request
@dhruviyer dhruviyer marked this pull request as ready for review January 11, 2025 02:06
@dhruviyer
Copy link
Collaborator Author

dhruviyer commented Jan 14, 2025

@liana313 after our discussion I removed the formatting of CoT using XML. This PR now introduces a standardized way of creating CoT prompts and parsing CoT responses. Following PRs will expand support to other semantic operators and implement retries (whichever PR solves #43)

@dhruviyer dhruviyer assigned liana313 and unassigned liana313 Jan 15, 2025
@dhruviyer dhruviyer requested a review from liana313 January 15, 2025 01:39
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

Successfully merging this pull request may close these issues.

Better CoT / Prompting Strategy Support
2 participants