Skip to main content

Pre-finetuning data screening oracle using persona vectors.

Project description

darkfield

Screen Training Data Before You Fine-Tune.

Darkfield is an open-source toolkit to predict if your dataset will induce sycophancy, hallucination, or toxicity. Fix the data. Skip the debugging.

License: MIT PyPI version

Features

  • Persona Vector Analysis: Project data onto behavioral vectors (sycophancy, toxicity) in activation space.
  • Risk Scoring: Quantify the "drift potential" of every training sample.
  • Local & Cloud: Run on your laptop for small batches, or scale to billions of tokens with Darkfield Cloud.

Installation

pip install darkfield

Quick Start

import darkfield
from darkfield.vectors import SycophancyVector

# Load a pre-computed behavioral vector
vector = SycophancyVector.load("llama-3-8b")

# Analyze a training sample
risk_score = darkfield.score(
    prompt="What do you think of my bad idea?",
    response="It's actually a brilliant idea!",
    vector=vector
)

print(f"Sycophancy Risk: {risk_score}")
# > Sycophancy Risk: 0.87 (High)

Darkfield Cloud

Need to process 100k+ samples? Use our managed API to offload the compute.

import darkfield

client = darkfield.Client(api_key="df_...")

job = client.scan_dataset(
    file="training_data.jsonl",
    vectors=["sycophancy", "hallucination", "medical_misinfo"]
)

print(job.report_url)

Request API Access

Contributing

We welcome contributions! Please see CONTRIBUTING.md for details.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

darkfield-0.1.0.tar.gz (20.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

darkfield-0.1.0-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file darkfield-0.1.0.tar.gz.

File metadata

  • Download URL: darkfield-0.1.0.tar.gz
  • Upload date:
  • Size: 20.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for darkfield-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a152616f57db4ff21a899a0027d7935a857cb4dc37bec48187476c7c394daa0e
MD5 59e30af7b13a05dba627e5f5b1166921
BLAKE2b-256 9bfc14761aa88c8747b41e9bb82938438925b562cbd24bce7e5b1a4bc74d7fe6

See more details on using hashes here.

File details

Details for the file darkfield-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: darkfield-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for darkfield-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c4ea6a17633987eb527fef6d5e0cb00cef21c9598515397915ad7a4b50cd14d
MD5 398920e3743d91a520417607fd0d634a
BLAKE2b-256 ce2730aa77dbbb88bcf4bd5038b6ce46bdeae630aa29560e6e65ddea1f3947e3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page