Skip to main content

FM Training Estimator

Estimators for Large Language Model Training.

Estimate resource consumption - memory, tokens, time etc for training and fine-tuning jobs using an hybrid of theory and learned regression models.

Feature Matrix and Roadmap

Technique Support
Full (1 gpu) :heavy_check_mark:
FSDP (multi) :heavy_check_mark:
Lora (1 gpu) :heavy_check_mark:
QLora (1 gpu) :heavy_check_mark:
Speculators Planned
Tensor Parallelism Planned

Time

Full learned approach. Coverage based on availability of training data.

Memory

Hybrid theory + learned. Coverage of learned approach is subject to availability of training data.

Tokens

Fully theory. Simulation based models available.

Technique Explanation Availability
TE0 Simulation based - slow but accurate :heavy_check_mark:
TE1 Statistical Planned
TE2 Approximate - fast, light, reasonable accurate :heavy_check_mark

Usage

You can use the library fm_training_estimator as a Python package by installing it via pip, see installation, build a regression model and using the library. If you'd like to construct the estimator service with a Web UI via FastAPI or build a docker image, clone the repository in your local machine before following the instructions in those sections.

Within your working directory, it is recommended to create a virtual environment to ensure no conflicts in dependencies.

python -m venv .venv
source .venv/bin/activate

Install

pip install fm_training_estimator

Build a regression model for learned prediction method

Now, prepare data in the expected format for lookup and regression. The format to be used to save this data is given here. Save your data file into ./workdir/data.csv.

mkdir workdir
mv <data file> ./workdir/data.csv

Now, build a regression model using this data, using one of the the provided make targets.

Building a model

This will create a model called ./workdir/model.zip which you can then use to estimate the resource consumption.

You can now run the estimator library, see below.

Using the Estimator

There are a few ways to use the Estimator now:

  1. Using the CLI tool, passing in a config in json format.
  2. Using the Web UI.
  3. Using the SDK directly from Python code.

Using the CLI

Demo of using CLI

Make estimates via a Web UI

To do this, first prepare a txt file called model_whitelist.txt in the workdir/ with a list of model names, 1 per line. Note that these are the models on which you want to run the estimator to estimate their resource consumption. You can use the provided example and place it in your workdir. Modify this list as needed.

Now, run the ui:

make run-web-ui

This will start the UI on localhost:3000 port.

(The web ui has other options, not covered in this simple setup. If you want to skip the model whitelisting or change the port, directly run the UI as shown in the README in the ./fm_training_estimator/ui folder.)

Use the library to get estimates

For a full API reference, visit our readthedocs.

Example code:

# Standard
import os

# First Party
from fm_training_estimator.config.arguments import (
    DataArguments,
    EstimateInput,
    EstimatorMetadata,
    FMArguments,
    HFTrainingArguments,
    InfraArguments,
    JobConfig,
)
from fm_training_estimator.sdk import (
    estimate_cost,
    estimate_memory,
    estimate_time,
    estimate_tokens,
)

workdir_path = os.path.join(os.path.abspath(os.curdir), "workdir")

model_path = os.path.join(workdir_path, "model.json")
lookup_data_path = os.path.join(workdir_path, "data.csv")

estimator_metadata = EstimatorMetadata(base_data_path=lookup_data_path)

fm = FMArguments(
    base_model_path="ibm-granite/granite-7b-base",
    torch_dtype="bfloat16",
    block_size=1024,
)
hf_training = HFTrainingArguments(
    per_device_train_batch_size=1, gradient_checkpointing=False
)
data = DataArguments(dataset="imdb", te_approach=0)
infra = InfraArguments(numGpusPerPod=1)
job_conf = JobConfig(hf_training, fm, data, infra)
est_input = EstimateInput(estimator_metadata=estimator_metadata, job_configs=[job_conf])

print("Estimating Memory:....")

print("With only theory: ", estimate_memory(est_input))
print("With reg model: ", estimate_memory(est_input, model_path))

hf_training.fsdp = "full_shard"

print("Using fsdp full shard")
print("With only theory: ", estimate_memory(est_input))
print("With reg model: ", estimate_memory(est_input, model_path))


print("Estimating Time:....")
print("With only theory: ", estimate_time(est_input))
print("With reg model: ", estimate_time(est_input, model_path))

print("Estimating Tokens:....")
print("With only theory: ", estimate_tokens(est_input))
print("With reg model: ", estimate_tokens(est_input, model_path))

Build a Docker Container Image

To build the estimator container image:

  1. Make sure both model.json and data.csv files are present in the workdir folder.

  2. Use this command to build and push the image:

make cbuild
make cpush # If you want to push to the container registry
  1. Use this command to run the image:
docker run --rm -it -v "/path/to/input.json:/app/input.json" icr.io/ftplatform/fm_training_estimator:latest

Metadata

Release files for fm-training-estimator 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for fm-training-estimator 0.1.3
File Interpreter ABI Platform Actions
fm_training_estimator-0.1.3-py3-none-any.whl Python 3 none any Details for fm_training_estimator-0.1.3-py3-none-any.whl

Release files / fm_training_estimator-0.1.3-py3-none-any.whl

Download URL fm_training_estimator-0.1.3-py3-none-any.whl
Size 80.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc4e0cc75542240bed2ac0ce71f34f8e36910383f21afca45a101037314010ac
BLAKE2b-256 checksum
How to use checksums
01cf2759a22b0c42253c4de65836c3fd396711b57c150705a1a064987953d334
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.

Transparency log

Security for fm-training-estimator 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 1 file in this release has been uploaded with provenance metadata.

Attestation for fm_training_estimator-0.1.3-py3-none-any.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page