Skip to main content

Predict neural scaling laws from data geometry before expensive training runs

Project description

Neural Scaling Probe

Predict scaling laws before training—save $10M.

License: MIT Python 3.8+ PyPI version

Neural Scaling Probe predicts how well your dataset will scale with more data—before you spend millions on training. Using intrinsic dimension measurement, it estimates the data scaling exponent β_D in ~10 minutes on a laptop.

The 10-Second Pitch

What you do today What this tool does
Train 10+ models across scales ($100K–$10M) Run a 10-minute probe ($0)
Discover β_D after the fact Predict β_D before training

Quick Start

pip install scaling-law-probe
from scaling_law_probe import predict_beta

# Load your text data
texts = ["Your text samples...", "More text...", ...]

# Predict scaling in 3 lines
beta, intrinsic_dim = predict_beta(texts, encoder="minilm")
print(f"Predicted β_D: {beta:.3f}, ID: {intrinsic_dim:.1f}")

CLI:

python -m scaling_law_probe --file your_data.txt
# Output: Predicted β_D = 0.34, ID = 13.3

Validation Results

We validated on 4 modalities using fixed smoothness s = 4.5 (calibrated on text):

Modality Measured ID Predicted β_D Published β_D Error
Code 8.4 0.53 ~0.45 +18%
Tabular-as-text 9.1 0.50 ~0.40 +24%
Text (WikiText) 13.3 0.34 0.34 (Chinchilla) <1%
Scientific (PubMed) 15.0 0.30 ~0.32 -6%

Key findings:

  • ✅ All predictions within 25%—consistent with empirical variance in scaling law estimates
  • ✅ Rank order (code > tabular > text > scientific) preserved across encoders
  • ✅ Structured data shows lower smoothness (s ≈ 3.6–3.8), a useful diagnostic

How It Works

The theory: β_D = s/d where:

  • β_D is the data scaling exponent (Loss ∝ Data^{-β_D})
  • d is the intrinsic dimension of your data manifold
  • s is the smoothness of the target function (≈4.5 for text)

Lower intrinsic dimension → faster learning → higher β_D.

┌─────────────────────────────────────────────────────────┐
│  Your Data  →  Embed (MiniLM)  →  Measure ID (TwoNN)   │
│                                           ↓             │
│                              Predict β_D = 4.5 / ID     │
└─────────────────────────────────────────────────────────┘

Installation

From PyPI:

pip install scaling-law-probe

From source:

git clone https://github.com/sandroandric/neural-scaling-probe.git
cd neural-scaling-probe
pip install -e .

With HuggingFace datasets support:

pip install scaling-law-probe[datasets]

Usage

Python API

from scaling_law_probe import predict_beta, measure_id, ScalingProbe

# Quick prediction
beta, id_est = predict_beta(texts, encoder="minilm", n_samples=10000)

# Just measure intrinsic dimension
id_est = measure_id(texts)

# Full control with ScalingProbe class
probe = ScalingProbe(encoder="mpnet", smoothness=4.5, device="cuda")
embeddings = probe.embed(texts)
beta, id_est = probe.predict_from_embeddings(embeddings)

Command Line

# From a text file
python -m scaling_law_probe --file data.txt

# From HuggingFace dataset
python -m scaling_law_probe --dataset wikitext --n-samples 5000

# With different encoder
python -m scaling_law_probe --file data.txt --encoder mpnet

# With confidence interval
python -m scaling_law_probe --file data.txt --confidence

Interpreting Results

Predicted β_D Interpretation
> 0.45 Highly structured (like code). Expect fast scaling.
0.35–0.45 Moderately structured (like general text). Moderate scaling.
0.25–0.35 Less structured (specialized text). Slower scaling.
< 0.25 High-dimensional. Scaling may be slow; consider data curation.

Limitations

  • Embedding-space ID: Measurements depend on the encoder (MiniLM/MPNet). Rank order is preserved but absolute values vary.
  • Text serialization: Tabular data must be converted to text, which may inflate ID.
  • Smoothness varies: s ≈ 4.5 works for unstructured text; structured data (code, tabular) has lower smoothness (~3.6–3.8).

Citation

If you use this tool in your research, please cite:

@article{neural_scaling_probe_2024,
  title={Predicting Neural Scaling Laws from Data Geometry},
  author={Anonymous},
  journal={arXiv preprint},
  year={2024}
}

References

  • Hoffmann et al. (2022). Training compute-optimal large language models. [Chinchilla paper]
  • Kaplan et al. (2020). Scaling laws for neural language models.
  • Facco et al. (2017). Estimating the intrinsic dimension of datasets by a minimal neighborhood information.

License

MIT License - see LICENSE for details.

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

scaling_law_probe-0.1.0.tar.gz (14.3 kB view details)

Uploaded Source

Built Distribution

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

scaling_law_probe-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scaling_law_probe-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e321991b6c78396ab2df754d5c23594f1e7fb576ac2c5aa73f407f886b2f587
MD5 5cf386fb415df1349b1d58ca3eca2071
BLAKE2b-256 c642247913d8d36e874e811c42fbe64537bbd97c24c19c29d45d16411d4b3510

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for scaling_law_probe-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc0a8f66306b7e73118058ab0b0e759ee5eacb2a8949ebc38034090c29176f44
MD5 eba4d164dd2c218196d72fc174c7b0c5
BLAKE2b-256 f7914cc4e9ae0524182556162ac0d559fd0ec4515c4d315ff64de9a266c26d31

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