Conversation
przepeck
requested review from
michalkulakowski and
rasapala
and
a lite review from Copilot
September 23, 2026 12:56
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The tensor-size guard does not currently bound pre-check allocations, and documentation and regression tests are still needed.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (3)
What changed in this PR
Adds a 1024-document batch limit and 1 GiB input-tensor cap for embeddings requests.
Changes:
- Validates string and pre-tokenized batch sizes.
- Rejects requests exceeding the projected tensor-size limit.
| File | Summary | Findings |
|---|---|---|
src/embeddings/embeddings_calculator_ov.cc |
Implements embeddings batch and tensor-size validation. | Critical (3 votes): Validation occurs after tokenization and may not prevent oversized allocations. Nits (3 votes each): Update API documentation and add boundary/regression tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+214
to
+218
| size_t totalInputBytes = tokens.input_ids.get_byte_size() + tokens.attention_mask.get_byte_size(); | ||
| if (embeddings_session->getNumberOfModelInputs() == 3) { | ||
| totalInputBytes += tokens.input_ids.get_byte_size(); | ||
| } | ||
| auto byteSizeCheckStatus = this->isInputByteSizeOk(totalInputBytes); |
Comment on lines
+191
to
+194
| auto batchSizeCheckStatus = this->isBatchSizeOk(receivedBatchSize); | ||
| if (!batchSizeCheckStatus.ok()) { | ||
| return batchSizeCheckStatus; | ||
| } |
Comment on lines
+455
to
+456
| const size_t EmbeddingsCalculatorOV::MAX_BATCH_SIZE{1024}; | ||
| const size_t EmbeddingsCalculatorOV::MAX_INPUT_TENSORS_BYTE_SIZE{1024ull * 1024 * 1024}; // 1 GB |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


🛠 Summary
CVS-194659
Setting max batch size for embeddings endpoint to 1024
Additionally for adding boundary for maximum tensor size to 1GB
🧪 Checklist
``