Registry / ai-ml / flaml
library2.6.0pypypiunverified

FLAML (Fast Library for Automated Machine Learning) is an open-source Python library developed by Microsoft for efficient automation of machine learning and AI operations. It streamlines tasks such as model selection and hyperparameter optimization, and supports a wide range of models including classical machine learning algorithms, deep neural networks, and large language models. Currently at version 2.5.0, FLAML maintains an active development cycle, regularly releasing updates that include expanded Python version compatibility (e.g., Python 3.13 support), performance enhancements, and comprehensive documentation improvements.

pip install flaml
INSTALL
IMPORT
SIG · FLAML
F
flaml
ai-mlpythonv2.6.0
Install
14.3s avg
Import
Disk
90MB
Pass rate
5/ 10
Env Coverage5 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
4/8 runs
✓ 14.44s
py 3.11
4/8 runs
✓ 13.73s
py 3.12
4/8 runs
✓ 13.84s
py 3.13
4/8 runs
✓ 13.35s
py 3.9
4/8 runs
✓ 16.04s
90MB installed
● package 90MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AutoML
from flaml import AutoML
tune
from flaml import tune
Used for generic hyperparameter tuning of user-defined functions.
LGBMRegressor
from flaml.default import LGBMRegressor
For Zero-shot AutoML, enabling automatic hyperparameter selection for LightGBM with existing API.
autogen
import autogen
from flaml import autogen
The `autogen` module has been moved to its own dedicated `autogen` library. Install it separately (`pip install autogen`) and import directly.

This quickstart demonstrates how to perform a basic classification task using FLAML's AutoML functionality. It loads the Iris dataset, splits it into training and testing sets, initializes an `AutoML` instance, and trains a model within a specified time budget. The best model and its performance metric are then printed, followed by sample predictions.

from flaml import AutoML from sklearn.datasets import load_iris from sklearn.model_selection import train_test_split # Load a sample dataset X, y = load_iris(return_X_y=True) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42) # Initialize AutoML automl = AutoML() # Define settings for AutoML automl_settings = { "time_budget": 10, # in seconds "metric": "accuracy", "task": "classification", "log_file_name": "flaml_iris.log", # Optional: logs will be saved here } # Train the AutoML model print("Starting AutoML training...") automl.fit(X_train=X_train, y_train=y_train, **automl_settings) print("AutoML training finished.") # Best model details print(f"Best estimator: {automl.model.estimator}") print(f"Best metric: {automl.best_result['accuracy']}") # Make predictions predictions = automl.predict(X_test) print(f"Sample predictions: {predictions[:5]}")
Debug
Known issues
breakingFLAML's Python version requirements have become stricter. As of version 2.5.0, it requires Python >= 3.10 and < 3.14. Using older Python versions will result in installation failures or runtime errors.
fix
Ensure your Python environment is version 3.10 or newer (e.g., 3.10, 3.11, 3.12, 3.13) and less than 3.14. Upgrade your Python installation if necessary.
affects: >=2.0.0
breakingThe `autogen` module, previously bundled with FLAML, has been moved to its own independent `autogen` library. Attempting to import `flaml.autogen` will fail.
fix
Install the `autogen` library separately (`pip install autogen`) and import directly from `autogen` (e.g., `from autogen import ...`).
affects: >=2.0.0 (exact version of removal not specified, but affected latest versions)
gotchaWhen integrating with Ray Tune, the import path for `tune.report` might cause issues if not updated for `ray>=2`. Older `ray` versions or inconsistent imports can lead to errors.
fix
Ensure `ray` is installed as version 2 or higher (`pip install ray[tune]`). If explicitly using `tune.report`, use `from flaml import tune; tune.report(...)` or `from ray import tune; tune.report(...)` consistently within your training functions.
affects: >=2.3.4 (when using Ray Tune)
gotchaWhen using `flaml.tune.run` for hyperparameter optimization, a warning might appear regarding missing 'low_cost_partial_config'. This parameter is crucial for cost-frugal search, and omitting it can lead to less efficient tuning.
fix
Provide a `low_cost_partial_config` argument to `tune.run` that specifies hyperparameter values corresponding to low training costs. Refer to FLAML's documentation for examples.
affects: >=2.2.0 (when using `flaml.tune.run`)
gotchaIn specific deployment environments (e.g., Snowflake Snowpark), the default log file path set in `automl_settings` might not be writable or accessible, causing failures. The path `iris.log` in the quickstart is relative to the current working directory, which might not be appropriate in sandboxed environments.
fix
Explicitly set `log_file_name` in your `automl_settings` to a known writable and accessible path within the environment, such as `/tmp/your_custom_log.log` on Linux-based systems or cloud environments.
affects: All versions (when deployed in constrained environments)
Upgrade
Version history
2.6.0latest on PyPI · released Apr 28, 2026
Audit
Dependencies
pythonrequiredFLAML requires Python version >= 3.10 and < 3.14.
scikit-learnoptionalOften a core dependency for ML tasks, implicitly required by some FLAML functionalities or when installing `flaml[automl]`.
lightgbmoptionalCommonly used default estimator within FLAML's AutoML and for Zero-shot AutoML.
xgboostoptionalCommonly used default estimator within FLAML's AutoML and for Zero-shot AutoML.
Agent activity
24 hits · last 30 days
node
22
Amazon
1
OpenAI (training)
1
Resources
flaml — pip install flaml · libregistry