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

Fix COT explanation to be decoded before the score #7

Merged
merged 2 commits into from
Feb 16, 2025

Conversation

amitness
Copy link
Contributor

@sayakpaul Really cool project. Just wanted to point out one minor issue.

Currently the score is placed before the explanation in the schema for each grader. As such, the LLM will generate the score before the explanation during decoding.

class Score(typing.TypedDict):
    score: float
    explanation: str

What you instead want is the explanation before the score. Cause, we want the model to generate its rationale/chain-of-thought and then arrive at the score during decoding. That helps with better grading.

class Score(typing.TypedDict):
    explanation: str
    score: float

If you generate the score before, the tokens for rationale are simply post-hoc explanation for the score.

Karpathy actually discusses this as well in his latest video here starting at timestamp 1:46:56.

image

Here is another article from someone who did statistical analysis to prove that the order matters, in case you are interested to dig deeper.

Copy link
Owner

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for your contributions!

@sayakpaul sayakpaul merged commit f76bfaa into sayakpaul:main Feb 16, 2025
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.

2 participants