You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2026/09/10 05:44:21 UTC

[PR] [SPARK-59397][ML] Reduce serialized size of mllib Word2VecModel [spark]

zhengruifeng opened a new pull request, #58688:
URL: https://github.com/apache/spark/pull/58688

   ### What changes were proposed in this pull request?
   
   This PR reduces the serialized size of `mllib`'s `Word2VecModel` by:
   
   - computing `numWords` and `vectorSize` from the model data instead of storing them;
   - removing the derived `wordList` cache and iterating over `wordIndex` when finding synonyms;
   - making the lazily computed word-vector inverse norms transient.
   
   ### Why are the changes needed?
   
   These values are derived from `wordIndex` and `wordVectors`. Storing them in the serialized model
   duplicates data, including an array containing the full vocabulary, and increases the pressure from
   shipping models between the Spark Connect server and executors.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing Word2Vec tests:
   
   ```
   build/sbt 'mllib/testOnly *Word2VecSuite'
   ```
   
   The run passed 19 tests with no failures. No new tests were added because this is an internal
   representation refactor covered by the existing synonym, Java API, and model persistence tests.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-5)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-59397][ML] Reduce serialized size of mllib Word2VecModel [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #58688:
URL: https://github.com/apache/spark/pull/58688#issuecomment-5616715117

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/505aff3786d0cf5bc17f574468da22e2eb9503e0
   - merged into branch-4.x https://github.com/apache/spark/commit/29eed0a08afc1e75ee52ce4d8b5fc83d1c70dd09
   
   *Posted by `merge_spark_pr.py`*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-59397][ML] Reduce serialized size of mllib Word2VecModel [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #58688: [SPARK-59397][ML] Reduce serialized size of mllib Word2VecModel
URL: https://github.com/apache/spark/pull/58688


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org