Skip to content

[SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH and Word2Vec models#57449

Open
zhengruifeng wants to merge 3 commits into
apache:masterfrom
zhengruifeng:feature-composite-size-estimates-dev3
Open

[SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH and Word2Vec models#57449
zhengruifeng wants to merge 3 commits into
apache:masterfrom
zhengruifeng:feature-composite-size-estimates-dev3

Conversation

@zhengruifeng

@zhengruifeng zhengruifeng commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Adds explicit estimatedSize implementations for BucketedRandomProjectionLSHModel and Word2VecModel.

  • BRP-LSH directly accounts for its learned random matrix with getSizeInBytes, including a null guard for the ML Connect constructor.
  • Word2Vec accounts for its word-index map and float vector array.

Adds fitted-model regression tests in the corresponding algorithm suites, each with a 4 KiB upper bound.

Why are the changes needed?

The default reflection-based estimate can traverse substantially more state than the fitted model owns. Direct accounting keeps model-size estimation small, predictable, and focused on learned state.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  • JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 build/sbt 'mllib/Test/compile'\n\n### Was this patch authored or co-authored using generative AI tooling?\n\nGenerated-by: Codex GPT-5

@zhengruifeng zhengruifeng changed the title [WIP][ML] Estimate size of BucketedRandomProjectionLSH, Word2Vec, and RFormula models [SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH, Word2Vec, and RFormula models Jul 23, 2026
@zhengruifeng zhengruifeng changed the title [SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH, Word2Vec, and RFormula models [SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH and Word2Vec Jul 23, 2026
@zhengruifeng zhengruifeng changed the title [SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH and Word2Vec [WIP][ML] Estimate size of BucketedRandomProjectionLSH and Word2Vec models Jul 23, 2026
@zhengruifeng zhengruifeng changed the title [WIP][ML] Estimate size of BucketedRandomProjectionLSH and Word2Vec models [SPARK-58280][ML][CONNECT] Estimate size of BucketedRandomProjectionLSH and Word2Vec models Jul 23, 2026
@zhengruifeng
zhengruifeng marked this pull request as ready for review July 23, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant