Skip to content

feat: wire family aliases - #208

Merged
thushan merged 3 commits into
mainfrom
feature/wire-family-aliases
Aug 5, 2026
Merged

feat: wire family aliases#208
thushan merged 3 commits into
mainfrom
feature/wire-family-aliases

Conversation

@thushan

@thushan thushan commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Follow-up to #206/#207. The model unification config carried two fields that were parsed but never consumed: model_extraction.family_aliases and special_rules.preserve_family. This wires both into the family-extraction pipeline, and uses the new mechanism to fix the Kimi-K2 misclassification flagged by review on #207.

Changes

  • preserve_family guard: runs before all extraction stages with exact-token/prefix matching (never bare substring). Listed models keep their full family name instead of being collapsed by architecture mappings or patterns:
  • deepseek-coder-v2 stays deepseek-coder-v2 rather than collapsing to deepseek
  • nomic-bert gains a family (previously extracted as "")
  • family_aliases consumption, in two places:
  • fallback when an architecture string misses architecture_mappings (e.g. arch deepseek2 reported by some GGUFs)
  • the delimiter-based fallback stage, replacing behaviour previously driven by a hardcoded family list with config-driven lookup (existing families unchanged)
  • Kimi-K2 fix: kimi added to preserve_family. Kimi-K2 GGUFs report architecture deepseek/deepseek2 (shared lineage), so arch-based extraction misclassified them; they now resolve to family kimi regardless of arch metadata. Chosen over inverting name-vs-arch precedence globally, which would affect every model where the two disagree.

Scope

Family feeds only the /olla/models family field and its ?family= filter. Unified model IDs, sticky-session keys, routing and the status/dashboard grouping (which uses the provider-reported details.family) are unaffected.

Notes

  • kimi-k2 now extracts variant "" (preserve short-circuits pattern matching) - the same trade-off deepseek-coder-v2 and nomic-bert make.
  • devstral resolves via its explicit pattern from chore: models 2026 refresh #207 (family devstral), not the devstral -> mistral alias; the alias remains reachable only through the arch-miss and delimiter fallbacks.

Summary by CodeRabbit

  • Bug Fixes
    • Improved model family detection for Kimi models, preserving correct identification when architecture metadata differs.
    • Improved recognition of DeepSeek models when provider metadata is unavailable.
    • Added more reliable handling of model-name aliases, publisher prefixes and delimiters.
    • Prevented partial name matches from incorrectly changing a model’s family classification.
    • Improved consistency when identifying model families across different naming formats and configurations.

thushan added 2 commits August 5, 2026 21:04
Kimi-K2 GGUF files often report general.architecture "deepseek2" or
"deepseek" since they share the same underlying transformer as
DeepSeek-V3, and architecture-based lookup ran ahead of name-pattern
matching, so a Kimi model reporting that arch got classified as
deepseek. Adding kimi to special_rules.preserve_family lets the name
win instead, via the token-prefix check that already runs ahead of the
arch stage - chosen over inverting arch-vs-name precedence globally.
@thushan thushan self-assigned this Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 06f7a362-9718-46ab-b5db-986ed0358144

📥 Commits

Reviewing files that changed from the base of the PR and between 9a73e65 and 492a40e.

📒 Files selected for processing (2)
  • internal/adapter/unifier/metadata_extractor.go
  • internal/adapter/unifier/metadata_extractor_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • internal/adapter/unifier/metadata_extractor.go
  • internal/adapter/unifier/metadata_extractor_test.go

Walkthrough

The change adds Kimi to preserved model families. Metadata extraction now prioritises configured families, supports token-boundary matching and aliases, and retains fallback handling for known families. Tests cover Kimi, DeepSeek, aliases, and nil configuration.

Changes

Model family extraction

Layer / File(s) Summary
Preserved-family configuration
config/models.yaml, internal/adapter/unifier/model_config.go
The default and YAML configurations now preserve the kimi family.
Configured family matching
internal/adapter/unifier/metadata_extractor.go
Extraction checks preserved families before architecture and pattern matching. It supports token boundaries, configured aliases, and known-family delimiter fallback.
Extraction regression coverage
internal/adapter/unifier/metadata_extractor_test.go, internal/adapter/unifier/metadata_integration_test.go
Tests cover Kimi preservation, DeepSeek compatibility, alias matching, nil configuration, and missing provider family metadata.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • thushan/olla#206: This PR also modifies model-family preservation configuration and default mappings.
  • thushan/olla#207: Both changes update model-family configuration and metadata extraction for Kimi and DeepSeek handling.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarises the main change: wiring family aliases and preservation rules into model family extraction.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/wire-family-aliases

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
internal/adapter/unifier/metadata_extractor.go (1)

251-251: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove or replace this redundant comment.

Line 251 repeats the function name and describes behaviour. State the reason for the helper, or remove the comment.

As per coding guidelines, comment on why, not what.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/adapter/unifier/metadata_extractor.go` at line 251, Remove the
redundant comment above extractFromArchitecture, or replace it with a concise
explanation of why the helper is needed rather than restating what the function
does.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/adapter/unifier/metadata_extractor.go`:
- Around line 223-225: Update the model-name matching flow in the metadata
extraction logic to remove the publisher prefix before calling
matchesTokenPrefix, ensuring names such as moonshotai/Kimi-K2-Instruct match
kimi before deepseek architecture handling takes effect. Add a regression test
covering this architecture collision and preserving the expected model
classification.

---

Nitpick comments:
In `@internal/adapter/unifier/metadata_extractor.go`:
- Line 251: Remove the redundant comment above extractFromArchitecture, or
replace it with a concise explanation of why the helper is needed rather than
restating what the function does.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 673895eb-5e09-4061-9121-69fecb8f46d3

📥 Commits

Reviewing files that changed from the base of the PR and between a268548 and 9a73e65.

📒 Files selected for processing (5)
  • config/models.yaml
  • internal/adapter/unifier/metadata_extractor.go
  • internal/adapter/unifier/metadata_extractor_test.go
  • internal/adapter/unifier/metadata_integration_test.go
  • internal/adapter/unifier/model_config.go

Comment thread internal/adapter/unifier/metadata_extractor.go Outdated
matchPreserveFamily ran its token-prefix check against the whole model
name, so a publisher-prefixed name like moonshotai/Kimi-K2-Instruct
(common from LM Studio and vLLM) never matched the kimi entry and the
deepseek arch string won instead - the exact misclassification the
kimi fix was meant to close, just surviving for prefixed names. Now
strips everything up to and including the last '/' before checking,
while the arch-equality check keeps using the raw arch string.
@thushan
thushan merged commit 6e51ca0 into main Aug 5, 2026
6 checks passed
@thushan
thushan deleted the feature/wire-family-aliases branch August 5, 2026 11:48
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.

1 participant