Software Development

Resolving "ef or M is too small" errors in large Chroma collections?

HE Asked by Heather Long · 12-01-2026
0 upvotes 14,241 views 0 comments
The question

I'm hitting a persistent error when querying my Chroma DB collection: Cannot return the results in a contiguous 2D array. Probably ef or M is too small. This only happens when I request n_results > 50. I’m using the HNSW index—what are the safe production values for these parameters in 2026?

3 answers

0
AN
Answered on 18-01-2026

This error happens when the HNSW graph is too "sparse" to find the number of neighbors you're asking for. In Chroma, you should increase M (max connections per node) and ef_construction during the collection creation. For a production set of 1M+ vectors, I usually recommend M=32 and ef_construction=200. It makes the indexing slower and uses more memory, but it fixes the "contiguous array" crash and significantly improves your search recall.

0
JU
Answered on 20-01-2026

Does increasing these values impact the query speed (latency) significantly?

KE 22-01-2026

ef_search is the one that hits query speed. M and ef_construction mostly affect the build time and index size. If you keep ef_search around 100, you’ll get a good balance of accuracy and speed in Chroma.

0
CH
Answered on 24-01-2026

You can also try reducing the number of results you request. If you're using a RAG pipeline, do you really need more than 10-20 context chunks?

HE 26-01-2026

We were trying to do a "bulk" similarity analysis, Charles. But following Angela's advice on the HNSW parameters completely solved the crash. Thanks!

Share your thoughts

Your email address will not be published. Required fields are marked (*)

Professional Counselling Session

Still have questions?
Schedule a free counselling session

Our experts are ready to help you with any questions about courses, admissions, or career paths. Get personalized guidance from industry professionals.

Request a Call Back

Search Online

We Accept

We Accept

Follow Us

"PMI®", "PMBOK®", "PMP®", "CAPM®" and "PMI-ACP®" are registered marks of the Project Management Institute, Inc. | "CSM", "CST" are Registered Trade Marks of The Scrum Alliance, USA. | COBIT® is a trademark of ISACA® registered in the United States and other countries.

Book Free Session