Statement Normalization Pipeline using OpenAI#24
Open
Conversation
…to 150-inconsistent-statements
Files changed: M raw_statements/email_statements.csv M raw_statements/email_statements_ar.csv M raw_statements/email_statements_bn.csv M raw_statements/email_statements_es.csv M raw_statements/email_statements_fr.csv M raw_statements/email_statements_hi.csv M raw_statements/email_statements_ja.csv M raw_statements/email_statements_pt.csv M raw_statements/email_statements_ru.csv M raw_statements/email_statements_zh.csv M raw_statements/news_statements_amir.csv M raw_statements/news_statements_amir_ar.csv M raw_statements/news_statements_amir_hi.csv M raw_statements/observable_gpt4o_ar.csv
…to 150-inconsistent-statements
Member
|
Great. Can we switch to 4o for everything? (or have you already) |
Translation Cost Calculationcleaned_statements_en.csv still needs to be translated into 9 new languages. This would require translating 12141 characters. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new statement normalization pipeline, cleans the remaining original statements in the raw_statements directory, and introduces minor changes to different files to streamline text extraction (specifically extracting the language code) from filenames. The criteria for normalization is as follows:
The normalization pipeline leverages OpenAI, and the news_statements and observable statements were cleaned using gpt-4o while email_statements (due to the size of the files) files were cleaned with gpt-3.5-turbo. During this process, I noticed several differences in performance between the two models. Specifically, gpt-4o was more consistent in not changing the original capitalization of proper nouns, altering the original vocabulary, and not introducing any additional punctuation; whereas gpt-3.5-turbo would make changes despite being explicitly instructed not to in the system prompt. When merged, this PR will close Watts-Lab/commonsense-platform#150, ensuring consistent rendering of statements on the commonsense platform's UI.
New files
Changes
Testing
I acted as a "human-in-the-loop" to verify OpenAI's outputs. I used an online Diffchecker tool (https://www.diffchecker.com/) to compare changes made from the original file to the new file. I also used OpenAI playground to verify the system prompt.
Important note
To ensure more consistent output from OpenAI, I recommend using gpt-4o or possibly gpt-4o-mini to normalize the statements. In particular, gpt-3.5-turbo would sometimes remove the capitalization of proper nouns, alter some vocabulary and thereby change the nuanced meaning of some statements, and introduce unintended punctuation. I directly address all these in the system prompt; however, it is open to improvement.