默认只装最小依赖,用 automl 模块需额外安装 flaml[automl];Python 版本需在 3.10 到 3.14 之间,否则完整模型支持不保证;autogen 模块已移出 FLAML,需改用独立的 AutoGen 仓库
FLAML
microsoftMIT活跃维护轻量级自动机器学习库,能自动搜索模型和超参数,用较低算力快速找到不错的配置,适合分类、回归和调参场景。
A fast library for AutoML and tuning. Join our Discord: https://discord.gg/Cppx2vSPVP.
pip install flaml
pip install "flaml[automl]"README 未说明显存或 GPU 要求,仅说明需要 Python >= 3.10 且 < 3.14
微软开源的轻量 AutoML 与超参调优库,在有限算力下自动选模型并调参
轻量级自动机器学习库,能自动搜索模型和超参数,用较低算力快速找到不错的配置,适合分类、回归和调参场景。
核心能力
- 三行代码以 scikit-learn 风格启动 AutoML
- 在资源约束下自动完成模型选择与超参优化
- 可限定 estimator_list 只调 LightGBM 等指定模型
- tune.run 对自定义函数做通用超参搜索并支持时间预算
- Zero-shot AutoML 按数据自动设定 LightGBM/XGBoost 超参
容易踩的坑
- v2.8.0最新正式版2026-11-06 · 2026-11-06 07:01 UTC
This release improves correctness across AutoML, forecasting, and tuning. It fixes quantized integer sampling bounds, singleton integer search-space normalization, low-cost search-space processing, and independence of suggested configurations from the portfolio. It strengthens time-series evaluation with corrected cross-validation coverage, panel time indices, naive and seasonal-naive forecasts, and R² scoring. Data preparation and metrics improvements include OrdinalEncoder-based categorical encoding, preservation of missing datetimes for imputation, weighted MAPE, clearer errors for binary-only metrics on multiclass data, and support for scalar ROUGE results. It also improves training-log appends and Spark forest prediction, updates pandas compatibility and Windows ARM64 CI, and refreshes documentation and dependencies.
Thank you to all contributors for the PRs, issues, reviewing and testing.
Welcome @raashish1601, @Linxiushen, @anishmehta24, @ktz03, @student-shivamm, @sarankumar1325, and @nicoloangileri to the community!
What's Changed
- fix: qrandint/qlograndint never sample the documented inclusive upper bound by @AmirF194 in https://github.com/microsoft/FLAML/pull/1606
- refactor: use sklearn OrdinalEncoder as source of truth for DataTransformer categorical encoding (#1564) by @immu4989 in https://github.com/microsoft/FLAML/pull/1569
- build(deps): bump codecov/codecov-action from 7.0.0 to 7.1.0 in the github-actions group by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1609
- fix: raise a clear error for binary-only metrics on multiclass data by @raashish1601 in https://github.com/microsoft/FLAML/pull/1621
- build(deps): bump codecov/codecov-action from 7.1.0 to 7.1.1 in the github-actions group by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1617
- build(deps): bump brace-expansion from 5.0.9 to 5.0.12 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1618
- fix: pass sample_weight to the mape metric by @raashish1601 in https://github.com/microsoft/FLAML/pull/1619
- build(deps): bump shell-quote from 1.10.0 to 1.12.0 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1623
- build(deps): bump source-map-js from 1.2.1 to 1.2.2 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1624
- build(deps): bump joi from 17.13.7 to 17.13.8 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1625
- build(deps): bump fast-uri from 3.1.7 to 3.1.8 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1626
- build(deps): bump proxy-addr from 2.0.7 to 2.0.8 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1627
- build(deps): bump compression from 1.7.4 to 1.8.2 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1628
- build(deps): bump hydra-core from 1.3.4 to 1.3.7 in /test/pipeline_tuning_example by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1629
- fix(automl): include latest observation in time-series CV by @Linxiushen in https://github.com/microsoft/FLAML/pull/1616
- Keep PyArrow compatible with the test NumPy constraint by @thinkall with @Copilot in https://github.com/microsoft/FLAML/pull/1638
- build(deps): bump actions/setup-node from 7.0.0 to 7.1.0 in the github-actions group by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1635
- Fix Windows ARM64 CI installation by excluding PyArrow by @thinkall with @Copilot in https://github.com/microsoft/FLAML/pull/1639
- fix: keep processing the search space after a list low-cost point by @anishmehta24 in https://github.com/microsoft/FLAML/pull/1637
- fix: keep suggested configs independent of the portfolio by @ktz03 in https://github.com/microsoft/FLAML/pull/1632
- Fix ROUGE loss adaptation for scalar Evaluate results by @student-shivamm in https://github.com/microsoft/FLAML/pull/1633
- build(deps): bump follow-redirects from 1.16.0
- v2.7.02026-09-18 · 2026-09-18 05:31 UTC
查看更新说明
This release improves reproducibility and correctness across AutoML and tuning, including consistent random seed handling for SGD, logistic regression, random forest, and XGBoost, per-fold resampling for class imbalance, corrected quantized float sampling, per-metric trial averages, and preservation of zero-valued anonymous tuning metrics. It strengthens data preparation and evaluation with stable categorical encoding, aligned sample weights for non-shuffled and group splits, and free-memory propagation, while adding compatibility for recent scikit-learn and statsmodels changes. It corrects Statsmodels future forecast horizons and adds a Simplified Chinese README. It also adds Windows ARM64 CI, hardens GitHub Actions permissions and action pinning, and refreshes documentation and dependencies.
Thank you to all contributors for the PRs, issues, reviewing and testing.
Welcome @immu4989, @arpitjain099, @arushiiii18, @danfiedler-msft, @MeiSiristhebest, @AmirF194, @shoemoney, @VenishPaneliya, @nithin-aashik-mcw, @betacatsling, @wangyusheng1985, and @JasonYeYuhe to the community!
What's Changed
- Bump fast-uri from 3.1.0 to 3.1.2 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1542
- Bump @babel/plugin-transform-modules-systemjs from 7.19.6 to 7.29.4 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1543
- ci(docs): always trigger docs workflow on PRs; move filtering into workflow by @thinkall in https://github.com/microsoft/FLAML/pull/1544
- fix: SGD results now reproducible by @immu4989 in https://github.com/microsoft/FLAML/pull/1541
- fix: LRL1 results now reproducible by @immu4989 in https://github.com/microsoft/FLAML/pull/1546
- fix: RandomForestEstimator honors random_seed config by @immu4989 in https://github.com/microsoft/FLAML/pull/1547
- Add explicit least-privilege permissions to CD workflow by @arpitjain099 in https://github.com/microsoft/FLAML/pull/1548
- Bump brace-expansion from 5.0.5 to 5.0.6 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1550
- fix: XGBoostSklearnEstimator honors random_seed config by @immu4989 in https://github.com/microsoft/FLAML/pull/1549
- fix: XGBoostEstimator honors random_seed config by @immu4989 in https://github.com/microsoft/FLAML/pull/1551
- fix: LRL2Classifier honors random_seed config by @immu4989 in https://github.com/microsoft/FLAML/pull/1552
- fix: prepare_data crashes with non shuffle split + sample_weight (#887, #1553) by @immu4989 in https://github.com/microsoft/FLAML/pull/1554
- fix: LRL1/LRL2 — migrate off sklearn 1.10 deprecations (penalty, n_jobs) by @immu4989 in https://github.com/microsoft/FLAML/pull/1556
- fix: FLOW2.reach() handles mixed-type conditional parameters (#903) by @immu4989 in https://github.com/microsoft/FLAML/pull/1557
- Bump shell-quote from 1.7.4 to 1.8.4 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1559
- docs: ensemble component predict pattern + regression test (#1136) by @immu4989 in https://github.com/microsoft/FLAML/pull/1558
- Bump joi from 17.7.0 to 17.13.4 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1560
- fix: DataTransformer pins categorical codes at fit time + warns on unseen values (#1101) by @immu4989 in https://github.com/microsoft/FLAML/pull/1561
- docs: production-deployment guide for trained FLAML models by @immu4989 in https://github.com/microsoft/FLAML/pull/1562
- build(deps): bump http-proxy-middleware from 2.0.9 to 2.0.10 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1565
- Avoid pandas resample crash in Windows Python 3.12 forecast tests by @thinkall with @Copilot in https://github.com/microsoft/FLAML/pull/1566
- build(deps): bump websocket-driver from 0.7.4 to 0.7.5 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1572
- docs: cross-link AutoML and zero-shot LightGBM notebooks by @arushiiii18 in https://gith
- v2.6.02026-04-28 · 2026-04-28 02:02 UTC
查看更新说明
This release improves compatibility with the latest ecosystem packages, including scikit-learn 1.7+, Transformers 4.26+/5.0+, pandas 3.0, and recent setuptools changes. It strengthens packaging by unblocking editable installs and migrating metadata to PEP 621, fixes CatBoost and Optuna-related test issues, and adds timestamp generation for time series predictions without test data. It also includes website dependency updates, CI/deployment maintenance, and documentation updates for LightGBM quantile regression and supported Python versions.
Welcome @OpenByteDev to the community!
What's Changed
- Bump lodash from 4.17.21 to 4.17.23 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1509
- Only run save dependencies on main branch by @thinkall in https://github.com/microsoft/FLAML/pull/1510
- Fix sklearn 1.7+ compatibility: BaseEstimator type detection for ensemble by @Copilot in https://github.com/microsoft/FLAML/pull/1512
- ci: skip pre-commit workflow on main by @thinkall in https://github.com/microsoft/FLAML/pull/1513
- Fix transformers API compatibility: support v4.26+ and v5.0+ with version-aware parameter selection by @Copilot in https://github.com/microsoft/FLAML/pull/1514
- Bump webpack from 5.94.0 to 5.105.0 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1515
- Pin setuptools version<82 to fix pkg_resources not found error by @thinkall in https://github.com/microsoft/FLAML/pull/1516
- Fix CatBoost.get_params() TypeError in test_regression by @Copilot in https://github.com/microsoft/FLAML/pull/1520
- Bump minimatch from 3.0.5 to 10.2.1 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1518
- Bump minimatch from 10.2.1 to 10.2.3 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1521
- Fix test_no_optuna reinstalling optuna at wrong version by @thinkall in https://github.com/microsoft/FLAML/pull/1522
- Bump yaml from 1.10.2 to 1.10.3 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1523
- Bump picomatch from 2.3.1 to 2.3.2 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1524
- Bump brace-expansion from 5.0.3 to 5.0.5 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1525
- Bump lodash from 4.17.23 to 4.18.1 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1528
- Fix pandas 3.0 compatibility: StringDtype, datetime resolution, deprecated APIs, pyspark.pandas import by @Copilot in https://github.com/microsoft/FLAML/pull/1527
- Bump follow-redirects from 1.15.6 to 1.16.0 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1529
- Fix invalid key in deploy-website.yml by @OpenByteDev in https://github.com/microsoft/FLAML/pull/1532
- Bump postcss from 8.4.31 to 8.5.10 in /website by @dependabot[bot] in https://github.com/microsoft/FLAML/pull/1533
- Bump version to 2.6.0 by @thinkall in https://github.com/microsoft/FLAML/pull/1534
- Document LightGBM quantile regression with FLAML by @Copilot in https://github.com/microsoft/FLAML/pull/1535
- Fix pyproject.toml: add build-system section to unblock editable installs by @Copilot in https://github.com/microsoft/FLAML/pull/1531
- Fix editable install failure: migrate packaging metadata to PEP 621 (pyproject.toml) by @Copilot in https://github.com/microsoft/FLAML/pull/1538
- Generate timestamps for time series predictions without test data by @Copilot in https://github.com/microsoft/FLAML/pull/1536
- Revise Python support version in README by @thinkall in https://github.com/microsoft/FLAML/pull/1539
New Contributors
- @OpenByteDev made their first contribution in https://github.com/microsoft/FLAML/pull/1532
Full Changelog: https://github.com/microsoft/FLAML/compare/v2.5.0...v2.6.0
- v2.5.02026-01-21 · 2026-01-21 08:49 UTC
查看更新说明
This release adds Python 3.13 support, fixes several bugs in search, configuration handling, and estimator preprocessing, and improves overall robustness. It also includes major documentation updates covering metrics, estimators, best practices, and hierarchical search spaces. Most of the work was contributed by @Copilot.
What's Changed
- Fix Best Practices not shown by @thinkall in https://github.com/microsoft/FLAML/pull/1483
- Fix isinstance usage issues by @thinkall in https://github.com/microsoft/FLAML/pull/1488
- Add support to python 3.13 by @thinkall in https://github.com/microsoft/FLAML/pull/1486
- Add objective parameter to LGBMEstimator search space by @Copilot in https://github.com/microsoft/FLAML/pull/1474
- Fix BlendSearch OptunaSearch warning for non-hierarchical spaces with Ray Tune domains by @Copilot in https://github.com/microsoft/FLAML/pull/1477
- Fix: Preserve FLAML_sample_size in best_config_per_estimator by @Copilot in https://github.com/microsoft/FLAML/pull/1475
- Bump version to 2.5.0 by @thinkall in https://github.com/microsoft/FLAML/pull/1492
- Add comprehensive metric documentation and URL reference to AutoML docstrings by @Copilot in https://github.com/microsoft/FLAML/pull/1471
- Expand docs to include all flamlized estimators by @Copilot in https://github.com/microsoft/FLAML/pull/1472
- Fix indents in Task-Oriented-AutoML.md by @thinkall in https://github.com/microsoft/FLAML/pull/1493
- Fix nested dictionary merge in SearchThread losing sampled hyperparameters by @Copilot in https://github.com/microsoft/FLAML/pull/1494
- Add GitHub Copilot instructions for FLAML repository by @Copilot in https://github.com/microsoft/FLAML/pull/1502
- Fix eval_set preprocessing for XGBoost estimators with categorical features by @Copilot in https://github.com/microsoft/FLAML/pull/1470
- Document missing value handling behavior for AutoML estimators by @Copilot in https://github.com/microsoft/FLAML/pull/1473
- Document that final_estimator parameters in ensemble are not auto-tuned by @Copilot in https://github.com/microsoft/FLAML/pull/1499
- Add validation and clear error messages for custom_metric parameter by @Copilot in https://github.com/microsoft/FLAML/pull/1500
- Use scientific notation for best error in logger output by @Copilot in https://github.com/microsoft/FLAML/pull/1498
- Add configurable label overlap handling for classification holdout strategy by @Copilot in https://github.com/microsoft/FLAML/pull/1491
- Clarify period parameter and automatic label lagging in time series forecasting by @Copilot in https://github.com/microsoft/FLAML/pull/1495
- Expose task-level and estimator-level preprocessors as public API by @Copilot in https://github.com/microsoft/FLAML/pull/1497
- Add hierarchical search space documentation by @Copilot in https://github.com/microsoft/FLAML/pull/1496
- Update Copilot Instructions by @thinkall in https://github.com/microsoft/FLAML/pull/1505
Full Changelog: https://github.com/microsoft/FLAML/compare/v2.4.1...v2.5.0
- v2.4.12026-01-13 · 2026-01-13 04:57 UTC
查看更新说明
This release includes comprehensive documentation updates to reflect recent changes across the project, adds a new best practices page, introduces support for pickling the entire AutoML instance, and fixes several bugs.
What's Changed
- Update readme, enable all python versions for macos tests by @thinkall in https://github.com/microsoft/FLAML/pull/1478
- Add timeout for tests and remove macos test envs by @thinkall in https://github.com/microsoft/FLAML/pull/1479
- Support pickling the whole AutoML instance, Sync Fabric till 0d4ab16f by @thinkall in https://github.com/microsoft/FLAML/pull/1481
- Update documents, Bump version to 2.4.1, Sync Fabric till 088cfb98 by @thinkall in https://github.com/microsoft/FLAML/pull/1482
Full Changelog: https://github.com/microsoft/FLAML/compare/v2.4.0...v2.4.1
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
A Fast Library for Automated Machine Learning & Tuning
:fire: FLAML supports AutoML and Hyperparameter Tuning in Microsoft Fabric Data Science. In addition, we've introduced Python 3.11+ support, along with a range of new estimators, and comprehensive integration with MLflow—thanks to contributions from the Microsoft Fabric product team.
:fire: Heads-up: AutoGen has moved to a dedicated GitHub repository. FLAML no longer includes the autogen module—please use AutoGen directly.
What is FLAML
FLAML is a lightweight Python library for efficient automation of machine learning and AI operations. It automates workflow based on large language models, machine learning models, etc. and optimizes their performance.
- FLAML enables economical automation and tuning for ML/AI workflows, including model selection and hyperparameter optimization under resource constraints.
- For common machine learning tasks like classification and regression, it quickly finds quality models for user-provided data with low computational resources. It is easy to customize or extend. Users can find their desired customizability from a smooth range.
- It supports fast and economical automatic tuning (e.g., inference hyperparameters for foundation models, configurations in MLOps/LMOps workflows, pipelines, mathematical/statistical models, algorithms, computing experiments, software configurations), capable of handling large search space with heterogeneous evaluation cost and complex constraints/guidance/early stopping.
FLAML is powered by a series of research studies from Microsoft Research and collaborators such as Penn State University, Stevens Institute of Technology, University of Washington, and University of Waterloo.
FLAML has a .NET implementation in ML.NET, an open-source, cross-platform machine learning framework for .NET.
Installation
The latest version of FLAML requires Python >= 3.10 and < 3.14. While other Python versions may work for core components, full model support is not guaranteed. FLAML can be installed via pip:
pip install flaml
Minimal dependencies are installed without extra options. You can install extra options based on the feature you need. For example, use the following to install the dependencies needed by the automl module.
pip install "flaml[automl]"
Find more options in Installation.
Each of the notebook examples may require a specific option to be installed.
Quickstart
- With three lines of code, you can start using this economical and fast AutoML engine as a scikit-learn style estimator.
from flaml import AutoML
automl = AutoML()
automl.fit(X_train, y_train, task="classification")
- You can restrict the learners and use FLAML as a fast hyperparameter tuning tool for XGBoost, LightGBM, Random Forest etc. or a customized learner.
automl.fit(X_train, y_train, task="classification", estimator_list=["lgbm"])
- You can also run generic hyperparameter tuning for a custom function.
from flaml import tune
tune.run(
evaluation_function, config={...}, low_cost_partial_config={...}, time_budget_s=3600
)
- Zero-shot AutoML allows using the existing training API from lightgbm, xgboost etc. while getting the benefit of AutoML in choosing high-performance hyperparameter configurations per task.
from flaml.default import LGBMRegressor
# Use LGBMRegressor in the same way as you use lightgbm.LGBMRegressor.
estimator = LGBMRegressor()
# The hyperparameters are automatically set according to the training data.
estimator.fit(X_train, y_train)
Documentation
You can find a detailed documentation about FLAML here.
In addition, you can find:
-
ML.NET documentation and tutorials for Model Builder, ML.NET CLI, and AutoML API.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
If you are new to GitHub here is a detailed help source on getting involved with development on GitHub.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.