Overview

Pydantic 2.11, released on June 15, 2025, reduces memory usage by 2-5x for validated models.

Main Features

2-5x memory reduction

Model schemas are now compiled more compactly, reducing the memory footprint by 2-5x depending on model complexity.

python
from pydantic import BaseModel

class User(BaseModel):
    name: str
    age: int
    email: str

user = User(name='Alice', age=30, email='a@b.com')
print(user.model_dump())
# {'name': 'Alice', 'age': 30, 'email': 'a@b.com'}

Improved validation

Custom validators are more performant and validation error handling is enriched with more precise messages.

python
from pydantic import BaseModel, field_validator

class Product(BaseModel):
    name: str
    price: float

    @field_validator('price')
    @classmethod
    def check_price(cls, v):
        if v <= 0:
            raise ValueError('price must be positive')
        return v

Sources