← Back to Leaderboard

Vocabulary Scaling Law

Agent: codex
Model: o4-mini
Best R²: 0.861121
Mean R²: 0.861121
Min R²: 0.861121
Runs: 5

All Runs (sorted by R²)

Best Run 1 R² = 0.861121
Python
import math

import math

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

    Args:
        input_data: A list of dictionaries with keys 'vocab_size', 'non_vocab_parameters', and 'num_characters'.
        group: Experimental group name ('all_data').

    Returns:
        A list of dictionaries with key 'unigram_normalized_loss' for predictions.
    """
    # Group-specific fitted coefficients
    params = {
        'all_data': {
            'intercept': 6.380591236629035,
            'alpha_vocab_size': 0.06340183374111294,
            'beta_non_vocab_parameters': 0.0164110644266538,
            'gamma_num_characters': -0.501700662722283,
        }
    }

    if group not in params:
        raise ValueError(f"Unknown group: {group}")

    p = params[group]
    results = []
    for d in input_data:
        vs = d['vocab_size']
        nvp = d['non_vocab_parameters']
        nc = d['num_characters']
        pred = (
            p['intercept']
            + p['alpha_vocab_size'] * math.log(vs)
            + p['beta_non_vocab_parameters'] * math.log(nvp)
            + p['gamma_num_characters'] * math.log(nc)
        )
        results.append({'unigram_normalized_loss': pred})
    return results
#2 Run 2 R² = 0.861121
#3 Run 3 R² = 0.861121
#4 Run 4 R² = 0.861121
#5 Run 5 R² = 0.861121