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

Package hallucination #950

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

arjun-krishna1
Copy link
Contributor

  • Use new dataset with "date first seen" for python pypi package hallucination
  • Add scripts used to create Python, JavaScript and Ruby huggingface datasets in tools/packagehallucination

Verification

List the steps needed to make sure this thing works

  • python -m garak -m openai -n gpt-3.5-turbo -p packagehallucination.Python --parallel_requests 16 -g 3 -> runs python hallucination test and result is sane
(garak_env) arjun@arjun-ThinkPad-L14-Gen-3:~/garak$ python -m garak -m openai -n gpt-3.5-turbo -p packagehallucination.Python --parallel_requests 16 -g 3
garak LLM vulnerability scanner v0.9.0.16.post1 ( https://github.com/leondz/garak ) at 2024-10-12T14:19:17.439482
📜 logging to /home/arjun/.local/share/garak/garak.log
🦜 loading generator: OpenAI: gpt-3.5-turbo
📜 reporting to /home/arjun/.local/share/garak/garak_runs/garak.06e1956f-feed-449d-a0dc-63e5fc12414c.report.jsonl
🕵️  queue of probes: packagehallucination.Python
Downloading readme: 100%|█████████████████████████████████████████████████████████████████████████████████████████| 31.0/31.0 [00:00<00:00, 263kB/s]
Downloading data: 100%|████████████████████████████████████████████████████████████████████████████████████████| 19.3M/19.3M [00:16<00:00, 1.19MB/s]
Downloading data: 100%|█████████████████████████████████/home/arjun/garak/garak_env/lib/python3.12/site-packages/datasets/download/streaming_download_manager.py:778: FutureWarning: The 'verbose' keyword in pd.read_csv is deprecated and will be removed in a future version.
  return pd.read_csv(xopen(filepath_or_buffer, "rb", download_config=download_config), **kwargs)
Generating train split: 548891 examples [00:00, 1245837.61 examples/s]
packagehallucination.Python                                          packagehallucination.PythonPypi: FAIL  ok on  263/ 273   (failure rate:   3.66%)
📜 report closed :) /home/arjun/.local/share/garak/garak_runs/garak.06e1956f-feed-449d-a0dc-63e5fc12414c.report.jsonl
📜 report html summary being written to /home/arjun/.local/share/garak/garak_runs/garak.06e1956f-feed-449d-a0dc-63e5fc12414c.report.html
✔️  garak run complete in 187.62s
  • Run the tests and ensure they pass python -m pytest tests/

tools/packagehallucination/python/main.py Outdated Show resolved Hide resolved
tools/packagehallucination/ruby/main.py Outdated Show resolved Hide resolved
tools/packagehallucination/ruby/main.py Outdated Show resolved Hide resolved
tools/packagehallucination/ruby/main.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@jmartin-tech jmartin-tech left a comment

Choose a reason for hiding this comment

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

This PR does not yet enable the probe to consume the timestamp.

Another item to ensure, is all date columns should be formatted into a date time value with timezone details. A format string example can be found in the _plugin package:
https://github.com/leondz/garak/blob/bd0bb3f468c6c05a5675aca9c1e4093b35970018/garak/_plugins.py#L22

This is important to ensure results are consistent globally when run on systems in with clock set to varying timezones.

@leondz
Copy link
Collaborator

leondz commented Oct 17, 2024

NB datestamp is to be consumed by detector

@arjun-krishna1
Copy link
Contributor Author

Ok, thank you @leondz @jmartin-tech . I've just finished my final midterm. I am working on these changes right now.

  • Do tsv instead of csv
  • remove cutoff in ruby dataset
  • remove hardcoded personal path in ruby script
  • make sure all date columns are formatted into a date time value with dimezone details

@arjun-krishna1 arjun-krishna1 changed the title Add "date first seen" column to python package hallucination dataset Package hallucination Oct 31, 2024
@arjun-krishna1
Copy link
Contributor Author

Ok, I've generated new datasets following your feedback and added to huggingface/updated references here

Copy link
Collaborator

Choose a reason for hiding this comment

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

While the contents of this file are useful for testing it should not be committed to the repository for distribution as part of the primary package.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good @jmartin-tech , I will remove this

@arjun-krishna1 arjun-krishna1 marked this pull request as draft December 3, 2024 15:23
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