Skip to content

feat: Updates for intrinsics support#227

Merged
jakelorocco merged 47 commits into
generative-computing:mainfrom
frreiss:intrinsics
Nov 17, 2025
Merged

feat: Updates for intrinsics support#227
jakelorocco merged 47 commits into
generative-computing:mainfrom
frreiss:intrinsics

Conversation

@frreiss

@frreiss frreiss commented Nov 11, 2025

Copy link
Copy Markdown
Collaborator

This PR includes changes from @jakelorocco that implement intrinsics support, plus additional changes that I have made to enable the RAG intrinsics to work.

Jacob's changes:

  • Major rewrite of the guts of three different backends
  • GraniteCommonAdapter class and supporting classes
  • Replace code that calls aLoRA adapters directly with code that uses equivalent intrinsics
  • Some test cases
  • Documentation

My additional changes:

  • Modify intrinsics loading to support switching between Hugging Face Hub repositories (AKA "models")
  • Add Python functions to serve as entry points for existing RAG intrinsics
  • Add test cases of existing RAG intrinsics

@mergify

mergify Bot commented Nov 11, 2025

Copy link
Copy Markdown

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🟢 Enforce conventional commit

Wonderful, this rule succeeded.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

@frreiss frreiss changed the title Manual merge of main Draft: Updates for intrinsics support Nov 11, 2025
@frreiss frreiss changed the title Draft: Updates for intrinsics support feat: Updates for intrinsics support Nov 11, 2025
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
@jakelorocco
jakelorocco self-requested a review November 11, 2025 13:56

@jakelorocco jakelorocco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

looks mostly good to me! I left a few comments and we should definitely let others review as well (I will bring this up in our team meeting Wednesday).

Also, it looks like the pre-commit checks are failing. I think it's an issue from my base branch, but could you please run pre-commit run --files mellea/backends/openai.py. Or you can just move from enum import Enum below from copy import deepcopy in that file.

Once that gets fixed, we can make sure the github runners can run the new tests (else we'll have to mark them as qualitative). Thank you!

Comment thread mellea/stdlib/requirement.py Outdated
Comment thread mellea/backends/adapters/adapter.py Outdated
Comment thread mellea/stdlib/intrinsics/rag.py
Comment thread mellea/stdlib/intrinsics/rag.py Outdated
Comment thread test/stdlib_intrinsics/test_rag/test_rag.py
Comment thread mellea/stdlib/intrinsics/rag.py Outdated
Comment thread mellea/stdlib/intrinsics/rag.py Outdated
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Comment thread mellea/stdlib/intrinsics/rag.py Outdated
Comment on lines +62 to +67
base_model_name = backend.model_id
if base_model_name is None:
raise ValueError("Backend has no model ID")
adapter = GraniteCommonAdapter(
repo_id, intrinsic_name, adapter_type, base_model_name=base_model_name
)

@jakelorocco jakelorocco Nov 11, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

After the discussion on other comments, I also realize a difference here. Because we are no longer creating the adapter config in the backend, the base_model_name must be known here (when the Backend could be any type of backend).

Let me investigate a solution, but backend.model_id can be of types str | ModelIdentifier. At the very least, we should handle some basic version of the ModelIdentifier case. I was splitting on the .hf_model_name but that might not be the best assumption at this point.

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Comment thread mellea/backends/adapters/adapter.py Outdated

@jakelorocco jakelorocco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@frreiss, I also have a few changes related to my previous comments. How would you like to handle those? I can fork your fork and open up a PR, you can give me access to your repo, or I can send you the git diff.

Comment thread mellea/backends/adapters/adapter.py Outdated
@jakelorocco

Copy link
Copy Markdown
Contributor

@frreiss, I also have a few changes related to my previous comments. How would you like to handle those? I can fork your fork and open up a PR, you can give me access to your repo, or I can send you the git diff.

@frreiss, I opened up this fork and pull request with my changes: frreiss#3. Please let me know if you see any issues / would prefer I merge these changes differently. Otherwise, please merge if you are okay with them.

feat: small changes to intrinsics; along with fixes to docs / tests
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
@frreiss

frreiss commented Nov 15, 2025

Copy link
Copy Markdown
Collaborator Author

This PR should be ready to merge now, but the CI workflow keeps canceling itself after 7 minutes.

@jakelorocco
jakelorocco merged commit 52953a5 into generative-computing:main Nov 17, 2025
4 checks passed
akihikokuroda pushed a commit to akihikokuroda/mellea that referenced this pull request May 27, 2026
* test: remove hf .to(device)

* fix: remove alora model field from hf

* test: init commit; need to refactor a bunch

* test: basic doc support for openai

* fix: move intrinsic config setup to adapters

* test: push most recent changes

* test: split adapter add and load functions

* fix: start cleaning up some code

* feat: update vllm serve script for granite common intrinsic downloads

* feat: add intrinsics; remove bespoke aloras

* feat: add docs

* feat: add specific intrinsic and adapter tests

* fix: add note that only gcommon adapters/intrinsics are supported

* fix: add docstrings for types

* fix: update model in openai vllm test

* Add entry point for answerability

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Rewrite, citations, and context relevance

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Add additional intrinsics

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Fix broken test after merge

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Make linter happy and allow GPU usage with HF backend

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Fix stuff that was missed during manual merge

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* More manual merge issues

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* More manual merge issues

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Fix broken test

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Adjust type hints

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Add qualitative mark to tests

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Change import of obtain_lora()

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Update import

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Update code after breaking API changes

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* feat: small changes to intrinsics; along with fixes to docs / tests

* Fix errors introduced by merge

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Fix minor merge-induced issue

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Remove repo_id parameter

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Upgrade to latest peft and granite-common

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* Upgrade dependencies again

* Fix broken test

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>

* fix: make huggingface adapter test qualitative

* fix: issues with tests after refactor

---------

Signed-off-by: Fred Reiss <frreiss@us.ibm.com>
Co-authored-by: jakelorocco <jake.lorocco@ibm.com>
Co-authored-by: jakelorocco <59755218+jakelorocco@users.noreply.github.com>
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