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

Improving Transform and Rerank Module #396

Merged
merged 47 commits into from
Apr 19, 2024
Merged

Improving Transform and Rerank Module #396

merged 47 commits into from
Apr 19, 2024

Conversation

ritugala
Copy link
Collaborator

@ritugala ritugala commented Apr 2, 2024

Description

Major Changes:

  1. Added support for using multiple datasets during transformation - this is helpful if a single dataset is too small by itself, or there are too many failing transforms from it. Have changed
  2. Changed rerank module to first select dataset and then config. Also to use dataset tags
  3. Use Minimum Bayes Risk Decoding (i.e. majority vote) while choosing dataset and config
  4. Added task expansion module to better capture requirements of our task
  5. Added support for parsing responses from openAI which had Chain of Thought followed by json (search for the rightmost json) - useful in code tasks which may have JSON in the COT also

Minor Changes/Fixes:

  1. Removed dataset_index,json and reranking_dataset_index.json file from examples - this seems to have been mistakenly commited
  2. Moved make_dataset_from_samples from prompt_based.py -> description_dataset_retriever.py
  3. Moved most transform related variables (eg num_votes, max_failed_transforms etc) to be attributes of the DescriptionDatasetRetriever class so that we don't need to pass them around in functions
  4. Added exponential backoff / parsing error message from OpenAI to see how long to sleep
  5. Loggers would give duplicate messages sometimes, fixed that
  6. Updated reranking_dataset_index_tiny.json (used in tests) for using tags
  7. Updated tests in tests/dataset_retriever_test.py

Testing

Tested with dummy example + pytest

References

  1. I've currently commented out dataset_transformer tests, want to make sure that you guys are happy with the current format before I add tests for it.
  2. We should probably add CLI support for all the arguments (and set default values for most ofcourse)

@ritugala ritugala changed the title Improving Transform and Execution Module Improving Transform and Rerank Module Apr 2, 2024
@ritugala ritugala requested a review from viswavi April 3, 2024 00:40
@ritugala ritugala requested a review from neubig April 5, 2024 14:01
Copy link
Collaborator

@saum7800 saum7800 left a comment

Choose a reason for hiding this comment

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

PR looks good! all important changes. Have left some comments. most minor, some might require little bit of work. Thanks!

prompt2model/dataset_transformer/prompt_based.py Outdated Show resolved Hide resolved
prompt2model/dataset_transformer/prompt_based.py Outdated Show resolved Hide resolved
prompt2model/utils/api_tools.py Outdated Show resolved Hide resolved
prompt2model/utils/api_tools.py Outdated Show resolved Hide resolved
@neubig
Copy link
Collaborator

neubig commented Apr 11, 2024

Hi, I'm going to trust @saum7800 and @viswavi to take a look at this. It looks exciting, but it's a bit too voluminous for me to take a careful look now.

@neubig neubig removed their request for review April 11, 2024 14:14
@ritugala ritugala force-pushed the ritu-temporary-changes branch from 45704de to 775da63 Compare April 11, 2024 18:17
Copy link
Collaborator

@viswavi viswavi left a comment

Choose a reason for hiding this comment

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

Reviewed some of this PR - more to come tomorrow

if dataset_name is None:
return None, None

time.sleep(10) # To avoid rate limiting
Copy link
Collaborator

Choose a reason for hiding this comment

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

I also don't love this - it makes a very specific hardcoded assumption about the rate limit. What if we instead use an on-premise LLM like Llama2 with no rate limit, or we use a version of GPT with a very high rate limit? Then this will probably no longer be required

@viswavi viswavi self-requested a review April 16, 2024 17:15
Copy link
Collaborator

@viswavi viswavi left a comment

Choose a reason for hiding this comment

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

On a high-level, these changes look good. I've requested a bunch of small (but important) changes, mostly on minor implementation details, documentation, or code quality things

tests/dataset_transformer_test.py Outdated Show resolved Hide resolved
prompt2model/dataset_retriever/reranking_prompt.py Outdated Show resolved Hide resolved
prompt2model/dataset_transformer/prompt_based.py Outdated Show resolved Hide resolved
prompt2model/dataset_transformer/prompt_based.py Outdated Show resolved Hide resolved
@ritugala ritugala marked this pull request as ready for review April 18, 2024 17:14
ritugala and others added 5 commits April 18, 2024 13:41
Co-authored-by: Vijay Viswanathan <vijayv@andrew.cmu.edu>
Co-authored-by: Vijay Viswanathan <vijayv@andrew.cmu.edu>
Co-authored-by: Vijay Viswanathan <vijayv@andrew.cmu.edu>
Co-authored-by: Vijay Viswanathan <vijayv@andrew.cmu.edu>
@ritugala ritugala requested review from viswavi and saum7800 April 18, 2024 19:17
Copy link
Collaborator

@viswavi viswavi left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Collaborator

@saum7800 saum7800 left a comment

Choose a reason for hiding this comment

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

Looks good to me too! Great job!

@ritugala ritugala merged commit 6709095 into main Apr 19, 2024
8 checks passed
@ritugala ritugala deleted the ritu-temporary-changes branch April 19, 2024 17:03
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.

4 participants