Skip to content

[BUG] Incompatible Model Combination Leads to Sample Can Not Be Loaded #536

@weiyuanyue

Description

@weiyuanyue

When a scenario contains multiple samples with different model type requirements, the model picker allows users to select model combinations that no individual sample supports, resulting in viableSamples.Count == 0 and preventing any sample from loading.

Steps to Reproduce

  1. Navigate to a scenario that contains multiple samples with different Model1Types requirements

    • For example, Text -> Retrieval Augmented Generation (RAG) might have:
      • Sample A requiring Model1Types = [LanguageModels]
      • Sample B requiring Model1Types = [KnowledgeRetrieval]
  2. Open the model picker - observe that it shows models from both LanguageModels and KnowledgeRetrieval types (union of all samples' requirements)

  3. Select the 1st model "Retrieval Augmented Generation (RAG)" (that belongs to KnowledgeRetrieval type)

  4. Select the 2nd model "all-MiniLM" (that belongs to KnowledgeRetrieval type, too)

Image
  1. Click "Run Sample"

  2. The sample can not be loaded then always show the loading image:

Image

Expected Behavior

Either:

  • The model picker should only show models that are compatible with at least one complete sample configuration, OR
  • The UI should provide clear feedback explaining why the selection is invalid

Actual Behavior

  • The model picker closes and immediately reopens without any error message
  • No sample loads
  • User is left confused with no indication of what went wrong
  • The debug output shows: viableSamples.Count == 0

Code Analysis

Location: ScenarioPage.xaml.cs

Collection Logic (LoadPicker, lines ~99-106)

// Merges ALL model types from ALL samples (UNION)
List<List<ModelType>> modelDetailsList = [samples.SelectMany(s => s.Model1Types).ToList()];

This allows the picker to show models from any type that any sample needs.

Validation Logic (HandleModelSelectionChanged, lines ~249-251)

// Requires finding a sample that matches BOTH selected models (INTERSECTION)
List<Sample> viableSamples = samples!.Where(s =>
    IsModelFromTypes(s.Model1Types, selectedModels[0]) &&
    IsModelFromTypes(s.Model2Types, selectedModels[1])).ToList();

This requires at least one sample to support the entire selected model combination.

The Mismatch: Collection uses union logic, but validation uses intersection logic, creating a gap where users can select "theoretically valid but practically unsupported" model combinations.

Debug Output Example

[IsModelFromTypes] Checking model: 6a526fdd-359f-4eac-9aa6-f01db11ae542, Name: Retrieval Augmented Generation (RAG)
[IsModelFromTypes] Required types: LanguageModels, PhiSilica
[IsModelFromTypes] Total 14 model IDs collected. Model 6a526fdd-359f-4eac-9aa6-f01db11ae542 NOT FOUND

[IsModelFromTypes] Checking model: 6a526fdd-359f-4eac-9aa6-f01db11ae542
[IsModelFromTypes] Required types: KnowledgeRetrieval, PhiSilica
[IsModelFromTypes] Total 2 model IDs collected. Model 6a526fdd-359f-4eac-9aa6-f01db11ae542 FOUND

The RAG model is found in KnowledgeRetrieval type but not in LanguageModels type, yet both types were presented as valid options to the user.

Additional Notes

  • The code comment states // this should never happen, but this scenario does occur in practice
  • When viableSamples.Count == 0, the code simply calls App.MainWindow.ModelPicker.Show(selectedModels) without providing any user feedback about why the selection failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions