Skip to content

embed_infer

embed_infer is a partition-loop specialization. Framework bootstrap loads a grouped vocabulary snapshot, resolves materialization columns, and injects both contracts into processor_ctx; the domain processor performs the declared inference transform and returns logical rows.

embed_infer:
vocab_dataset: embed_vocab
vocab_run_param: mapping.vocab_upstream_run
output_dataset: occurrence_vectors
columns:
vocab_group: kind
vocab_token: token_id
vocab_vector: vector
output_group: kind
output_row_id: occurrence_id
output_vector: vector
embed_train:
materialize:
group_column: kind
group_exclude_values: [literal]
token_window_column: token_window
token_window_mask_column: token_window_mask
min_window_tokens: 2
pair_mode: dep_weight
pair_radius: 3
center_token_column: token_id
dep_path_column: dependency_path
head_token_column: head_token_id
feed_cap_column: document_id
feed_boundary_column: document_id

The reuse of embed_train.materialize is intentional: it is the shared descriptor-row materialization contract. Infer does not consume train_pairs or vocab_counts.

Domain init for infer is a stub ({}). Real load happens in the partition-loop runner when compiled.embed_infer is present: bootstrap_embed_infer_processor_ctx provides:

  • embed_vocab_index: grouped token → vector lookup (session.iter_run_rows + group filter);
  • embed_material: resolved materialization policy;
  • embed_infer_spec: logical input/output column names;
  • optional embed_feed_shard_scope when a distinct-value feed cap narrows the run.

Vocabulary loading uses StorageSession, so parquet and Qdrant reads stay behind dataset adapters. compute.embed_vocab_max_mib guards in-memory vocabulary size.

Per-occurrence vectors are mean-pooled token rows from the loaded vocab matrix. Prefer the batched API:

  • algorithms/embed/pooling.mean_pool_rows — one occurrence;
  • mean_pool_rows_batch — many occurrences in one NumPy gather/mask/mean (used by vocab_index helpers).

Scale-out for infer is partition_loop parallelism (runtime.parallelism.*, typically Ray) plus this vectorized pool — not an embed_train-style parameter server. Train already owns the PS path; infer gains more from batching + workers.

Infer emits one vector row per occurrence. Choosing cluster count K / bottleneck probing is later domain policy via the probe loop and streaming cluster — not part of embed_infer or the pooling algorithm.

Live infer gauges are declared in the step’s fragments/metrics.drtml as processor_stat / processor_stat_ratio (rows, coverage/OOV, L2, …). They are not the shared embed_train_metric_catalog used by train Prometheus emit and train observation writers.

Offline geometry / vector evaluation for infer artifacts runs as a separate evaluation / metrics step (stable-hash sample + registered vector methods). See evaluation.