Skip to content

GenerateContentConfig.media_resolution = None leads to degraded vision performance #2119

@msciancalepore98

Description

@msciancalepore98

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

Metadata

Metadata

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions