postgresml

App Listed Dormant

Postgres with GPUs for ML/AI apps.

Downloads
915
Dependents
Not applicable
Stars
6,830
Forks
363
Contributors
45
Commits
1,814
Latest release
1.1.1 ·

About

From the project README ·

Postgres + GPUs for ML/AI applications.

| Documentation | Blog | Discord |


Why do ML/AI in Postgres?

Data for ML & AI systems is inherently larger and more dynamic than the models. It's more efficient, manageable and reliable to move models to the database, rather than constantly moving data to the models.

  • Getting started
    • PostgresML Cloud
    • Self-hosted
    • Ecosystem
  • Large Language Models
    • Hugging Face
    • OpenAI and Other Providers
  • RAG
    • Chunk
    • Embed
    • Rank
    • Transform
  • Machine Learning

Architecture

PostgresML is a powerful Postgres extension that seamlessly combines data storage and machine learning inference within your database. By integrating these functionalities, PostgresML eliminates the need for separate systems and data transfers, enabling you to perform ML operations directly on your data where it resides.

Read the full README

Features at a glance

  • In-Database ML/AI: Run machine learning and AI operations directly within PostgreSQL
  • GPU Acceleration: Leverage GPU power for faster computations and model inference
  • Large Language Models: Integrate and use state-of-the-art LLMs from Hugging Face
  • RAG Pipeline: Built-in functions for chunking, embedding, ranking, and transforming text
  • Vector Search: Efficient similarity search using pgvector integration
  • Diverse ML Algorithms: 47+ classification and regression algorithms available
  • High Performance: 8-40X faster inference compared to HTTP-based model serving
  • Scalability: Support for millions of transactions per second and horizontal scaling
  • NLP Tasks: Wide range of natural language processing capabilities
  • Security: Enhanced data privacy by keeping models and data together
  • Seamless Integration: Works with existing PostgreSQL tools and client libraries

Getting started

The only prerequisites for using PostgresML is a Postgres database with our open-source pgml extension installed.

PostgresML Cloud

Our serverless cloud is the easiest and recommend way to get started.

Sign up for a free PostgresML account. You'll get a free database in seconds, with access to GPUs and state of the art LLMs.

Self-hosted

If you don't want to use our cloud you can self host it.

docker run \
    -it \
    -v postgresml_data:/var/lib/postgresql \
    -p 5433:5432 \
    -p 8000:8000 \
    ghcr.io/postgresml/postgresml:2.10.0 \
    sudo -u postgresml psql -d postgresml

For more details, take a look at our Quick Start with Docker documentation.

Ecosystem

We have a number of other tools and libraries that are specifically designed to work with PostgreML. Remeber PostgresML is a postgres extension running inside of Postgres so you can connect with psql and use any of your favorite tooling and client libraries like psycopg to connect and run queries.

PostgresML Specific Client Libraries:

  • Korvus - Korvus is a Python, JavaScript, Rust and C search SDK that unifies the entire RAG pipeline in a single database query.
  • postgresml-django - postgresml-django is a Python module that integrates PostgresML with Django ORM.

Recommended Postgres Poolers:

  • pgcat - pgcat is a PostgreSQL pooler with sharding, load balancing and failover support.

Large language models

PostgresML brings models directly to your data, eliminating the need for costly and time-consuming data transfers. This approach significantly enhances performance, security, and scalability for AI-driven applications.

By running models within the database, PostgresML enables:

  • Reduced latency and improved query performance
  • Enhanced data privacy and security
  • Simplified infrastructure management
  • Seamless integration with existing database operations

Hugging Face

PostgresML supports a wide range of state-of-the-art deep learning architectures available on the Hugging Face model hub. This integration allows you to:

  • Access thousands of pre-trained models
  • Utilize cutting-edge NLP, computer vision, and other AI models
  • Easily experiment with different architectures

OpenAI and other providers

While cloud-based LLM providers offer powerful capabilities, making API calls from within the database can introduce latency, security risks, and potential compliance issues. Currently, PostgresML does not directly support integration with remote LLM providers like OpenAI.

RAG

PostgresML transforms your PostgreSQL database into a powerful vector database for Retrieval-Augmented Generation (RAG) applications. It leverages pgvector for efficient storage and retrieval of embeddings.

Our RAG implementation is built on four key SQL functions:

  1. Chunk: Splits text into manageable segments
  2. Embed: Generates vector embeddings from text using pre-trained models
  3. Rank: Performs similarity search on embeddings
  4. Transform: Applies language models for text generation or transformation

For more information on using RAG with PostgresML see our guide on Unified RAG.

Chunk

The pgml.chunk function chunks documents using the specified splitter. This is typically done before embedding.

pgml.chunk(
    splitter TEXT,    -- splitter name
    text TEXT,        -- text to embed
    kwargs JSON       -- optional arguments (see below)
)

See pgml.chunk docs for more information.

Embed

The pgml.embed function generates embeddings from text using in-database models.

pgml.embed(
    transformer TEXT,
    "text" TEXT,
    kwargs JSONB
)

See pgml.embed docs for more information.

Rank

The pgml.rank function uses Cross-Encoders to score sentence pairs.

This is typically used as a re-ranking step when performing search.

pgml.rank(
    transformer TEXT,
    query TEXT,
    documents TEXT[],
    kwargs JSONB
)

Docs coming soon.

Transform

The pgml.transform function can be used to generate text.

SELECT pgml.transform(
    task   => TEXT OR JSONB,     -- Pipeline initializer arguments
    inputs => TEXT[] OR BYTEA[], -- inputs for inference
    args   => JSONB              -- (optional) arguments to the pipeline.
)

See pgml.transform docs for more information.

See our Text Generation guide for a guide on generating text.

Machine learning

Some highlights:

Training a classification model

Training

SELECT * FROM pgml.train(
    'Handwritten Digit Image Classifier',
    algorithm => 'xgboost',
    'classification',
    'pgml.digits',
    'target'
);

Inference

SELECT pgml.predict(
    'My Classification Project',
    ARRAY[0.1, 2.0, 5.0]
) AS prediction;

NLP

The pgml.transform function exposes a number of available NLP tasks.

Available tasks are:

Runs on
GPU support unknown
What shows it
  • no dependency or feature matches a backend row
Native code
None found
  • No native code found
Python bindings
Has Python bindings
  • pgml needs Python only with feature python
License
MIT

Compare with similar projects

Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.

postgresml beside the projects that share a topic with it
ProjectDownloadsDependentsStarsLatest releaseRuns on (GPU)Native codeLicense
postgresml This page App Listed Dormant

Postgres with GPUs for ML/AI apps.

Python bindings

915 downloads over 30 days Not applicable 6,830 1.1.1 GPU support unknown No native code found MIT
tch-rs Featured

Rust wrappers for the PyTorch C++ api (libtorch).

Python bindings

Also in Run and serve models.

1,190,464 downloads over 30 days 124 5,518 0.26.0 CUDA Binds native code: tch, torch-sys. Build uses a native toolchain: cc Apache-2.0 OR MIT
mlx-rs Featured

Unofficial rust wrapper for Apple's mlx machine learning library.

Also in Run and serve models.

33,398 downloads over 30 days 36 389 0.34.0 Metal Binds native code: mach-sys, mlx, mlx-sys. Build uses a native toolchain: bindgen, cc, cmake Apache-2.0 OR MIT
aprender Listed

Next-generation ML framework in pure Rust — `cargo install aprender` for the `apr` CLI

Also in Train models.

15,442 downloads over 30 days 31 140 0.72.3 CUDA, WebGPU Binds native code: libsqlite3-sys, zstd-sys, tree-sitter (feature full), alsa-sys (feature audio-alsa), nvml-wrapper-sys (feature nvml) and 1 more. Build uses a native toolchain: bindgen (feature bindgen) MIT
dfdx Listed Dormant

Ergonomic auto differentiation in Rust, with pytorch like apis.

Also in Train models.

2,369 downloads over 30 days 4 1,944 0.13.0 CUDA No native code found Apache-2.0 OR MIT
boostr Listed

ML framework on numr for training and inference on CPU, CUDA and WebGPU: attention, quantization, inference scheduling and distributed execution. Models include LLaMA, Mamba2, Qwen3.5, Whisper, Kokoro, VITS, VoxCPM2, Silero VAD, CLAP and super-resolution. Loads SafeTensors and GGUF.

Also in Run and serve models.

1,265 downloads over 30 days 7 20 0.11.2 CUDA, WebGPU Binds native code: ring (feature distributed) Apache-2.0
Why ListedNo archive, New or Featured rule places it, so it is Listed.

What it lacks for Featured

What else the check found

  • The last activity is on 1 Jul 2025, 496 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
  • The oldest outside issue waits 881 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule

Not measured: Unpatched vulnerabilities past the grace window.

Exact rules: Listed, Featured app. The check on applied thresholds version 9.

Every rule outcome, as the check records it
  • expected-interval: app: E = 365 days
  • dormancy: last activity 2025-07-01, 496 days ago, E = 365: dormant
  • rot: oldest unanswered issue 881 days (limit 270), no maintainer reply in 365 days
  • featured: not featured: dormant and not stable
  • listed: listed: no archive, new or featured rule applies

Measurements and sources

Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.

Sources6 sources
Adoption0 binary downloads per release4 not measured
Adoption measurements
SignalValueSourceFetchedCounts
Active dependentsNot measuredYes
New dependents (365 days)Not measuredYes
Peak active dependentsNot measuredYes
Active dependents as a share of the peakNot measuredYes
Binary downloads per release0GitHub releasesYes
MaintenanceLatest human commit: 16 months ago4 not measured
Maintenance measurements
SignalValueSourceFetchedCounts
Latest human commit2025-07-01GitHub repositoryYes
Latest release2025-01-16GitHub releasesYes
First release2024-06-03crates.io database dumpYes
Latest version1.1.1crates.io database dumpNo
Days the oldest outside issue waits for a reply881GitHub repositoryYes
Maintainer replies over 365 days0GitHub repositoryYes
Repository archivedfalseGitHub repositoryYes
Repository gonefalseGitHub repositoryYes
Release commit or manifest in the repotruecrates.io packageNo
Published docsNot measuredYes
Latest release fails cargo checkNot measuredYes
Build check dateNot measuredYes
Build check toolchainNot measuredYes
SecurityNot measured
Security measurements
SignalValueSourceFetchedCounts
Unpatched vulnerabilities past the grace windowNot measuredYes
RustSec unmaintained advisoryNot measuredYes
Deprecation noticeNot measuredYes
Deprecated requirementNot measuredYes
Distribution2 releases, 915 downloads over 30 days6 not measured
Distribution measurements
SignalValueSourceFetchedCounts
Releases2crates.io database dumpNo
Downloads over 30 days915crates.io database dumpNo
Binary downloads over the last 3 releases0GitHub releasesYes
Homebrew installs on request over 365 daysNot measuredYes
Repology repository familiesNot measuredYes
Docker pull growth over 90 daysNot measuredYes
Docker pulls at the growth baselineNot measuredYes
Every version a prereleasefalsecrates.io database dumpYes
Every version 0.0.xfalsecrates.io database dumpYes
Every version yankedNot measuredYes
Crate deleted from crates.ioNot measuredYes
Repository6,830 stars, 363 forks, 45 contributors, 1,814 commits. Stars alone never qualify a project.
Repository measurements
SignalValueSourceFetchedCounts
GitHub stars6830GitHub repositoryYes — one part of the repository route
GitHub forks363GitHub repositoryYes — one part of the repository route
Contributors with a GitHub account45GitHub contributorsYes — one part of the repository route
Commits on the default branch1814GitHub repositoryNo
Repository's main crate left out of the entrynonecrates.io database dumpYes
Facts that never count
Facts that never count measurements
SignalValueSourceFetchedCounts
LicenseMITcrates.io database dumpNo
Runs on, from listed crates and their direct dependenciesGPU support unknowncrates.io database dumpNo
What shows each backendno dependency or feature matches a backend rowcrates.io database dumpNo
Native code, from listed crates and their dependenciesNo native code foundcrates.io database dumpNo
Python bindings, from direct dependencies of listed cratesHas Python bindings: pgml needs Python only with feature pythoncrates.io database dumpNo
Crates that depend on a listed crate directlyNot measuredNo

Corrections and review history

Report a correction

No correction applies to this entry.

Judgments

A judgment enters only through an approved issue and a merged pull request.

No judgment applies to this entry.