tannnmayy opened a new issue, #41360:
URL: https://github.com/apache/beam/issues/41360
### What happened?
`GeminiModelHandler` and `OpenAIModelHandler` pass `max_batch_size` to
`BatchElements` only if the user sets it, so with default settings batches grow
without an upper bound.
Measured on master (de0e417a69) with default settings and fake clients (no
network):
| Pipeline | Result |
|---|---|
| `OpenAIModelHandler` with `embedding_from_string`, 60,000 inputs |
requests of up to 10,000 inputs; 7 of 20 requests were over the 2,048 inputs
the embeddings endpoint accepts |
| `GeminiModelHandler` with `generate_from_string`, 3,000 prompts | batches
of up to 974 and 1,115 prompts in two runs |
For the per-prompt request functions a large batch doesn't help: requests
are sent 32 at a time (`_MAX_CONCURRENT_REQUESTS_PER_BATCH`). It does cost
something, because `RemoteModelHandler` retries the whole batch when one
request fails, which re-sends the prompts that already succeeded.
@claudevdm asked about this on #40239 ("Should we set a default max batch
size so that we dont exceed the api batch size limits?",
https://github.com/apache/beam/pull/40239#discussion_r4147622042) and it wasn't
picked up.
**Proposal:** default `max_batch_size` to 32 in both handlers, and to 2,048
with `embedding_from_string`, never below a `min_batch_size` the user set. An
explicit `max_batch_size` keeps working as it does now. I have this ready with
tests and will open the PR. The Gemini per-prompt requests from #40914 first
ship in 2.79.0, so it would be good to settle the default before that release.
cc @jrmccluskey
### Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
### Issue Components
- [x] Component: Python SDK
- [ ] Component: Java SDK
- [ ] Component: Go SDK
- [ ] Component: Typescript SDK
- [ ] Component: IO connector
- [ ] Component: Beam YAML
- [ ] Component: Beam examples
- [ ] Component: Beam playground
- [ ] Component: Beam katas
- [ ] Component: Website
- [ ] Component: Infrastructure
- [ ] Component: Spark Runner
- [ ] Component: Flink Runner
- [ ] Component: Prism Runner
- [ ] Component: Hazelcast Jet Runner
- [ ] Component: Google Cloud Dataflow Runner
--
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]