ONNXEmbeddings Example: With Binary Input from BLOB Columns - Teradata Vantage

Teradata Vantage™ - Bring Your Own Model User Guide

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Lake
Product
Teradata Vantage
Release Number
20.00
Published
May 2026
ft:locale
en-US
ft:lastEdition
2026-06-18
dita:mapPath
fee1607120608274.ditamap
dita:ditavalPath
ayr1485454803741.ditaval
dita:id
fee1607120608274

This example shows how to use precomputed binary input columns with ONNXEmbeddings.

The model bge-small-en-v1.5 expects fixed-length input arrays of 512 float32 values. These inputs are named input_ids and attention_mask. When you provide a txt column as input, the function generates these arrays automatically.

If your table already contains tokenized inputs, you can bypass tokenization. Use the input_ids and attention_mask BLOB columns directly. This approach uses precomputed binary inputs and does not require a tokenizer.

The input table amazon_reviews_25_binary contains precomputed input tensors:
  • input_ids (BLOB): Array of little-endian INT64 values
  • attention_mask (BLOB): Array of little-endian INT64 values
select
    *
from mldb.ONNXEmbeddings(
    on (SELECT CAST(rev_id AS VARCHAR(21)) as rev_id, input_ids, attention_mask FROM amazon_reviews_25_binary)
    on (select model_id, model from onnx_models where model_id = 'bge-small-en-v1.5') DIMENSION
USING
    Accumulate('rev_id')
    ModelOutputTensor('sentence_embedding')
    OutputFormat('FLOAT32(384)')
) a
;
 *** Query completed. 25 rows found. 385 columns returned. 
 *** Warning: 3705 Request executed in interpretive EVL mode.
 *** Total elapsed time was 7 seconds.
 *** Warning: Report has more than 100 column(s).
              Only the first 100 column(s) will be displayed.
rev_id                                 emb_0                  emb_1                  emb_2                  emb_3                  emb_4
--------------------- ---------------------- ---------------------- ---------------------- ---------------------- ---------------------- ...
A26GKZPS079GFF        -3.33678461611271E-002  1.32660176604986E-002  3.98636870086193E-002  3.13083566725254E-002 -1.01601090282202E-002 ...
A27ZH1AQORJ1L         -4.07209852710366E-003  3.12303509563208E-002  5.48462718725204E-002  2.47544385492802E-002 -2.51442417502403E-002 ...
A5E9TSD20U9PR         -2.55403872579336E-002  4.24333736300468E-002  3.86486761271954E-003  2.48651672154665E-002  8.27911961823702E-003 ...
A2S166WSCFIFP5         2.85573978908360E-003 -1.43960937857628E-002 -1.67111344635487E-002 -8.66278819739819E-003 -1.05052180588245E-002 ...
A3V1MKC2BVWY48         1.03411199524999E-002  3.96031923592091E-002  2.03205142170191E-002  1.71305481344461E-002  7.52637279219925E-004 ...
AUTNO7VDY4H4A         -1.18440315127373E-002  2.22351606935263E-002 -5.43525954708457E-003  2.37749889492989E-002 -1.12732723355293E-002 ...
...