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

   ### What changes were proposed in this pull request?
   
   Broadcast only the word-index map and flattened word-vector array used by
   `Word2VecModel.transform`, instead of broadcasting the legacy MLlib 
`Word2VecModel` instance.
   
   ### Why are the changes needed?
   
   The legacy model also contains derived fields used by synonym lookup, 
including lazy caches that
   may already have been initialized. These fields are not needed when 
transforming sentences, but
   they become part of the broadcast when the whole model is serialized. 
Broadcasting the two lookup
   structures directly keeps the payload limited to the state used by the 
transform UDF.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Ran:
   
   ```
   JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 build/sbt \
     'mllib/testOnly org.apache.spark.ml.feature.Word2VecSuite'
   ```
   
   All 10 tests passed.
   
   ### 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to