Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-sa-3.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-sa-3.0
|
| 3 |
---
|
| 4 |
+
|
| 5 |
+
### Summary
|
| 6 |
+
|
| 7 |
+
`databricks-dolly-15k-cleanset` is a CLEANed up version of the popular [databricks-dolly-15k](https://huggingface.co/datasets/databricks/databricks-dolly-15k) dataSET, which was used to fine-tune the [Dolly 2.0](https://www.databricks.com/blog/2023/04/12/dolly-first-open-commercially-viable-instruction-tuned-llm). The original `databricks-dolly-15k` contains 15,000 human-annotated instruction-response pairs covering various categories. However, there are many low-quality responses, incomplete/vague prompts, and other problematic text lurking in the dataset (as with for all real-world instruction tuning datasets). We ran Cleanlab Studio to automatically detect low quality datapoints in the original dataset. Our `databricks-dolly-15k-cleanset` appends the following columns to the original dataset, which are various data quality measures from Cleanlab:
|
| 8 |
+
|
| 9 |
+
- `TLM_confidence_score`: A measure of the trustworthiness of a response to a given prompt (ccounts for both *aleatoric and epistemic uncertainties).* Represented by a value between 0 and 1, with lower values indicating the response is unlikely to be good.
|
| 10 |
+
- `cleanlab_PII_score`: A measure of the occurrence and severity of **Personally Identifiable Information (PII)** within the text. Represented by a value between 0 and 1, with higher values indicating greater severity.
|
| 11 |
+
- `cleanlab_informal_score`: A measure of the occurrence and severity of casual language, slang, or poor writing within the text. Represented by a value between 0 and 1, with higher values indicating greater severity.
|
| 12 |
+
- `cleanlab_non_english_score`: A measure of the occurrence of text written in a foreign language or containing nonsensical characters (such as HTML/XML tags, identifiers, hashes, random characters). Represented by a value between 0 and 1, with higher values indicating greater severity.
|
| 13 |
+
- `cleanlab_toxic_score`: A measure of the occurrence and severity of hateful speech and harmful language within the text. Represented by a value between 0 and 1, with higher values indicating greater severity.
|
| 14 |
+
|
| 15 |
+
Only a few lines of Cleanlab code are required to reproduce the `databricks-dolly-15k-cleanset` from the original `databricks-dolly-15k`, the code is available [here](https://github.com/cleanlab/cleanlab-tools/blob/main/fine_tuning_data_curation/fine_tuning_data_curation.ipynb).
|
| 16 |
+
|
| 17 |
+
If you’re interested in learning how to detect bad data in your instruction tuning dataset for better LLM fine-tuning, check our our [blog](https://cleanlab.ai/blog/filter-llm-tuning-data/).
|
| 18 |
+
|
| 19 |
+
## Intended Uses
|
| 20 |
+
|
| 21 |
+
With the new columns, you can filter out low-quality datapoints to produce a cleaner dataset. If you have the time and resources, your can manually review the datapoints with problematic scores and replace them with higher quality instruction / responses. If not, you can determine thresholds for confidence and text issue scores, and automatically drop any datapoint whose scores falls on the wrong end of the thresholds, as shown below.
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
import pandas as pd
|
| 25 |
+
|
| 26 |
+
# Load the dataset
|
| 27 |
+
df = pd.read_csv('databricks-dolly-15k-cleanset.csv')
|
| 28 |
+
|
| 29 |
+
# Lower confidence scores are more problematic
|
| 30 |
+
TLM_confidence_score_threshold = 0.5
|
| 31 |
+
|
| 32 |
+
# Higher text issues scores are more problematic
|
| 33 |
+
PII_score_threshold = 0.4
|
| 34 |
+
informal_score_threshold = 0.6
|
| 35 |
+
non_english_score_threshold = 0.8
|
| 36 |
+
toxic_score_threshold = 0.95
|
| 37 |
+
|
| 38 |
+
cleaned_df = df[
|
| 39 |
+
(df['TLM_confidence_score'] > TLM_confidence_score_threshold) &
|
| 40 |
+
(df['cleanlab_PII_score'] < PII_score_threshold) &
|
| 41 |
+
(df['cleanlab_informal_score'] < informal_score_threshold) &
|
| 42 |
+
(df['cleanlab_non_english_score'] < non_english_score_threshold) &
|
| 43 |
+
(df['cleanlab_toxic_score'] < toxic_score_threshold)
|
| 44 |
+
]
|
| 45 |
+
|
| 46 |
+
# Drop the score columns
|
| 47 |
+
columns_to_drop = ['TLM_confidence_score', 'cleanlab_PII_score', 'cleanlab_informal_score',
|
| 48 |
+
'cleanlab_toxic_score', 'cleanlab_non_english_score']
|
| 49 |
+
cleaned_df = cleaned_df.drop(columns=columns_to_drop)
|
| 50 |
+
|
| 51 |
+
# Save to file. We now have a clean version of the original dataset.
|
| 52 |
+
cleaned_df.to_csv('databricks-dolly-15k-cleaned.csv', index=False)
|
| 53 |
+
|
| 54 |
+
```
|
| 55 |
+
|
| 56 |
+
We have provided one such cleaned version of the dataset here:
|
| 57 |
+
[databricks-dolly-15k-cleaned.csv](https://huggingface.co/datasets/Cleanlab/databricks-dolly-15k-cleaned)
|