Skip to content

fix: add chunk overlap param#94

Open
Mateusz-Switala wants to merge 7 commits into
IBM:mainfrom
Mateusz-Switala:fix-search-space-preparation
Open

fix: add chunk overlap param#94
Mateusz-Switala wants to merge 7 commits into
IBM:mainfrom
Mateusz-Switala:fix-search-space-preparation

Conversation

@Mateusz-Switala

Copy link
Copy Markdown
Collaborator

Assisted-by: Claude Code

Description

Add chunk_overlaps param to the prepare_search_space_report component. The chunk size (chunk_size) and chunk overlap (chunk_overlap) are related by certain rules, which means that passing a custom list of chunk sizes with default overlaps can result in empty search spaces.

Motivation

Why is this change needed?

Changes

  • Bullet point list of changes
  • Another change

Testing

How did you test this?

Checklist

  • Tests added/updated
  • Documentation updated
  • Code follows style guide
  • All checks passing

Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Assisted-by: Claude Code
Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Assisted-by: Claude Code
Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Assisted-by: Claude Code

@filip-komarzyniec filip-komarzyniec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 🙌🏼 /lgtm

Comment thread ai4rag/search_space/prepare/input_payload_types.py Outdated
Comment thread ai4rag/search_space/prepare/prepare_search_space.py Outdated
Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Assisted-by: Claude Code
Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Assisted-by: Claude Code
Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Assisted-by: Claude Code
Signed-off-by: Mateusz Switala <mswitala@redhat.com>
Comment on lines +260 to +265
valid_combinations = search_space.combinations
if not valid_combinations:
_logger.warning("No valid combinations remain after applying search space rules.")
non_model_keys = [p.name for p in search_space.params if p.name not in ("foundation_model", "embedding_model")]
verbose_repr: dict[str, Any] = {
k: v.all_values()
for k, v in search_space._search_space.items() # pylint: disable=protected-access
if k not in ("foundation_model", "embedding_model")
key: list(dict.fromkeys(combo[key] for combo in valid_combinations)) for key in non_model_keys

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure the new implementation for creating the verbose_repr is worse in terms of time-complexity.

I asked Claude to calculate that and here's the detailed breakdown:

Image

Whereas the previous implementation is simply O(P), where P is the number of parameters in the search space.

Why did we have to refactor that at all?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants