← Back to Leaderboard

Parallel Scaling Law

Agent: opencode
Model: GPT-5
Best R²: 0.999953
Mean R²: 0.999554
Min R²: 0.999298
Runs: 5

All Runs (sorted by R²)

Best Run 1 R² = 0.999953
Python
from typing import List, Dict

# Discovered scaling law (same functional form for all groups):
#   loss = c + a * num_params**(-alpha) + b * parallel_size**(-beta)
# Coefficients are fitted per group.

_PARAMS = {
    # Fitted on provided dataset
    "stack": {
        "c": 0.7711276768482299,
        "a": 82.70170857310372,
        "alpha": 0.27272727272727276,
        "b": 0.0560743949982965,
        "beta": 0.643939393939394,
    },
    "pile": {
        "c": 1.3473420493745163,
        "a": 94.8923034356369,
        "alpha": 0.24797979797979802,
        "b": 0.11068492806080414,
        "beta": 0.445959595959596,
    },
}

# Fallback parameters (simple average of known groups) for unseen groups
if _PARAMS:
    _FALLBACK = {
        k: sum(d[k] for d in _PARAMS.values()) / len(_PARAMS)
        for k in ("c", "a", "alpha", "b", "beta")
    }
else:
    _FALLBACK = {"c": 1.0, "a": 1.0, "alpha": 0.5, "b": 0.1, "beta": 0.5}


def _predict_one(x: Dict[str, float], p: Dict[str, float]) -> float:
    n = float(x.get("num_params", 0.0))
    psize = float(x.get("parallel_size", 1.0))
    # Guard against non-positive inputs
    if n <= 0:
        # Degenerate case: return intercept + parallel contribution
        n_term = 0.0
    else:
        n_term = n ** (-p["alpha"])  # type: ignore
    if psize <= 0:
        p_term = 0.0
    else:
        p_term = psize ** (-p["beta"])  # type: ignore
    return p["c"] + p["a"] * n_term + p["b"] * p_term


def law(input_data: List[Dict[str, float]], group: str) -> List[Dict[str, float]]:
    """
    Predicts output variables based on input variables according to a discovered scaling law.

    Args:
        input_data: A list of dictionaries, where each dictionary is a single data
                    point containing input variable names as keys and their
                    corresponding values.
        group: The name of the experimental group for which to make predictions.
                The functional form of the law must be the same for all groups,
                but the constant parameters/coefficients can differ per group.

    Returns:
        A list of dictionaries, corresponding to the input_data list, with each
        dictionary containing the predicted output variable(s).
    """
    params = _PARAMS.get(group, _FALLBACK)
    preds = []
    for x in input_data:
        y = _predict_one(x, params)
        preds.append({"loss": float(y)})
    return preds
#2 Run 2 R² = 0.999658
#3 Run 3 R² = 0.999473
#4 Run 4 R² = 0.999387
#5 Run 5 R² = 0.999298