DEV Community

Fernando Azevedo
Fernando Azevedo

Posted on Edited on Originally published at fernando.moretes.com

OpenSearch 3.9: 16 bits per dimension and the real price of recall

In every RAG project I've operated, the OpenSearch bill did not grow because of CPU or disk. It grew because the HNSW graph has to fit in data node memory, and every float dimension costs 4 bytes. OpenSearch 3.9, available on Amazon OpenSearch Service since 11/23/2026, goes straight at that line item: a 16-bit half_float vector, a bf16 encoder, 2- and 4-bit scalar quantization and base64 ingestion. The dangerous question isn't 'how much RAM do I save?', it's 'how much recall do I lose, and how will I know before the customer does?'. The same release ships part of the answer: LLM-as-a-Judge in Search Relevance Workbench, now with Bedrock.

Where the money in a vector index actually goes

The OpenSearch documentation gives the HNSW memory estimate: 1.1 * (4 * dimension + 8 * m) bytes per float vector. With half_float, the dimension term drops to 2 * dimension.

Run it for a common RAG case: 1024-dimension embeddings, m = 16, 100 million chunks.

  • float: 1.1 × (4096 + 128) = 4,646 bytes per vector, roughly 465 GB of graph.
  • half_float: 1.1 × (2048 + 128) = 2,394 bytes per vector, roughly 239 GB.

That is more than 200 GB of memory off the bill, and on memory-optimized instances it is the difference between a six and a three data node cluster. Notice that the 8 * m term does not shrink: graph neighbors cost the same. At low dimensions, say 384, the relative gain from half_float is smaller than the slide suggests.

The second cost is ingestion. A 1024-float vector serialized as a JSON array takes something in the 10 KB range of text; in base64 it becomes the binary size plus a third. When reindexing 100 million documents, a smaller payload means more documents per _bulk request within the same instance request size limit, and less CPU spent parsing numbers out of text.

None of these gains is free. All of them trade numeric precision for memory, and the effect on recall depends on the distribution of your embeddings, not on someone else's benchmark.

Where precision is cut and where it is measured

The diagram answers one question: at which point in the vector lifecycle precision drops, and at which point recall is checked. Compression happens in the index; on-disk rescoring recovers part of the precision at query time; the Workbench, with Bedrock as the judge, closes the loop that decides the next configuration. The dashed arrow is asynchronous: evaluation runs outside the query path. Replicas, snapshots and the embedding model are left out.

Application

  • Bulk loader base64 _bulk (compute)
  • RAG agent gRPC streaming (compute)

OpenSearch 3.9 domain

  • knn_vector index half_float / 4-bit (data)
  • Full precision on_disk rescoring (storage)
  • Relevance Workbench existingJudgments (compute)

Evaluation

  • Amazon Bedrock ML Commons connector (ai)

Flows

  • ingest -> index: indexes
  • agent -> index: k-NN query
  • index -> rescore: oversample × k
  • srw -> index: runs query set
  • srw -> judge: unrated pairs
  • judge -> srw: ratings

How the 16 bits and quantization work underneath

half_float is FP16: 1 sign bit, 5 exponent bits, 10 mantissa bits. The documentation is explicit about the side effect: values outside [-65504.0, 65504.0] are rejected at index time. Normalized embeddings never get close, but raw feature-engineered vectors, with counts or unnormalized monetary values, do. An ingestion failure is loud, which is good; what is not loud is the loss of resolution near zero, which flattens small distances.

The bf16 the announcement mentions is a different trade: it keeps the 8 exponent bits of float and cuts the mantissa to 7. Wide range, less precision. For normalized embeddings, FP16 tends to preserve more resolution; for vectors with a large dynamic range, bf16 avoids the rejection. Pick by your data distribution, not by the name.

In the documentation's compression table, for float, compression_level maps like this: 8x is 4 bits, 16x is 2 bits, 32x is 1 bit, all on faiss and lucene. compression_level cannot be combined with an encoder in method, so you pick one path per field.

The mechanism that saves recall is mode: on_disk: the compressed graph stays in memory, full precision vectors stay on disk, and the query fetches oversample_factor * k candidates (factor between 1.0 and 100.0, first pass clamped to 100–10,000) to rerank with the exact distance. The cost moves: you pay less RAM and more disk reads per query. With k = 10 and oversample_factor = 5, that's 50 full-vector reads per query; on gp3 EBS under load, it shows up in p99 before it shows up in the average.

Compression doesn't disappear, it changes metric: Moving from in_memory to on_disk trades a JVMMemoryPressure and native memory problem for a read latency problem. Before the cutover, put search p99 and volume read queue on the dashboard. If only cost per GB is on the panel, the regression arrives through a user ticket.

Measuring recall before cutting bits: LLM-as-a-Judge

Quantization without evaluation is a bet. The historical problem is that building relevance judgments costs people: someone has to look at query–document pairs and rate them. Search Relevance Workbench in 3.9 accepts Bedrock and other providers as judge through ML Commons connectors, and three details in the documentation change the operational cost.

Explicit reuse: existingJudgments accepts up to 5 judgment list IDs, checked in order; only pairs unrated in all of them go to the LLM. The global cache was removed and overwriteCache is deprecated and ignored. That's good: reuse becomes a versioned decision, not a cache side effect.

Per-document retry: failures are reprocessed through POST _plugins/_search_relevance/judgments/{judgment_list_id}/_retry, with max_retry_times and retry_backoff_policy in the connector client_config. The Bedrock example uses max_retry_times: 3 and exponential_full_jitter. Before this, a Bedrock throttle halfway through 5,000 pairs meant redoing the whole list.

Cost parameters: size (default 10 hits per query) and tokenLimit (default 4,000) control how much text goes to the model. With 500 queries and size: 10, that's 5,000 evaluations; the token ceiling decides whether it fits the budget.

The flow I use: generate judgments once against the current float index, freeze the list, then run the same query set against the half_float index and against 8x. Only new documents that enter the top-k go to the judge. Watch the failure mode: ignoreFailure defaults to false. Flip it to true and a list with 30% failed pairs looks complete.

gRPC streaming and resource sharing: what changes in operations

gRPC streaming for model prediction and agent execution returns the response token by token. For anyone running agents inside OpenSearch through ML Commons, this takes time to first token off the critical path of the experience. The maintenance cost is elsewhere: a long-lived connection changes the timeout profile at every hop between client and domain. A load balancer with a 60s idle timeout, a reverse proxy that buffers responses, an SDK that waits for the full body, each of these kills streaming silently and hands back the full answer at the end. Before redesigning UX around it, confirm how the gRPC endpoint is exposed on your managed domain and test end to end on the production network.

The resource sharing framework fixes an old multi-team pain: sharing an anomaly detector or a model group without granting broad plugin access. The documentation lists the covered types per plugin: anomaly-detector and forecaster, ml-model-group, monitor, workflow, the Security Analytics detector, among others. Activation goes through plugins.security.resource_sharing.enabled and plugins.security.resource_sharing.protected_types.

In a financial environment under BACEN 4.893, this matters for a concrete reason: the auditor asks who can change the detector feeding the fraud alert. With a broad role, the answer is 'everyone on the observability team'. With per-resource sharing, the answer is a list. Just don't turn it on and assume old permissions migrated: validate with a test user that what was visible is still visible, and what shouldn't be no longer is.

The upgrade: where the plan usually breaks

The Amazon OpenSearch Service upgrade guide holds the constraints that decide the schedule.

Mandatory path: from OpenSearch 1.3 or 2.x to 3.x, go through 2.19 first. Snapshots from OpenSearch 1.x or Elasticsearch 7.10 and earlier do not restore on 3.x. Deprecated settings like index.knn.algo_param.ef_construction, index.knn.algo_param.m and index.knn.space_type have to go first.

In-place doesn't come back: it runs as blue/green, takes 15 minutes to several hours, and cannot be paused, canceled or rolled back. Rollback means restoring a manual snapshot to a new domain, so take the snapshot first.

Clone-based comes back, at a cost: you validate reads on the cloned cluster, cancel any time before cutover and roll back within the retention period, paying for both clusters meanwhile. Writes are blocked during cutover, and there is no support for OR1/OR2, UltraWarm, cross-cluster replication, or SAML or Cognito on Dashboards.

Pre-upgrade check blockers: more than 1,000 shards per node, disk above 90%, and JVM memory pressure above 75%.

The most misleading point: the upgrade converts nothing. data_type: half_float is a mapping property, and a knn_vector field mapping does not change on an existing index. To capture the memory savings you create a new index, reindex (this is where base64 pays off) and swap the alias. The cluster needs room for both indexes at once, which can hit the 90% disk limit in precisely the week you wanted to save money.

Anti-patterns I see coming

  • Choosing compression from a public benchmark: recall at 16x depends on your embedding distribution. Measure with your own query set and frozen judgments.
  • half_float on unnormalized vectors: values outside [-65504, 65504] are rejected. One raw monetary field breaks _bulk halfway through the reindex.
  • on_disk without watching p99: oversample_factor multiplies disk reads per query. Cost per GB drops, tail latency rises.
  • ignoreFailure: true on LLM-as-a-Judge: the list looks complete with pairs missing, and the recall comparison skews toward whichever side failed less.
  • In-place upgrade without a manual snapshot: there is no rollback. The snapshot is the only way back.
  • Assuming the upgrade saves memory: without reindexing into a new mapping, the index stays float and the bill doesn't change.

Well-Architected lens

  • security: Resource sharing restricts detectors and model groups to specific users and roles. Validate visibility with a test user after enabling plugins.security.resource_sharing.enabled.
  • reliability: In-place is irreversible; take a manual snapshot first, and for DR upgrade the secondary first. Per-document retry in the Workbench avoids redoing whole lists after Bedrock throttling.

What I would do: I would start with the Workbench, not with compression: 300 to 500 real queries, judged with Bedrock against the current index, and the list frozen. Then I would build a half_float index in parallel, reindex with base64, and only swap the alias if recall@10 stays within one point of the original. 4- or 2-bit quantization comes as a second step, always with on_disk and p99 on the panel. I learned the expensive way that memory savings show up on next month's bill and recall loss shows up months later, in a wrong agent answer nobody can reproduce.

Verdict

Adopt OpenSearch 3.9 when the vector index is the largest line on your OpenSearch bill and you have a representative query set to measure recall. Start with half_float on normalized embeddings: it's the 2x cut with the lowest risk. Move to 4 or 2 bits with on_disk only after LLM-as-a-Judge shows recall holds, and only if your tail latency budget has room. If you are still on 2.x below 2.19, or without a recent manual snapshot, the first job isn't vectors, it's the upgrade path.

Rating: Adopt, measured

References


Originally published at fernando.moretes.com. By Fernando F. Azevedo: Senior Solutions Architect.

Top comments (1)

Collapse
 
ahmetozel profile image
Ahmet Özel •

Breaking down the HNSW memory formula for 100 million 1024-dimensional vectors makes the real cluster math immediately clear: dropping from 465 GB in float to 239 GB in half_float can cut a six-node memory-optimized cluster in half while leaving the 8 * m graph neighbor overhead untouched. Base64 ingestion in _bulk requests is also a welcome CPU and payload win during full reindexes.

Pairing quantization with on-disk rescoring and asynchronous evaluation is the right safeguard, because recall degradation under 2-bit or 4-bit compression varies heavily with embedding distribution. Measuring recall drop on your own query set before flipping production shards avoids silent relevance regressions.