googleapis / googleapis/python-genai

GenerateContentConfig.media_resolution = None leads to degraded vision performance

Open
#2,119 2 comments 0 reactions 1 assignee Claimed by @Venkaiahbabuneelam View on GitHub
priority: p2 type: bug type: feature request
Dominant language
Python
Stars
4k
Forks
1k
Avg merge
2d 11h
Merged PRs (30d)
40

Description

Applies for gemini-2.5 onwards: When I use GenerateContentConfig.media_resolution = None , vision performance is negatively impacted.
If I instead set it explicitly to types.MediaResolution.MEDIA_RESOLUTION_UNSPECIFIED, performance is good as usual. I found this by chance due to a refactor.

Our team internal bench suite shows a ~10% performance drop when using None; it's a 2-field data extraction task from ~1080p images.

Weird part is that token usage is the same as using MEDIA_RESOLUTION_UNSPECIFIED.

I didn't find any documentation showing the difference between None and MEDIA_RESOLUTION_UNSPECIFIED enum, so I always assumed they would be the same. They are not, apparently..?

At this point I've already solved the problem, but I'd like to have an explanation from someone that knows the internals.. out of curiosity. If hope that the media res enum has a good reason to be Optional and not default to MEDIA_RESOLUTION_UNSPECIFIED.
Plus, I hope this may help other people.

`google.genai version == 1.57.0`, `python 3.10.8`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.