Skip to content

feat: add Granite 4.2 model defaults - #1587

Draft
planetf1 wants to merge 12 commits into
generative-computing:mainfrom
planetf1:feat/granite-4-2-defaults
Draft

feat: add Granite 4.2 model defaults#1587
planetf1 wants to merge 12 commits into
generative-computing:mainfrom
planetf1:feat/granite-4-2-defaults

Conversation

@planetf1

@planetf1 planetf1 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Pull Request

Issue

Fixes #1583

Description

Make Granite 4.2 3B the default local text model, and add the public 3B, 8B,
and 30B identifiers. The PR also aligns CI, the GPU runner, and existing
Ollama/vLLM tests with the published model tags so the same model is selected
locally and in automation.

What changed

  • Add Granite 4.2 model identifiers for Hugging Face and Ollama.
  • Change the default 3B local model used by start_session,
    OllamaModelBackend, and LiteLLMBackend.
  • Update Ollama, OpenAI-compatible, and vLLM test fixtures and runners to use
    the same Granite 4.2 text model.
  • Keep adapter-function tests on Granite 4.1: the pinned public adapter
    catalogues do not provide Granite 4.2 weights.
  • Keep image tests on the Granite Vision 4.1 GGUF model. Granite 4.2 is a
    dense text-model update; this PR does not introduce a Granite 4.2 vision
    model.
  • Make formatter-only tool tests use the existing mocked Ollama fixture rather
    than require a running Ollama service.

Why the test-runner changes are included

The runner provisions the models that live tests use. Changing the default
model therefore also requires updating the published Ollama tags, constraining
the test context window, and keeping the Ollama and vLLM test lanes isolated.
Without those changes, a clean test environment can select an unavailable model
or start incompatible inference servers together.

Things to check

  • HF span coverage is intentionally deferred to enhancement: huggingface should handle ModelOption.THINKING #1212. This PR expresses
    ModelOption.THINKING=False; enhancement: huggingface should handle ModelOption.THINKING #1212 supplies the Hugging Face backend mapping
    from that public option to the loaded model's chat-template variable.
  • The unquantised 30B model remains catalogued but is not selected by local
    adapter tests. It should be exercised only on suitably provisioned GPU
    hardware.
  • Vision coverage intentionally remains on the existing Granite Vision 4.1
    GGUF model, with a constrained context window.
  • Full CUDA GPU verification remains pending while the test-runner isolation
    work is completed.

Current status

  • Published Ollama tags covered by regression tests.
  • Local static checks: Ruff and mypy.
  • Targeted model-tag tests: 154 passed, 46 skipped.
  • Full local non-qualitative suite: 3,988 passed, 181 skipped,
    128 deselected, 1 xpassed.
  • Full CUDA GPU suite: in progress.
  • Vision live e2e: Granite Vision 4.1 GGUF path verified.
  • Tool-call behaviour: verified with the explicit tool-capable model.
  • GitHub Actions quality matrix: re-running on the fix. The last red
    run (32972890653)
    is now root-caused as two Ollama-stall failure shapes, not a model-defaults
    defect: the non-streaming LiteLLM test hit the 900 s watchdog because that
    path had no bounded request deadline and no retryable error, and the native
    live tests exhausted the ReadTimeout retry. Commit c0278730 bounds the
    LiteLLM test to the same 300 s as the native backend, extends the retry net
    to the LiteLLM timeout shape (regression-pinned), and captures the Ollama
    server log so future stalls are diagnosable. The remaining pre-existing
    issues (server-side stall cause; an empty-response shape seen on main)
    are tracked in #1589.
    Neither result is treated as waived: the matrix must pass before this draft
    is ready for review.
  • DCO check.
  • enhancement: huggingface should handle ModelOption.THINKING #1212 follow-up: not included in this branch; rerun HF span coverage
    after enhancement: huggingface should handle ModelOption.THINKING #1212 merges.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code was added
  • uv run ruff format --check .
  • uv run ruff check .
  • uv run mypy .
  • uv run pytest test/ -m "not qualitative" on the final head.
  • Full CUDA GPU verification.
  • GitHub Actions quality matrix.

Attribution

  • AI coding assistants used

Adding a new component, requirement, sampling strategy, or tool?

  • Component
  • Requirement
  • Sampling Strategy
  • Tool

@github-actions github-actions Bot added the enhancement New feature or request label Aug 26, 2026
…sting

DO NOT PUSH — ibm-research/ namespace is internal/unreleased.
Local evaluation on eval/granite-4.2-prerelease branch only.

Signed-off-by: Nigel Jones <nigel_jones@uk.ibm.com>
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Switch every test fixture and direct OllamaModelBackend/LocalHFBackend
instantiation from granite-4.1 to granite-4.2 (ibm-research/ namespace,
ollama granite-4.2-{3b,8b,30b}:latest tags).

Key changes:
- Add ModelOption.THINKING: False to all direct OllamaModelBackend
  instantiations (tracing, metrics, genstub, component_typing tests)
  to prevent thinking-token slowdowns
- Add default_extra_body={chat_template_kwargs:{enable_thinking:False}}
  to OpenAI backend fixtures (test_openai_ollama, test_metrics_backend)
- Add model_options={THINKING:False} to LiteLLM backend in test_metrics_backend
- HF tests (test_huggingface, test_spans, test_rag, test_core) updated to
  ibm-research/granite-4.2-3b — accessible with HF_TOKEN
- Update granite4.1 string references in test_base_context context-length
  prefix tests to use granite-4.2 Ollama tag equivalents

Eval-branch only — not for main until 4.2 is publicly released.

Assisted-by: IBM Bob
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
…runs

- test_huggingface.py: add _hf_model_for_eval() — reads GRANITE42_MODEL to
  select IBM_GRANITE_4_2_{3B,8B,30B}; defaults to 3B
- test_ollama.py: add _ollama_model_for_eval() — same logic for Ollama tags;
  start_session() and _ensure_model_warm now use the selected tag

LSF tasks updated in .local/ to pass GRANITE42_MODEL inside bsub bash -c body.

Assisted-by: IBM Bob
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
@planetf1
planetf1 force-pushed the feat/granite-4-2-defaults branch from c798894 to 2eabb25 Compare August 26, 2026 12:00
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Assisted-by: Codex
Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
@github-actions

Copy link
Copy Markdown
Contributor

This comment is managed by a bot. Editing it is fine — checking off boxes, adding notes — but please leave the HTML comment marker on the first line alone, otherwise checklist updates will break.

Tool PR Checklist

Use this checklist when adding or modifying tools in mellea/stdlib/tools/.

Protocol Compliance

  • Ensure compatibility with existing backends and providers
    • For most tools being added as functions, this means that calling convert_function_to_tool works

Integration

  • Tool exported in mellea/stdlib/tools/__init__.py or, if you are adding a library of tools, from your sub-module

Quality-matrix runs on PR generative-computing#1587 hit two Ollama stall failure shapes the
existing retry net could not handle:

- test_litellm_token_metrics_integration[non-streaming] died to the 900 s
  pytest-timeout watchdog: LiteLLMBackend passes no request deadline, so
  litellm falls back to a 600 s per-attempt timeout and the OpenAI SDK
  silently retries a stalled attempt (verified: 3 attempts on a stalled
  socket), exhausting the budget with no retryable error.
- The flaky marker from generative-computing#1369 matched only the native httpx.ReadTimeout
  shape; the litellm path raises litellm.exceptions.Timeout whose
  APITimeoutError message never matched, so its retry was dead code.

Changes:
- Bound the litellm live test to the same 300 s the native
  OllamaModelBackend uses, with num_retries: 0 so one pytest attempt can
  never exceed the watchdog budget (verified end-to-end through
  LiteLLMBackend against a stalled socket: 1 request, 4.1 s at timeout=4).
- Extend the conftest flaky marker to a shared
  OLLAMA_TIMEOUT_RERUN_PATTERNS constant covering both timeout shapes, and
  pin the match behaviour in test/test_flaky_ollama_rerun.py (including
  that the watchdog kill itself is NOT retried).
- Capture the Ollama server log in the quality workflow and dump it on
  failure: server-side stalls were previously undiagnosable from the job
  log (zero server lines across a 90-minute test window).

Local verification: new regression tests + litellm, native-Ollama metrics
and tracing live tests pass against Ollama 0.33.0 / granite4.2:3b;
ruff, mypy clean.

Signed-off-by: Nigel Jones <jonesn@uk.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Granite 4.2 models

1 participant