从自然语言生成 ML 模型的开源工具 Plexe
Plexe 项目将 prompt 转化为可用 ML 模型,简化非专业开发者的机器学习流程。
Plexe 项目将 prompt 转化为可用 ML 模型,简化非专业开发者的机器学习流程。
使用自然语言构建机器学习模型。
快速入门 | 功能特性 | 安装 | 文档
plexe 让你只需用自然语言描述需求,就能创建机器学习模型。你只要说明想实现什么、提供一个数据集,AI 驱动的系统便会通过自动化的 Agent 工作流,构建出一个功能完整的模型。此外,plexe 也提供托管式云服务。
在 YouTube 上观看演示:
pip install plexe
export OPENAI_API_KEY=<your-key>
export ANTHROPIC_API_KEY=<your-key>
提供一个表格数据集(Parquet、CSV、ORC 或 Avro),以及一段描述目标的自然语言:
python -m plexe.main \
--train-dataset-uri data.parquet \
--intent "predict whether a passenger was transported" \
--max-iterations 5
from plexe.main import main
from pathlib import Path
best_solution, metrics, report = main(
intent="predict whether a passenger was transported",
data_refs=["train.parquet"],
max_iterations=5,
work_dir=Path("./workdir"),
)
print(f"Performance: {best_solution.performance:.4f}")
该系统在一个包含 6 个阶段的工作流中使用了 14 个专用 AI Agent,用于:
只需一次调用,即可构建完整模型。针对表格数据,Plexe 支持 XGBoost、CatBoost、LightGBM、Keras 和 PyTorch:
best_solution, metrics, report = main(
intent="predict house prices based on property features",
data_refs=["housing.parquet"],
max_iterations=10, # Search iterations
allowed_model_types=["xgboost"], # Or let plexe choose
enable_final_evaluation=True, # Evaluate on held-out test set
)
运行 python -m plexe.main --help 查看所有 CLI 选项。
输出结果是位于 work_dir/model/ 的一个自包含模型包(同时会归档为 model.tar.gz)。该模型包不依赖 plexe——使用 plexe 构建模型,然后将它部署到任何地方:
model/
├── artifacts/ # Trained model + feature pipeline (pickle)
├── src/ # Inference predictor, pipeline code, training template
├── schemas/ # Input/output JSON schemas
├── config/ # Hyperparameters
├── evaluation/ # Metrics and detailed analysis reports
├── model.yaml # Model metadata
└── README.md # Usage instructions with example code
运行 plexe 时,所有内容都已预先配置完成——包括 PySpark、Java 和全部依赖项。项目还提供了一个 Makefile,用于执行常见工作流:
make build # Build the Docker image
make test-quick # Fast sanity check (~1 iteration)
make run-titanic # Run on Spaceship Titanic dataset
docker run --rm \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
-v $(pwd)/data:/data -v $(pwd)/workdir:/workdir \
plexe:py3.12 python -m plexe.main \
--train-dataset-uri /data/dataset.parquet \
--intent "predict customer churn" \
--work-dir /workdir \
--spark-mode local
项目根目录中的 config.yaml 会被自动挂载。此外还提供了 Databricks Connect 镜像:docker build --target databricks .。
你可以通过配置文件自定义 LLM 路由、搜索参数、Spark 设置等内容:
# config.yaml
max_search_iterations: 5
allowed_model_types: [xgboost, catboost]
spark_driver_memory: "4g"
hypothesiser_llm: "openai/gpt-5-mini"
feature_processor_llm: "anthropic/claude-sonnet-4-5-20250929"
CONFIG_FILE=config.yaml python -m plexe.main ...
所有可用选项请参阅 config.yaml.template。
Plexe 通过 LiteLLM 使用 LLM,因此你可以使用 LiteLLM 支持的任意 Provider:
# Route different agents to different providers
hypothesiser_llm: "openai/gpt-5-mini"
feature_processor_llm: "anthropic/claude-sonnet-4-5-20250929"
model_definer_llm: "ollama/llama3"
Plexe 理论上可以与大多数 LiteLLM Provider 配合使用,但我们目前只会主动测试 openai/* 和 anthropic/* 模型。如果你在使用其他 Provider 时遇到问题,请告诉我们。
使用内置的 Streamlit Dashboard,可以将实验结果、搜索树和评估报告可视化:
python -m plexe.viz --work-dir ./workdir
通过 WorkflowIntegration 接口,可以将 plexe 接入自定义的存储、追踪和部署基础设施:
main(intent="...", data_refs=[...], integration=MyCustomIntegration())
完整接口请参阅 plexe/integrations/base.py。
pip install plexe # Core (XGBoost, Keras, scikit-learn)
你可以按框架或任务分组添加可选依赖:
catboost、lightgbm、pytorchtabular(CatBoost + LightGBM)、vision(PyTorch)pyspark、awspip install "plexe[tabular,pyspark]" # tabular stack + local PySpark
pip install "plexe[pytorch,aws]" # explicit framework + S3 support
要求 Python >= 3.10, < 3.13。
export OPENAI_API_KEY=<your-key>
export ANTHROPIC_API_KEY=<your-key>
所有受支持的 Provider 请参阅 LiteLLM providers。
完整文档请访问 docs.plexe.ai。
贡献指南请参阅 CONTRIBUTING.md。欢迎加入我们的 Discord,与团队交流。
如果你在研究中使用了 Plexe,请按以下格式引用:
@software{plexe2025,
author = {De Bernardi, Marcello AND Dubey, Vaibhav},
title = {Plexe: Build machine learning models using natural language.},
year = {2025},
publisher = {GitHub},
howpublished = {\url{https://github.com/plexe-ai/plexe}},
}