Skip to content

Add support for multiple Wikimedia ML models (not just revertrisk) #90

Description

@xenacode-art

Currently, PR #45 implements revertrisk (language-agnostic revert risk prediction) as the only
ML model for auto-review decisions. However, Wikimedia provides many other ML
models
that could be useful for
different wikis and languages.

This issue proposes making the ML model system generic and configurable, allowing wikis to
choose which model(s) work best for their language and use case.

Background (from @zache-fi )

"The thing is that without testing we do not know (or least i do not know) how well
different models are working and probaply their performance differs depending on language. Ie.
some model would be better in certain language and older ORES models are probaply pretty good
in languages where there was lot of manual labelled training data, but not so good in
others."

Current State (PR #45)

  • ✅ Revertrisk API integration implemented
  • revertrisk_threshold field in WikiConfiguration
  • ✅ Hardcoded to use only revertrisk model
  • ⚠️ Not flexible for other models

Proposed Changes

1. Database Schema

Add fields to WikiConfiguration to support multiple models:

class WikiConfiguration(models.Model):
    # ... existing fields ...

    # New fields for generic ML support
    ml_model_type = models.CharField(
        max_length=50,
        default='revertrisk',
        choices=[
            ('revertrisk', 'Revert Risk (language-agnostic)'),
            ('articlequality', 'Article Quality'),
            ('articletopic', 'Article Topic'),
            ('damaging', 'Damaging Edit Detection'),
            ('goodfaith', 'Good Faith'),
            # More models from https://meta.wikimedia.org/wiki/Machine_learning_models
        ],
        help_text="Which Wikimedia ML model to use for this wiki"
    )

    ml_model_threshold = models.FloatField(
        default=0.0,
        help_text="Threshold for ML model score (0.0-1.0). Set to 0.0 to disable."
    )

2. Refactor Backend

- Abstract the ML API call logic from _get_revertrisk_score() into a generic
_get_ml_score(model_type, revision) function
- Support different API endpoints and response formats for different models
- Make the autoreview check model-agnostic

3. Vue.js Configuration Panel

Add model selection dropdown alongside the threshold input:
- Dropdown to select which ML model to use
- Threshold input (already being added in PR #45)
- Description of what each model does
- Link to Wikimedia ML models documentation

4. Documentation

- Document available models and their use cases
- Explain which models work best for which languages
- Provide examples of good threshold values

Available Wikimedia ML Models

From https://meta.wikimedia.org/wiki/Machine_learning_models:

<img width="991" height="214" alt="Image" src="https://github.com/user-attachments/assets/17152c5a-d59e-45d4-89a8-ebb9321991e1" />


Benefits

1. Language flexibility: Wikis can choose models that work best for their language
2. Testing capability: Compare different models to see which performs better
3. Future-proof: Easy to add new models as Wikimedia releases them
4. Graceful fallback: Can configure a fallback model if primary model fails

Implementation Phases

Phase 1: Backend Refactoring

- Refactor _get_revertrisk_score() to be model-agnostic
- Add support for 2-3 additional models (e.g., damaging, goodfaith)
- Update database schema with migrations

Phase 2: UI Support

- Add model selection dropdown to Vue.js config panel
- Show model-specific help text and documentation
- Allow per-wiki model configuration

Phase 3: Testing & Documentation

- Test different models on different language wikis
- Document which models work best where
- Provide recommended configurations

Questions

1. Should we support multiple models simultaneously (e.g., check BOTH revertrisk AND
damaging)?
2. Should model thresholds be per-model or global?
3. Should we implement automatic model selection based on wiki language?
4. Should there be a fallback model if the primary model API fails?

Related

- Builds on: #18, PR #45
- Wikimedia ML Models: https://meta.wikimedia.org/wiki/Machine_learning_models
- API Documentation: https://api.wikimedia.org/wiki/Lift_Wing_API

---
@zache-fi  requested this as a separate enhancement. Happy to work on this or collaborate with     
anyone interested!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions