FLAML: A Fast Library for Automated Machine Learning and Tuning
FLAML is an innovative and easy-to-use library designed to automate machine learning and AI operations efficiently. Developed especially for handling large language models and machine learning models, FLAML offers solutions that improve optimization and automate workflows effectively.
Key Features
-
AutoML and Hyperparameter Tuning: FLAML enables users to automate complex machine learning tasks such as classification and regression. It quickly identifies high-quality models from user-provided data, even when computational resources are limited, making it both economical and fast.
-
GPT-X Application Support: The library simplifies the development of advanced applications with multi-agent conversations. FLAML offers tools for orchestration, automation, and optimization of these workflows, significantly enhancing the performance and mitigating the weaknesses of GPT-X models.
-
Integration with Tools and Support for Multiple Agents: As part of its feature-rich offerings, FLAML has introduced various new estimators and now supports Python 3.11. It boasts seamless integration with MLflow, thanks to contributions from Microsoft’s Fabric product team.
Installation
To get started with FLAML, ensure you have Python version 3.8 or newer. You can easily install FLAML using pip:
pip install flaml
Optional dependencies can be installed per your requirements to unlock additional features. For instance, to use the autogen
package:
pip install "flaml[autogen]"
Getting Started
-
AutoGen for GPT-X: FLAML’s
autogen
package allows users to build next-gen GPT-X applications effortlessly, employing a conversation framework among multiple agents. These agents integrate language models, tools, and humans, allowing them to autonomously or cooperatively perform tasks with human feedback. For example:from flaml import autogen assistant = autogen.AssistantAgent("assistant") user_proxy = autogen.UserProxyAgent("user_proxy") user_proxy.initiate_chat( assistant, message="Show me the YTD gain of 10 largest technology companies as of today.", )
-
Efficient Hyperparameter Tuning: Users can perform tuning on language model generations with their specific success metrics and budget constraints.
config, analysis = autogen.Completion.tune( data=tune_data, metric="success", mode="max", eval_func=eval_func, inference_budget=0.05, optimization_budget=3, num_samples=-1, )
-
Scikit-learn Style Estimator: The library can be used as an estimator similar to scikit-learn for quick setup and execution of machine learning tasks.
from flaml import AutoML automl = AutoML() automl.fit(X_train, y_train, task="classification")
-
Customizable Learners: FLAML allows the use of different models such as XGBoost, LightGBM, and Random Forest with customized learner settings, providing a fast hyperparameter tuning tool.
automl.fit(X_train, y_train, task="classification", estimator_list=["lgbm"])
-
Generic Hyperparameter Tuning: You can conduct tuning for custom functions, supporting a wide range of needs.
from flaml import tune tune.run(evaluation_function, config={…}, low_cost_partial_config={…}, time_budget_s=3600)
-
Zero-shot AutoML: FLAML supports zero-shot AutoML, enabling efficient hyperparameter configuration for models like LightGBM and XGBoost.
from flaml.default import LGBMRegressor estimator = LGBMRegressor() estimator.fit(X_train, y_train)
Documentation and Support
Detailed documentation for FLAML can be accessed here, including research articles, blog posts, and contributions guides. Additionally, users can interact and seek assistance through FLAML’s Discord community.
Contributing
FLAML welcomes contributors to help enhance the library and build broader support and applications. Interested individuals can get involved by following guidelines available in the contributing section of the documentation.
FLAML presents a robust framework for automating machine learning tasks, streamlining processes for developers and data scientists to achieve efficient and high-performance AI operations.