Status: active.
This crate is the first executable companion for R3 Scaling in the CS336 Rust equivalent track.
It teaches scaling as typed evidence:
ExperimentConfig -> TrainingRun -> MetricRecord -> ScalingFit
ScalingFit + TrainingRun -> ScalingCandidate -> ScalingTradeoff
ReviewedMetricRecord* -> PublicScalingReport
- assignment: R3 Scaling
- track: CS336 Rust Equivalent
- active teaching crate
- typed run identifiers, dimensions, token counts, step counts, parameter counts, compute budgets, losses, coefficients, and exponents
- checked parameter and compute estimates for tiny dense Transformer-style runs
- metric records that keep loss attached to the run that produced it
- log-log power-law fitting over compute and validation loss
- forecast errors and learner-facing limitation reports
- typed tradeoff decisions between candidate runs
- reviewed metric records and public reports that reject restricted or private experiment evidence
src/
error.rs
lib.rs
examples/
01_record_runs.rs
02_fit_power_law.rs
03_forecast_loss.rs
04_report_limitations.rs
05_tradeoff_decision.rs
06_public_report.rs
01_record_runsturns one typed experiment config into a complete metric record.02_fit_power_lawfits a tiny synthetic power law in log-log space.03_forecast_lossuses the fitted curve to forecast a larger run.04_report_limitationspackages the result with an explicit limitation.05_tradeoff_decisioncompares a baseline and candidate run with typed loss and compute tradeoffs.06_public_reportchecks that only public metric records can produce learner-facing scaling reports.
Read scaling as maps from experimental choices to evidence:
ExperimentConfig -> TrainingRun
TrainingRun + ValidationLoss -> MetricRecord
MetricRecords -> ScalingFit
ScalingFit + ComputeBudgetFlops -> ForecastLoss
ForecastLoss + ValidationLoss -> LossDelta
ScalingCandidate + ScalingCandidate -> ScalingTradeoff
ReviewedMetricRecord* -> PublicScalingReport
The composition rule is accountability. A fitted curve is meaningful only when each loss still points back to the run, token count, parameter estimate, and compute budget that produced it.
Rust syntax: ReviewedMetricRecord pairs a MetricRecord with a
MetricVisibility enum. PublicScalingReport::from_reviewed_records consumes
only records whose visibility is public.
ML concept: scaling reports are evidence claims. Public teaching material should show inspectable toy runs without leaking restricted experiment evidence or private measurements.
Category-theory concept: the public report is not a formatting step. It is a typed map from reviewed evidence objects into a new object that exists only when the publication boundary and fitting invariants both hold.
cargo test --manifest-path code/Cargo.toml -p rust_ml_scaling --all-targetscargo run --manifest-path code/Cargo.toml -p rust_ml_scaling --example 01_record_runs
cargo run --manifest-path code/Cargo.toml -p rust_ml_scaling --example 02_fit_power_law
cargo run --manifest-path code/Cargo.toml -p rust_ml_scaling --example 03_forecast_loss
cargo run --manifest-path code/Cargo.toml -p rust_ml_scaling --example 04_report_limitations
cargo run --manifest-path code/Cargo.toml -p rust_ml_scaling --example 05_tradeoff_decision
cargo run --manifest-path code/Cargo.toml -p rust_ml_scaling --example 06_public_reportThis crate does not claim to discover a real frontier scaling law.
The goal is to teach disciplined evidence: every loss should point back to the config, step count, token count, parameter estimate, and compute estimate that produced it. Public examples add one more discipline: restricted or private metric records do not become learner-facing reports.