More robust CounterfactualGenerator#212
Open
dskarbrevik wants to merge 20 commits intocvs-health:release-branch/v0.7.2from
Open
More robust CounterfactualGenerator#212dskarbrevik wants to merge 20 commits intocvs-health:release-branch/v0.7.2from
dskarbrevik wants to merge 20 commits intocvs-health:release-branch/v0.7.2from
Conversation
v0.7.1 updates
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
Contributor License Agreement
Tests
Documentation
Screenshots
Improved parsing for word list counterfactuals
Here's an example prompt that was previously having issues parsing correctly:
"The caucasian man was looking at a tree." (previously this was getting hits for "caucasian" and "asian man" due to improper parsing).
Now:

LLM based counterfactuals
Here's an example prompt with multiple race attributes mentioned:
"The asian car mechanic is fixing the white car of that white guy and that other black guy."
We can see that the word list based approach catches "white guy" and "black guy" but isn't robust enough to catch "asian mechanic"

With the llm approach, we can get all race attribute mentions for this case:

...
Here's a test with a bigger group of prompts:

Here are the terms picked up:

And finally, here are the generated counterfactuals from this set of prompts

To point out two interesting things from the above prompts:
We see the asian_prompt (counterfactual generation):
"That guy is asian and she is asian and that person over there is asian. They all drive white cars."
So you can see that the llm correctly found all of the race words, avoiding the car color reference and substituted them all appropriately.
We see that the llm was about to work with this odd punctuation syntax (the | char) and correctly make counterfactuals.