Oracle AI Database Embedding Models: ONNX Sentence-Transformer Support
Oracle AI Database 26ai supports ONNX-formatted sentence-transformer models for in-database vector generation, with ALL_MINILM_L12_V2 being the primary pre-packaged model delivering 384-dimensional embeddings.
Oracle AI Database enables native vector search by running transformer models directly inside the database engine, eliminating external embedding service dependencies. According to the oracle-devrel/oracle-ai-developer-hub repository, the database ships with curated ONNX model support that integrates with hybrid vector indexes through the DBMS_VECTOR package.
Supported ONNX Sentence-Transformer Models
Oracle AI Database supports ONNX versions of sentence-transformer models through the DBMS_VECTOR.LOAD_ONNX_MODEL procedure. The repository documentation in apps/picooraclaw/README.md and apps/oracle-database-java-agent-memory/docs/articles/hybrid-vector-index-deep-dive.md confirms that the database includes pre-packaged support for specific transformer architectures that execute within the database kernel.
ALL_MINILM_L12_V2 (Primary Model)
The ALL_MINILM_L12_V2 model is the currently recommended default for sentence-transformer workloads in Oracle AI Database. This model produces 384-dimensional embeddings and ships as the primary ONNX-compatible option for in-database vector generation.
As documented in apps/oracle-database-java-agent-memory/docs/articles/ai-agent-memory-spring-ai-oracle.md, this model can be loaded once and referenced by name in hybrid vector indexes. Once configured, the database automatically applies the model to text queries via the VECTOR_EMBEDDING and VECTOR_DISTANCE functions.
Loading ONNX Models with DBMS_VECTOR
Before generating embeddings, you must load the ONNX model into the database using the DBMS_VECTOR.LOAD_ONNX_MODEL procedure. As shown in apps/oracle-database-java-agent-memory/docs/articles/ai-agent-memory-spring-ai-oracle.md, this step registers the model for subsequent vector operations.
sql = """
BEGIN
DBMS_VECTOR.LOAD_ONNX_MODEL(
model_name => 'ALL_MINILM_L12_V2',
onnx_path => '/path/to/all_MiniLM_L12_v2.onnx',
model_type => DBMS_VECTOR.ONNX_SENTENCE_TRANSFORMER);
END;
"""
The model_name parameter becomes the identifier referenced in hybrid vector index definitions and queries. The model_type must be set to DBMS_VECTOR.ONNX_SENTENCE_TRANSFORMER for sentence-transformer architectures.
Creating Hybrid Vector Indexes
Once loaded, the ONNX model powers hybrid vector indexes that automatically embed text at ingestion and query time. The syntax documented in apps/oracle-database-java-agent-memory/docs/articles/hybrid-vector-index-deep-dive.md demonstrates how to reference the model during index creation.
CREATE HYBRID VECTOR INDEX policy_hybrid_idx ON policy_docs (content)
PARAMETERS('MODEL ALL_MINILM_L12_V2 VECTOR_IDXTYPE HNSW');
After creation, inserts automatically trigger embedding generation through the loaded ONNX pipeline.
sql = """
INSERT INTO policy_docs (id, content) VALUES (1, 'Return policy for defective items');
COMMIT;
"""
Query operations use the same model for vector similarity search without external API calls.
SELECT *
FROM policy_docs
WHERE VECTOR_SEARCH(
USING 'ALL_MINILM_L12_V2',
QUERY => 'What is the policy for broken products?')
ORDER BY SCORE DESC
FETCH FIRST 5 ROWS ONLY;
Application Configuration
Applications built on Oracle AI Database can configure the embedding model through configuration parameters. In apps/limitless-workflow/src/limitless/settings.py, the oracle_embedding_model field defaults to supported ONNX model names and can be overridden to reference any loaded sentence-transformer model.
# From apps/limitless-workflow/src/limitless/settings.py
oracle_embedding_model = "ALL_MINILM_L12_V2" # Configurable to any ONNX model name
Architecture and Limitations
As clarified in apps/oracle-database-java-agent-memory/docs/issues/hybrid-index-no-external-embeddings.md, hybrid vector indexes in Oracle AI Database only support ONNX models loaded via DBMS_VECTOR. External embedding services such as OpenAI, Ollama, or Cohere cannot be used for hybrid index operations because the embedding pipeline must execute inside the database engine for automatic index maintenance.
This architecture ensures that vector generation and similarity search occur within the same transaction context. Network latency to external services is eliminated while maintaining ACID compliance for vector data.
Summary
- Oracle AI Database supports ONNX-formatted sentence-transformer models for native vector generation inside the database engine.
- ALL_MINILM_L12_V2 is the primary pre-packaged model producing 384-dimensional embeddings.
- Load models using
DBMS_VECTOR.LOAD_ONNX_MODELwithmodel_typeset toONNX_SENTENCE_TRANSFORMER. - Reference loaded models in hybrid vector indexes using the
PARAMETERS('MODEL name...')clause. - Hybrid indexes require in-database ONNX models and do not support external embedding APIs.
Frequently Asked Questions
What embedding models are supported in Oracle AI Database?
Oracle AI Database supports ONNX versions of sentence-transformer models loaded via DBMS_VECTOR.LOAD_ONNX_MODEL. As documented in the oracle-devrel/oracle-ai-developer-hub repository, ALL_MINILM_L12_V2 is the currently recommended and pre-packaged model for production workloads requiring 384-dimensional embeddings.
Can I use external embedding services like OpenAI with Oracle AI Database?
No. According to apps/oracle-database-java-agent-memory/docs/issues/hybrid-index-no-external-embeddings.md, hybrid vector indexes require ONNX models that run inside the database engine. External embedding services cannot be used for hybrid indexes because the database must automatically generate embeddings during DML operations without network calls.
How do I configure the embedding model in my application?
Applications reference the model name configured in the database. In apps/limitless-workflow/src/limitless/settings.py, the oracle_embedding_model parameter specifies which loaded ONNX model to use, typically set to ALL_MINILM_L12_V2 unless you have loaded a custom compatible model via DBMS_VECTOR.
What is the dimension size of the supported embedding model?
The ALL_MINILM_L12_V2 model produces 384-dimensional embeddings. When creating hybrid vector indexes or configuring vector columns, ensure your schema accommodates this dimensionality for optimal storage and search performance.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →