SynapseML

microsoftMIT活跃维护

基于 Spark 的分布式机器学习库,把 LightGBM、深度学习、认知服务等算法封装成易用 API,让大数据场景下的训练和推理可以直接在集群上跑。

Simple and Distributed Machine Learning Python Library porting ML algorithms for Spark

v1.1.3发布于 2026-04-07 04:30 UTC5,254star869fork同步于 2026-11-10 05:35 UTC

怎么上手

由 README 提炼,执行前请确认
pip install synapseml==1.1.3
spark-shell --repositories "https://mmlspark.blob.core.windows.net/maven" --packages "com.microsoft.azure:synapseml_2.12:1.1.3"
硬件要求按 README 说明

README 未说明具体显存或 GPU 型号要求;运行依赖 Apache Spark 集群(单机或多机均可),需按 Spark 版本匹配 Scala 版本。

有 Docker 镜像
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 Apache Spark 的可扩展机器学习库,把文本、视觉、异常检测等模型接入现有 Spark 流水线

基于 Spark 的分布式机器学习库,把 LightGBM、深度学习、认知服务等算法封装成易用 API,让大数据场景下的训练和推理可以直接在集群上跑。

核心能力

  • 提供与 SparkML/MLLib 一致的分布式 API,可直接嵌入现有 Spark 作业
  • 覆盖文本分析、计算机视觉、异常检测、深度学习等多类任务
  • 支持 Python、R、Scala、Java、.NET 多语言调用
  • 可运行在单机、多机及弹性伸缩集群上训练与评估模型
  • 抽象多种数据库、文件系统与云存储,简化数据接入

容易踩的坑

从 PyPI 安装 synapseml 只装 Python 包装层,不会带上 JVM 构件,需另行配置 spark.jars.packages;Spark 3.5 用 Scala 2.12,Spark 4.0/4.1 用 Scala 2.13,版本错配会报类不存在;Spark 4 构件需额外配置 mmlspark.blob.core.windows.net/maven 仓库。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v1.1.3
  1. v1.1.3最新正式版2026-04-07 · 2026-04-07 04:30 UTC

    What's Changed

  2. v1.1.0SynapseML v1.1.02025-11-20 · 2025-11-20 03:51 UTC
    查看更新说明

    We are excited to announce the release of SynapseML v1.1 marking a host of powerful new features introduced since the initial v1.0 release. SynapseML is an open-source library that aims to streamline the development of massively scalable machine learning pipelines. It unifies several existing ML Frameworks and new Microsoft algorithms in a single, scalable API that is usable across Python, R, Scala, and Java. SynapseML is usable from any Apache Spark platform with first class enterprise support on Microsoft Fabric.

    Highlights

    Microsoft FabricAI FunctionsOneLake
    Build and operationalize distributed ML with SynapseML in FabricApply Pandas and Spark LLM transformations with one line of codeAutomatically derive AI insights for unstructured data in OneLake
    Build Your First ModelExplore AI FunctionsLearn More
    Hugging FaceAzure AI Foundry
    Use open source models hosted on Hugging FaceRun Azure AI Foundry models in your notebook
    Try an ExampleView Notebook

    More Hightlights

    Spark 3.5 Support – In this version we transitioned to Spark 3.5 as our main Spark platform.

    OpenAI Ecosystem – Comprehensive improvements including global parameter defaults, GPT-4 enablement, custom endpoints/headers, GPU-accelerated embeddings with KNN, and fine-grained control over model parameters (top_p, seed, responseFormat, temperature).

    ML Innovation – HuggingFaceCausalLM transformer for distributed language model evaluation, custom embedder support, and synthetic difference-in-differences causal inference module.

    Platform features – Spark Native OneLake support; MSI for Azure Storage; OpenAITranslate transformer.

    AI Functions in Data Wrangler on Fabric – AI Functions built into Data Wrangler in Fabric allow you to apply LLM-powered operations to your dataframe without writing a single line of code.

    New Features

    Documentation 📚

  3. v1.0.14-spark3.5SynapseML v1.0.14 Spark 3.5pre-release2025-09-16 · 2025-09-16 06:47 UTC

    这个版本没有写更新说明。

  4. v1.0.14SynapseML v1.0.142025-09-16 · 2025-09-16 06:45 UTC
    查看更新说明

    Changes:

    • 123ead27e4ce8d60f24b7862f617c98c79589e14 chore: bump to v1.0.14 (#2418)
    • 1ceb3b1ea46f584c0e01fbf6c1610ecfda49ebd1 chore: update OpenAIDefaults (#2415)
    • 26220da27855026f20b3f7f622e988d16208237b feat: add aifoundry to openai prompt (#2404)
    • aac2ed6b56d7b73b48d1793bf563fcfb98da325e fix: fix error handling in networking layer (#2412)
    • 7c2f22a0a3761fc7c2c91d11f5a532a52385b248 feat: Add top_p and seed params to OpenAIDefaults (#2410)
    • a9133aa3293bde93675847d98ff59796183a7c23 noop commit to Stop library releases in build
    • a394061eade46b7ba8374a9140fdae9f5412d77c chore: Bump library to version to v1.0.13 (#2405)
    • 85a66877da13de36b2ff324322c77bb25b99b5ed chore: fix propagation of fabric telemetry (#2403)
    • 298c7ed29c3fec7b8daf4be190295f466e9bb5ee chore: Add devcontainer configuration for vscode and Copilot (#2400)
    • 873884d4e4bf86ddda86489575970803980c76e9 feat: Add AIFoundaryChatCompletion (#2398)
    • 83ebb5a868591f493a25b27ebb544828a98fd93f Update README.md

    This list of changes was auto generated.

  5. v1.0.13SynapseML v1.0.132025-08-04 · 2025-08-04 19:05 UTC
    查看更新说明

    Changes:

    • a394061eade46b7ba8374a9140fdae9f5412d77c chore: Bump library to version to v1.0.13 (#2405)
    • 85a66877da13de36b2ff324322c77bb25b99b5ed chore: fix propagation of fabric telemetry (#2403)
    • 298c7ed29c3fec7b8daf4be190295f466e9bb5ee chore: Add devcontainer configuration for vscode and Copilot (#2400)
    • 873884d4e4bf86ddda86489575970803980c76e9 feat: Add AIFoundaryChatCompletion (#2398)
    • 83ebb5a868591f493a25b27ebb544828a98fd93f Update README.md

    This list of changes was auto generated.

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    SynapseML

    Synapse Machine Learning

    SynapseML (previously known as MMLSpark) is an open-source library that simplifies the creation of massively scalable machine learning (ML) pipelines. SynapseML provides simple, composable, and distributed APIs for a wide variety of different machine learning tasks such as text analytics, vision, anomaly detection, and many others. SynapseML is built on the Apache Spark distributed computing framework and shares the same API as the SparkML/MLLib library, allowing you to seamlessly embed SynapseML models into existing Apache Spark workflows.

    With SynapseML, you can build scalable and intelligent systems to solve challenges in domains such as anomaly detection, computer vision, deep learning, text analytics, and others. SynapseML can train and evaluate models on single-node, multi-node, and elastically resizable clusters of computers. This lets you scale your work without wasting resources. SynapseML is usable across Python, R, Scala, Java, and .NET. Furthermore, its API abstracts over a wide variety of databases, file systems, and cloud data stores to simplify experiments no matter where data is located.

    SynapseML publishes runtime-specific JVM artifacts: Spark 3.5 uses Scala 2.12, while Spark 4.0 and 4.1 use Scala 2.13. See the installation matrix before selecting a Maven coordinate.

    TopicsLinks
    BuildBuild Status codecov Code style: black
    VersionVersion Release Notes Snapshot Version
    DocsWebsite Scala Docs PySpark Docs Academic Paper
    SupportGitter Mail
    BinderBinder
    UsageDownloads

    Features

    Vowpal Wabbit on SparkThe Cognitive Services for Big DataLightGBM on SparkSpark Serving
    Fast, Sparse, and Effective Text AnalyticsLeverage the Microsoft Cognitive Services at Unprecedented Scales in your existing SparkML pipelinesTrain Gradient Boosted Machines with LightGBMServe any Spark Computation as a Web Service with Sub-Millisecond Latency
    HTTP on SparkONNX on SparkResponsible AISpark Binding Autogeneration
    An Integration Between Spark and the HTTP Protocol, enabling Distributed Microservice OrchestrationDistributed and Hardware Accelerated Model Inference on SparkUnderstand Opaque-box Models and Measure Dataset BiasesAutomatically Generate Spark bindings for PySpark and SparklyR
    Isolation Forest on SparkCyberMLConditional KNN
    Distributed Nonlinear Outlier DetectionMachine Learning Tools for Cyber SecurityScalable KNN Models with Conditional Queries

    Documentation and Examples

    For quickstarts, documentation, demos, and examples please see our website.

    Setup and installation

    SynapseML installation has two parts: the language wrapper and the JVM artifacts loaded by Spark. Installing synapseml from PyPI does not add the JVM artifacts. A Python wrapper can import successfully while its JVM class is missing; using a _2.12 artifact with Spark 4 can produce errors such as LightGBMClassifier does not exist in the JVM.

    Choose one complete published build from the Spark runtime. master is the canonical Spark 3.5 development line; Spark 4.0 and Spark 4.1 are maintained on their corresponding branches.

    Code lineSpark runtimeScalaPython baselineRelease tagPython packageMaven coordinate
    masterSpark 3.5.x2.12Python 3.11v1.1.3synapseml==1.1.3com.microsoft.azure:synapseml_2.12:1.1.3
    spark4.0Spark 4.0.1+ (<4.1)2.13Python 3.12v1.1.3-spark4.0synapseml==1.1.3com.microsoft.azure:synapseml_2.13:1.1.3-spark4.0
    spark4.1Spark 4.1.x2.13Python 3.13v1.1.3-spark4.1synapseml==1.1.3com.microsoft.azure:synapseml_2.13:1.1.3-spark4.1

    Always configure https://mmlspark.blob.core.windows.net/maven, where the Spark 4 artifacts are published. See the full installation guide for platform-specific details.

    Latest master snapshot

    The latest successful master build targets Spark 3.5 and Scala 2.12. This copy-ready command reads the current snapshot version published by CI and starts Spark with that exact JVM build:

    MASTER_VERSION="$(
      curl -fsSL https://mmlspark.blob.core.windows.net/icons/badges/master_version3.svg |
        sed -n 's/.*aria-label="master version: \([^"]*\)".*/\1/p'
    )"
    test -n "$MASTER_VERSION"
    spark-shell \
      --repositories "https://mmlspark.blob.core.windows.net/maven" \
      --packages "com.microsoft.azure:synapseml_2.12:${MASTER_VERSION}"
    

    The PyPI package contains released Python wrappers. If you need Python APIs that are new on master, build the matching wheel from source.

    First select the correct platform that you are installing SynapseML into:

    Microsoft Fabric

    In Microsoft Fabric notebooks SynapseML is already installed. The following copy-ready override targets a Spark 4.1 / Scala 2.13 runtime:

    %%configure -f
    {
      "name": "synapseml",
      "conf": {
          "spark.jars.packages": "com.microsoft.azure:synapseml_2.13:1.1.3-spark4.1",
          "spark.jars.repositories": "https://mmlspark.blob.core.windows.net/maven",
          "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.13,org.scalactic:scalactic_2.13,org.scalatest:scalatest_2.13,com.fasterxml.jackson.core:jackson-databind",
          "spark.yarn.user.classpath.first": "true",
          "spark.sql.parquet.enableVectorizedReader": "false"
      }
    }
    

    Synapse Analytics

    Current Azure Synapse pools use Spark 3.5. Place the following in the first cell of your notebook:

    %%configure -f
    {
      "name": "synapseml",
      "conf": {
          "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:1.1.3",
          "spark.jars.repositories": "https://mmlspark.blob.core.windows.net/maven",
          "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind",
          "spark.yarn.user.classpath.first": "true",
          "spark.sql.parquet.enableVectorizedReader": "false"
      }
    }
    

    To install at the pool level instead of the notebook level add the spark properties listed above to the pool configuration.

    Databricks

    To install SynapseML on the Databricks cloud, create a new library from Maven coordinates in your workspace.

    Use one of these exact Maven coordinates:

    • Spark 4.1 / Scala 2.13: com.microsoft.azure:synapseml_2.13:1.1.3-spark4.1
    • Spark 4.0 / Scala 2.13: com.microsoft.azure:synapseml_2.13:1.1.3-spark4.0
    • Spark 3.5 / Scala 2.12: com.microsoft.azure:synapseml_2.12:1.1.3

    Add the resolver https://mmlspark.blob.core.windows.net/maven, attach the library to the target cluster, and restart it before importing synapse.ml.

    You can use SynapseML in both your Scala and PySpark notebooks. To get started with our example notebooks import the following databricks archive:

    https://mmlspark.blob.core.windows.net/dbcs/SynapseMLExamplesv1.1.3.dbc

    Python Standalone

    Choose exactly one complete runtime variant below, then start Spark with that variant's JVM artifact.

    Spark 4.1 / Python 3.13

    python -m pip install "synapseml==1.1.3" "pyspark>=4.1,<4.2"
    

    Spark 4.0 / Python 3.12

    python -m pip install "synapseml==1.1.3" "pyspark>=4.0.1,<4.1"
    

    Spark 3.5 / Python 3.11

    python -m pip install "synapseml==1.1.3" "pyspark>=3.5,<3.6"
    
    from pyspark.sql import SparkSession
    
    # Spark 4.1. Select the coordinate matching the PySpark command used above.
    synapseml_coordinate = "com.microsoft.azure:synapseml_2.13:1.1.3-spark4.1"
    # Spark 4.0:
    # synapseml_coordinate = "com.microsoft.azure:synapseml_2.13:1.1.3-spark4.0"
    # Spark 3.5:
    # synapseml_coordinate = "com.microsoft.azure:synapseml_2.12:1.1.3"
    
    spark = (
        SparkSession.builder.appName("MyApp")
        .config("spark.jars.packages", synapseml_coordinate)
        .config(
            "spark.jars.repositories",
            "https://mmlspark.blob.core.windows.net/maven",
        )
        .getOrCreate()
    )
    import synapse.ml
    

    Spark Submit

    SynapseML can be conveniently installed on existing Spark clusters via the --packages option. Each example below is independently copyable.

    # Spark 4.1
    pyspark --repositories "https://mmlspark.blob.core.windows.net/maven" \
      --packages "com.microsoft.azure:synapseml_2.13:1.1.3-spark4.1"
    
    # Spark 4.0
    pyspark --repositories "https://mmlspark.blob.core.windows.net/maven" \
      --packages "com.microsoft.azure:synapseml_2.13:1.1.3-spark4.0"
    
    # Spark 3.5
    pyspark --repositories "https://mmlspark.blob.core.windows.net/maven" \
      --packages "com.microsoft.azure:synapseml_2.12:1.1.3"
    

    AWS EMR and pre-provisioned clusters

    --packages is supported for production Spark jobs as well as notebooks. For example, use it with spark-submit on EMR rather than downloading a single JAR manually:

    spark-submit \
      --repositories "https://mmlspark.blob.core.windows.net/maven" \
      --packages "com.microsoft.azure:synapseml_2.12:1.1.3" \
      job.py
    

    The top-level synapseml_2.12 artifact is an aggregate artifact: its POM references the SynapseML module JARs and their runtime dependencies, but the artifact JAR itself does not contain implementation classes. In particular, IsolationForest is in synapseml-core_2.12 and also requires the LinkedIn Isolation Forest dependency. Spark resolves this complete dependency closure when --packages or spark.jars.packages is used.

    If a cluster image or pre-installed environment must be manually provisioned, use a Maven-compatible dependency resolver during setup to install the complete runtime dependency closure for the selected coordinate, and verify that the JARs are added to both the driver and executor JVM classpaths (for example via spark.driver.extraClassPath and spark.executor.extraClassPath or standard cluster classpath configuration).

    Manual JAR placement is error-prone:

    • Merely having a JAR localized or added to Python/YARN/Livy search paths does not ensure that its classes are loaded into the Spark driver's JVM classpath.
    • Copying only the aggregate artifact or omitting transitive dependencies will cause ClassNotFoundException or NoClassDefFoundError (often surfaced via Py4J as <class> does not exist in the JVM) even if the Python module imports successfully.

    Always pin a single coordinate matching the cluster's Spark and Scala versions.

    SBT

    Choose the dependency matching your Spark runtime.

    Spark 4.1

    resolvers += "SynapseML" at "https://mmlspark.blob.core.windows.net/maven"
    libraryDependencies +=
      "com.microsoft.azure" % "synapseml_2.13" % "1.1.3-spark4.1"
    

    Spark 4.0

    resolvers += "SynapseML" at "https://mmlspark.blob.core.windows.net/maven"
    libraryDependencies +=
      "com.microsoft.azure" % "synapseml_2.13" % "1.1.3-spark4.0"
    

    Spark 3.5

    resolvers += "SynapseML" at "https://mmlspark.blob.core.windows.net/maven"
    libraryDependencies +=
      "com.microsoft.azure" % "synapseml_2.12" % "1.1.3"
    

    Apache Livy and HDInsight

    To install SynapseML from within a Jupyter notebook served by Apache Livy, the following Spark 3.5 / Scala 2.12 configure magic can be used. You will need to start a new session after this configure cell is executed.

    Excluding certain packages from the library may be necessary due to current issues with Livy 0.5.

    %%configure -f
    {
        "name": "synapseml",
        "conf": {
            "spark.jars.packages": "com.microsoft.azure:synapseml_2.12:1.1.3",
            "spark.jars.repositories": "https://mmlspark.blob.core.windows.net/maven",
            "spark.jars.excludes": "org.scala-lang:scala-reflect,org.apache.spark:spark-tags_2.12,org.scalactic:scalactic_2.12,org.scalatest:scalatest_2.12,com.fasterxml.jackson.core:jackson-databind"
        }
    }
    

    Docker

    The easiest way to evaluate SynapseML is via our pre-built Docker container. To do so, run the following command:

    docker run -it -p 8888:8888 -e ACCEPT_EULA=yes mcr.microsoft.com/mmlspark/release jupyter notebook
    

    Navigate to http://localhost:8888/ in your web browser to run the sample notebooks. See the documentation for more on Docker use.

    To read the EULA for using the docker image, run docker run -it -p 8888:8888 mcr.microsoft.com/mmlspark/release eula

    R

    To try out SynapseML using the R autogenerated wrappers see our instructions. Note: This feature is still under development and some necessary custom wrappers may be missing.

    Building from source

    SynapseML has recently transitioned to a new build infrastructure. For detailed developer docs, please see the Developer Readme.

    If you are an existing SynapseML developer, you will need to reconfigure your development setup. We now support platform-independent development and better integrate with IntelliJ and SBT. If you encounter issues, please reach out to our support email!

    Papers

    Learn More

    Contributing & feedback

    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.

    See CONTRIBUTING.md for contribution guidelines.

    To give feedback and/or report an issue, open a GitHub Issue.

    Other relevant projects

    Apache®, Apache Spark, and Spark® are either registered trademarks or trademarks of the Apache Software Foundation in the United States and/or other countries.