Chapter 10 · Vector Sets, Vector Search, Hybrid Retrieval, and AI Workloads

VADD, VSIM, Vector-Set Metadata/Attributes, and Core Redis 8 Vector Operations

Operate Redis 8 Vector Sets with observable dimensions, metadata, quantization, exact baselines, and safe filtering.

Intermediate170–200 minutesVector Set operations labRedis Open Source 8.10.1Free/local-firstLast reviewed: September 6, 2026

Learning outcomes

AtlasMart has a small catalog embedding fixture and now needs a Redis-native similarity structure without first defining a Search schema. Vector Sets provide that path: each unique element has a vector plus optional JSON attributes, and VSIM retrieves similar elements.

01

Create, inspect, update, and delete Redis Vector Set elements with the core V* commands.

02

Explain VALUES versus FP32 input, little-endian FP32 requirements, and fixed set dimensions.

03

Use VSETATTR/VGETATTR and inline SETATTR without confusing metadata with source documents.

04

Run approximate and exact VSIM searches with scores, filters, EF, and bounded counts.

05

Explain default Q8 quantization, NOQUANT, BIN, REDUCE, M, and version/client boundaries.

Exact lab baseline

All Chapter 10 mandatory labs reuse the disposable Chapter 01 environment: Redis Open Source 8.10.1 from Docker Official Image redis:8.10.1, container atlasmart-redis-ch01, standalone topology, host publication 127.0.0.1:6379, TLS disabled only because traffic stays on loopback, default ACL user disabled, named users atlasmart-app and academy-admin, logical database 0, AOF with appendfsync everysec plus RDB snapshots, persistent /data, and no explicit maxmemory limit or eviction policy. Redis 8 integrates Vector Sets and the Redis Query Engine into Redis Open Source. Mandatory examples use synthetic numeric vectors created locally—Redis stores/searches vectors but does not generate embeddings. Fixtures stay under atlasmart:ch10:*. Vector Set commands use the restricted application user where allowed; Search index administration uses the disposable academy-admin user. No paid embedding API, managed service, production endpoint, or real credential is required.

Feature-status discipline

Redis 8.0 introduced Vector Sets as a beta data type. The current Redis Open Source 8.10 command reference documents VADD, VSIM, VINFO, filtering, quantization, and related commands as available since 8.0, with standard Redis Software/Redis Cloud compatibility. The official sources checked for this lesson do not provide a separate explicit “Vector Sets became GA on version X” declaration. Treat Vector Set API/product status, client coverage, managed-service support, and Active-Active compatibility as version-sensitive and verify the exact target rather than inventing a GA date.

1. The Vector Set key owns unique element labels and one dimension

A Vector Set is one Redis key of type vectorset. Inside it, element labels are unique. Calling VADD for a new label adds an element; calling it for an existing label updates that element's vector. The set dimension is established by its vector configuration and subsequent entries must conform.

redis-cli · create and inspect a Vector Set
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app DEL atlasmart:ch10:catalog:vectorsdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:catalog:vectors VALUES 3 1 0 0 product:1001docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:catalog:vectors VALUES 3 0.90 0.25 0.05 product:1002docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app TYPE atlasmart:ch10:catalog:vectorsdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VCARD atlasmart:ch10:catalog:vectorsdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VDIM atlasmart:ch10:catalog:vectorsdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VINFO atlasmart:ch10:catalog:vectors

Expected core evidence: Redis type vectorset, cardinality 2, dimension 3. VINFO fields are implementation/version evidence; inspect rather than hard-code every field name into long-lived clients.

2. VALUES is portable; FP32 blobs require little-endian encoding

VALUES n ... sends floating-point components as textual arguments and is easy to inspect in lessons. FP32 sends a compact binary blob and must be little-endian according to current Redis docs. Production clients often prefer binary for bandwidth, but endian/type mistakes can create silent semantic corruption if not validated.

Client boundary

Use a maintained client that knows the Vector Set API or encode FP32 carefully. The mandatory lab uses VALUES so Windows, Linux, and macOS learners do not need binary shell plumbing.

3. Q8 is default quantization for Vector Sets

Current VADD defaults to signed 8-bit quantization (Q8). NOQUANT keeps full FP32-style precision, while BIN uses binary quantization for much lower memory and speed-oriented search at lower recall. The quantization mode is chosen when the Vector Set is created and must remain compatible for later inserts.

redis-cli · compare stored vector evidence by mode
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app DEL atlasmart:ch10:q8 atlasmart:ch10:noq atlasmart:ch10:bindocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:q8 VALUES 2 1.262185 1.958231 item Q8docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:noq VALUES 2 1.262185 1.958231 item NOQUANTdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:bin VALUES 2 1.262185 1.958231 item BINdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VEMB atlasmart:ch10:q8 itemdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VEMB atlasmart:ch10:noq itemdocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VEMB atlasmart:ch10:bin item

Do not expect VEMB to reproduce the original decimals exactly after quantization or floating-point conversion. That difference is evidence of representation—not automatically a retrieval bug.

4. Attach bounded attributes for filtering, not an entire business document

VSETATTR stores JSON attributes alongside an element. Keep these attributes small and retrieval-oriented—tenant, category, visibility, coarse price band—not a duplicate of every source record.

redis-cli · attributes and retrieval metadata
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSETATTR atlasmart:ch10:catalog:vectors product:1001 '{"tenant":"tenant-a","category":"outdoor","active":true,"priceCents":12990}'docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSETATTR atlasmart:ch10:catalog:vectors product:1002 '{"tenant":"tenant-a","category":"travel","active":true,"priceCents":9990}'docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VGETATTR atlasmart:ch10:catalog:vectors product:1001

5. VSIM can query by vector or existing element

redis-cli · query by VALUES and ELE
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors VALUES 3 0.98 0.10 0.02 WITHSCORES WITHATTRIBS COUNT 2docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors ELE product:1001 WITHSCORES COUNT 2

WITHSCORES reports Vector Set similarity on a 1-to-0 scale in the current command contract, with 1 identical. Do not mix that convention with Search KNN distance fields where lower distance is better.

6. TRUTH provides an exact linear-scan baseline

VSIM ... TRUTH bypasses the HNSW graph and performs an exact O(N) scan. That makes it suitable for ground-truth generation on bounded benchmarks. It is not the production default for large sets.

redis-cli · approximate versus exact
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors VALUES 3 0.98 0.10 0.02 WITHSCORES COUNT 2docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors VALUES 3 0.98 0.10 0.02 WITHSCORES COUNT 2 TRUTH

7. EF tunes search effort; NOTHREAD changes scheduling

The query EF parameter controls graph exploration effort: higher values can improve recall at additional latency. NOTHREAD forces work onto the main thread and may increase server latency, so it belongs in controlled benchmarks or very small workloads, not copied production defaults.

redis-cli · same query, different search effort
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors VALUES 3 0.98 0.10 0.02 WITHSCORES COUNT 2 EF 50docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors VALUES 3 0.98 0.10 0.02 WITHSCORES COUNT 2 EF 200

On a two-element fixture, results may not change. That is expected; tune only on representative cardinality and measure recall/latency.

8. FILTER applies element attributes during retrieval

redis-cli · structured Vector Set filter
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VSIM atlasmart:ch10:catalog:vectors VALUES 3 0.98 0.10 0.02 WITHSCORES WITHATTRIBS COUNT 10 FILTER '.tenant == "tenant-a" && .active == true && .priceCents < 12000'

This lightweight filtering is useful but not equivalent to Redis Search's full text/TAG/NUMERIC/GEO query model. Keep the choice tied to workload complexity.

9. REDUCE changes stored dimensionality through random projection

VADD ... REDUCE d applies a saved random projection so the set stores a lower dimension than the input. This can reduce memory but changes retrieval geometry. Treat reduction as a model/index decision that requires a recall benchmark, not as transparent compression.

redis-cli · bounded REDUCE example
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app DEL atlasmart:ch10:reduceddocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:reduced REDUCE 2 VALUES 3 1 0.2 0.1 item-adocker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VDIM atlasmart:ch10:reduced

Expected dimension is 2. Do not compare recall against the unreduced system without a fixed evaluation query set.

10. M and build EF are graph-build decisions

M controls graph link capacity; build-time EF controls candidate effort when linking new nodes. Higher values can improve recall/searchability but cost memory and ingestion work. Current defaults are documented, but the correct production values depend on dimensions, cardinality, update rate, latency targets, and recall requirements.

11. Wrong approach: treat VEMB as the original model embedding

With Q8/BIN quantization, VEMB returns the vector representation recoverable from stored data, not guaranteed original source floats. If the original embedding is required for audit/rebuild, persist it in the authoritative source or a separately versioned store.

12. Update, membership, range, and removal

redis-cli · core maintenance commands
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VISMEMBER atlasmart:ch10:catalog:vectors product:1001docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VRANGE atlasmart:ch10:catalog:vectors - + COUNT 10docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VADD atlasmart:ch10:catalog:vectors VALUES 3 0.95 0.05 0.00 product:1001docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VREM atlasmart:ch10:catalog:vectors product:1002docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app VCARD atlasmart:ch10:catalog:vectors

Updating an existing label changes its vector rather than adding a second element with the same label. Stable labels therefore serve as idempotent identity handles, but business-side duplicate prevention remains your application responsibility.

13. Reproducible lab cleanup

redis-cli · remove Chapter 10 lesson-2 fixtures
docker exec -e REDISCLI_AUTH=AtlasMart-App-Lab-Only-2026 atlasmart-redis-ch01 redis-cli --user atlasmart-app DEL atlasmart:ch10:catalog:vectors atlasmart:ch10:q8 atlasmart:ch10:noq atlasmart:ch10:bin atlasmart:ch10:reduced

14. Production judgment

Vector Sets are attractive when one Redis-native structure plus light attributes matches the workload. Measure set cardinality, dimension, quantization, graph memory, insert/update rate, p50/p95/p99 query latency, recall@k, filter selectivity, persistence/replication cost, and security boundaries. Verify client support before freezing an SDK API. Current standard Redis Software/Cloud compatibility does not imply Active-Active support. Redis 8.10.1 includes Vector Set security/robustness fixes, reinforcing the need to stay current on patch releases.

15. Summary and next step

You can now operate a Vector Set deliberately: dimension, Q8/BIN/NOQUANT, labels, attributes, HNSW effort, exact truth scans, and cleanup are observable. Lesson 3 asks when lightweight Vector Set filters are enough and when Search hybrid retrieval is the better boundary.

Check your understanding

  1. What is the default Vector Set quantization?
  2. Why can VEMB differ from the inserted floats?
  3. What does VSIM TRUTH do?
  4. What is the purpose of VSETATTR?
  5. Does FILTER replace application authorization?
Review the answers

Q8 in the current VADD contract.

Quantization and floating-point representation change stored/reconstructed values.

Runs an exact linear scan useful for ground truth/recall measurement.

Associates bounded JSON attributes used for retrieval/filtering.

No. It is one retrieval constraint inside a broader security design.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only Ethereum or ERC-20 compatible assets to this address.