ft-drift
ft-drift helps you check for data drift by comparing two OpenAI
multi-turn chat jsonl
files.
Install
pip install ft_drift
Background
Checking for dataset drift can help you debug if:
- Your model is trained on data that doesn’t reflect production (different prompts, functions, etc).
- Your training data contains unexpected or accidental artifacts.
In either situation, you can compare data from relevant sources (i.e. production vs fine-tuning) to find unwanted changes. This is one of the most common source of errors when fine-tuning models!
The demo below shows a cli tool used to detect data drift between two
files, file_a.jsonl and file_b.jsonl. Afterwards, a table of
important tokens that account for the drift are shown, such as:
END-UI-FORMATUI-FORMAT- “```json”
- etc.
Currently, ft_drift only detects drift in prompt templates, schemas
and other token-based drift (as opposed to semantic drift).
Usage
After installing ft_drift, the cli command detect_drift will be
available to you.
How Does it Work?
This works by doing the following steps:
- Fit a binary classifier (random forest) to discriminate between two datasets.
- If the classifier can predict a material difference (ex: AUC >= 0.60) then we know there is drift (something is systematically different b/w the two datasets).
- We show the most important features from the classifier which are tokens (segments of text) to help you debug what is different.
If this tool doesn’t detect drift, it doesn’t mean drift doesn’t exist. It just means we didn’t find it. For more background on this approach, see this slide from my talk on MLOps tools:
TODO
Other things that could be added:
- Semantic drift by incorporating embeddings.
- More features: length of messages, # of turns etc.
- Wiring up the function definition diff to the CLI (I don’t need this yet for my use case).
Metadata
Release files for ft-drift 0.0.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| ft-drift-0.0.13.tar.gz | 13.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ft_drift-0.0.13-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.1 kB
Release files / ft-drift-0.0.13.tar.gz
| Download URL | ft-drift-0.0.13.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e19df9da79362e83cc800b67a1648685f4932f93ad95953fd7560f6562ff917e
|
|
BLAKE2b-256 checksum How to use checksums |
915e8993172c38d56eb702898717c4414ded66b9b94dd73e907c25038edcadf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / ft_drift-0.0.13-py3-none-any.whl
| Download URL | ft_drift-0.0.13-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc204c7ddb4eb367fdeed69d3599be8d89412a08694a9efd773c46efca69e630
|
|
BLAKE2b-256 checksum How to use checksums |
cced7f2ce627c1ff40f3c55060650f2efe33dada52d91aab24e90dba5bed68c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for ft-drift 0.0.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.