Reducing embedding dimensions can make vectors smaller and help fit pgvector index limits, but it is not a switch that can be changed independently in a live database. The embedding model’s output width, Spring AI’s PgVectorStore setting, and the database column must agree. Before moving production traffic, create a compatible schema, re-embed data as needed, and measure retrieval quality on your own corpus.
What embedding dimensions change
An embedding is a vector: a sequence of numbers whose count is its dimensional width. The model determines that width, and the database column and index must support it. Spring AI’s PgVectorStore reference uses vector(1536) as an example and explains that the configured dimensions determine the embedding column width. That example is not a universal model setting. Spring AI PgVectorStore documentation
As an Amazon Associate I earn from qualifying purchases.
Reducing width can reduce the amount of vector data stored and may make an index configuration possible where the original width exceeded a limit. It is also a retrieval-quality tradeoff: fewer dimensions do not guarantee equivalent results for your application. The cited documentation does not establish universal percentages for storage savings, index size, latency, or recall.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsCheck pgvector limits before choosing a width
Spring AI’s PgVectorStore reference cites a maximum of 2,000 dimensions for pgvector HNSW indexes when using its vector example. The pgvector project README documents vector up to 2,000 dimensions and halfvec up to 4,000. These are type and index compatibility limits, not a recommendation that every application use the largest supported width. Spring AI PgVectorStore documentation · pgvector README
#1 Best Overall
Do not infer that selecting a larger Spring AI dimensions value automatically switches the database column to halfvec. Confirm the column type and index support in the integration and schema you actually deploy.
Request a shorter embedding from a supported model
OpenAI’s text-embedding-3 models support a dimensions parameter in the embeddings API. This lets an application request a shorter output from a model that supports the option; it does not mean every embedding model can produce arbitrary widths. Check the API reference and the Spring AI version used by your application for the exact model property or runtime option wiring. OpenAI embeddings API reference
OpenAI reported that text-embedding-3-large shortened to 256 dimensions outperformed unshortened text-embedding-ada-002 at 1,536 dimensions on the MTEB benchmark. That is a particular benchmark comparison between two model configurations, not evidence that shortening will preserve or improve retrieval quality for every corpus or task. OpenAI’s embedding models announcement
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Keep model, query, and database widths aligned
For a working retrieval pipeline, embeddings generated for stored documents and incoming queries must use compatible model and dimension settings, and the database column must match. Spring AI documents spring.ai.vectorstore.pgvector.dimensions for the PgVectorStore column width. If omitted, the store retrieves dimensions from the configured EmbeddingModel. The setting applies when the table is created; changing it does not reshape an existing table. Spring AI PgVectorStore documentation
Schema initialization is disabled by default: the property documentation lists initialize-schema as false, and the guide says initialization must be explicitly enabled. Verify the exact property names and model configuration against the Spring AI version pinned in your application rather than copying configuration across versions without checking.
For OpenAI API embeddings specifically, outputs are L2-normalized by default, including after shortening. OpenAI says cosine similarity and Euclidean distance produce identical rankings for these normalized vectors. This behavior should not be generalized to embeddings from other providers or models. OpenAI embeddings FAQ
Plan a dimension change as a data and index migration
A dimension change affects stored vectors and schema, so treat it as a migration rather than a configuration-only adjustment. A practical sequence is:
- Choose a candidate width. Check the selected pgvector type and index limits, model support, and application constraints.
- Capture a baseline. Build representative queries and record current retrieval results and task-level answer quality before changing embeddings.
- Align both embedding paths. Configure document ingestion and query embedding generation to use the same model and requested width.
- Create a compatible schema and index. Plan for a new or recreated
vector_storetable; Spring AI states that changing dimensions requires recreating the table. - Re-embed or reload the corpus. Existing vectors do not become shorter merely because the application property changes.
- Evaluate before cutover. Compare recall or task-level quality, latency, storage and index size, and index build/update cost on the workload that matters to your application.
Spring AI’s documentation establishes the schema behavior, while the evaluation sequence is operational guidance: the cited sources do not report a universal benchmark for these migration outcomes.
Best Value
Decide whether shorter vectors are the right fix
Compare the options against the constraints that prompted the change rather than assuming a smaller width is always better.
| Option | What it addresses | What to validate |
|---|---|---|
| Keep the model’s full supported width | Avoids reducing the model’s output dimensions; compatible only if the selected column and index support that width. | Index/type limits and measured storage, latency, and retrieval quality on your workload. |
| Request shorter output from a model that supports it | Can bring vectors within a chosen width limit and reduce vector storage. | Model API support, matching query and document widths, and retrieval quality on representative queries. |
| Use another supported pgvector type or index approach | May allow a different compatibility range; pgvector documents halfvec up to 4,000 dimensions. |
Whether the Spring AI integration and deployed schema support the chosen type and index, plus quality and operational tradeoffs. |
The available documentation does not provide a general quantitative comparison of recall, index size, or latency across these options. Use a corpus-specific evaluation to decide whether the space and index benefits justify the migration and any retrieval change.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Recommended Free Tools




