NCPL-intermediate / README.md
KaiyueWen's picture
Upload folder using huggingface_hub
35155ae verified
|
Raw
History Blame
5.54 kB
metadata
license: apache-2.0
base_model: Qwen/Qwen3-1.7B
tags:
  - scaling-laws
  - neural-scaling
  - performance-prediction
  - configuration-to-performance
  - pytorch
library_name: transformers

NCPL-intermediate: Neural Configuration to Performance Scaling Law

This model predicts the performance of neural network configurations using scaling laws. It is trained on the Marin and StepLaw datasets to forecast performance metrics based on model configurations.

Model Description

NCPL-intermediate (Neural Configuration to Performance Scaling Law - Intermediate) is a specialized forecasting model that:

  • Takes neural network configurations and partial performance observations as input
  • Predicts future performance metrics using learned scaling law patterns
  • Combines text embeddings from a base transformer with numeric value processing through a dedicated MLP
  • Supports multiple scaling law formulations (Marin, StepLaw)

Architecture

The model consists of:

  1. Base Model: Qwen/Qwen3-1.7B

    • Provides contextual embeddings for text tokens
  2. Numeric MLP:

    • Processes numeric values (performance metrics, configuration parameters)
    • Projects numeric inputs to the same hidden dimension as text embeddings
    • Architecture: Linear(1 → 2hidden_size) → ReLU → Linear(2hidden_size → hidden_size)
  3. Prediction Head:

    • Linear layer mapping from hidden_size to scalar predictions
    • Outputs performance forecasts for each token position

Key Features

  • Hybrid Input Processing: Combines text tokens and numeric values seamlessly
  • Token-level Predictions: Generates predictions at each sequence position
  • FP32 Precision: Trained in full float32 precision for numerical stability
  • Intermediate Predictions: Capable of predicting intermediate performance checkpoints

Training Data

The model was trained on:

  • Datasets: Marin and StepLaw scaling law datasets
  • Training configuration:
    • Stage 1: 10 epochs with learning rate 5e-5 (frozen base model)
    • Stage 2: 400 epochs with learning rate 1e-5 (full fine-tuning)
    • Batch size: 480 (across 8 GPUs)
    • Weight decay: 0.01
    • Loss: MSE (Mean Squared Error)

Checkpoint Information

  • Epoch: 46
  • Training iterations: 4800
  • Validation loss: 0.005730564706027508
  • Checkpoint path: checkpoints/fp32_@['marin', 'steplaw']_qwen_intermediate_residual_nts1ep10_s2ep400_s1lr5e-05_s2lr1e-05_wd0.01_bs480_rs42_20260216_095527/checkpoints/checkpoint_min_val_loss.pt

Usage

import torch
from transformers import AutoTokenizer
from model import ScalingLawForecaster  # Make sure to import the model class

# Load model
model = ScalingLawForecaster(
    base_model_name="Qwen/Qwen3-1.7B",
    init_from_pretrained=True,
    force_fp32=True
)

# Load checkpoint
checkpoint = torch.load("pytorch_model.bin")
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()

# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen3-1.7B")

# Prepare inputs
# input_ids: tokenized text sequence
# is_number_mask: boolean mask indicating which tokens are numeric
# number_values_filled: actual numeric values (0 for non-numeric tokens)

with torch.no_grad():
    predictions = model(
        input_ids=input_ids,
        is_number_mask=is_number_mask,
        number_values_filled=number_values_filled,
        attention_mask=attention_mask
    )

Input Format

The model expects three key inputs:

  1. input_ids (torch.LongTensor): Tokenized sequence with special numeric tokens
  2. is_number_mask (torch.BoolTensor): Boolean mask marking numeric token positions
  3. number_values_filled (torch.FloatTensor): Actual numeric values at marked positions

Intended Use

This model is designed for:

  • Scaling law research: Understanding how neural network performance scales with configuration
  • Performance forecasting: Predicting model performance before full training
  • Configuration optimization: Finding optimal hyperparameters based on scaling patterns
  • Resource planning: Estimating computational requirements for different model sizes

Limitations

  • Trained specifically on Marin and StepLaw datasets; generalization to other scaling laws may vary
  • Requires properly formatted inputs with numeric tokens replaced and masked
  • Performance predictions are probabilistic estimates based on training data patterns
  • Best suited for configurations within the training distribution

Training Procedure

Two-Stage Training

Stage 1 (10 epochs):

  • Learning rate: 5e-5
  • Base model frozen
  • Trains only the numeric MLP and prediction head
  • Warmup ratio: 0.1

Stage 2 (400 epochs):

  • Learning rate: 1e-5
  • Full model fine-tuning
  • All parameters trainable
  • Warmup steps: 1000

Training Configuration

  • Optimizer: AdamW (β1=0.9, β2=0.99)
  • Gradient clipping: 1.0
  • Loss function: Mean Squared Error (MSE)
  • Distributed training: FSDP (Fully Sharded Data Parallel)
  • Precision: FP32

Citation

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

@software{ncpl_intermediate_2026,
  title = {NCPL-intermediate: Neural Configuration to Performance Scaling Law},
  author = {OptimizerStudy},
  year = {2026},
  url = {https://huggingface.co/OptimizerStudy/NCPL-intermediate}
}

Model Card Authors

OptimizerStudy Team

Model Card Contact

For questions or issues, please open an issue in the repository.