-
Notifications
You must be signed in to change notification settings - Fork 36
Use structured JSON output for local model classification #23
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
base: main
Are you sure you want to change the base?
Changes from all commits
b705e89
18666d6
0a3291f
c0a9dca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,25 +3,9 @@ | |
| import type { ChatMessage, EvaluationPostData } from '../types'; | ||
|
|
||
| // System prompt for local models processing one post at a time | ||
| export const LOCAL_SYSTEM_PROMPT = `You filter posts. Write 10-15 words identifying what the post is about, then state if it matches a filter category. | ||
| export const LOCAL_SYSTEM_PROMPT = `You filter posts. Classify whether a post matches any of the given filter categories. | ||
|
|
||
| Example outputs (NOTE: you may not be filtering on these categories!): | ||
|
|
||
| <example> | ||
| <filter_categories>sports</filter_categories> | ||
| <post>The Lakers won last night against the Bucks!</post> | ||
| Post about NBA basketball game results, which is sports content. Matches sports. | ||
| </example> | ||
|
|
||
| <example> | ||
| <filter_categories>politics</filter_categories> | ||
| <post>I love cooking dinner each night with my husband</post> | ||
| Post about making dinner at home, which is Food/lifestyle content, not politics content. No match. | ||
| </example> | ||
|
|
||
| You will be provided with a post (<post>) and a list of filter categories (<filter_categories>). | ||
| Assess whether the topic of the post relates to any of the topics in the filter categories list. | ||
| Your reasoning must be AT MOST 15 words, and MUST end with a statement of "Matches <topic>" or "No match". | ||
| Respond with JSON: {"reasoning": "<10-15 words about what the post is about>", "match": "<matched category or null>"} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what evals did you perform to validate this achieves similar metrics? What's the F1 score, accuracy, precision, etc...?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the key point - we experimented previously with structured output like this and found that this simple of a prompt actually leads to far worse classification performance, which is why local models now receive approximately the same prompt as API ones. I'd love to be able to use a much shorter prompt if it would actually work as well since it would certainly process much faster. |
||
|
|
||
| Be precise in your judgment; only match posts that clearly and directly relate to the filter categories.`; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this backward compatibility you speak of?