Skip to content

Initial evaluation schema validation#59

Merged
Erotemic merged 9 commits into
mainfrom
dev/eval-card-validation
Jul 2, 2026
Merged

Initial evaluation schema validation#59
Erotemic merged 9 commits into
mainfrom
dev/eval-card-validation

Conversation

@nitesh201

Copy link
Copy Markdown
Contributor

No description provided.

@dmjoy dmjoy 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.

This seems like a totally fine place to start. I just left a few comments / minor requests. Would also be curious if it's possible to log warnings about missing or incomplete fields rather than just failing validation (i.e. we could warn that they haven't completed the "recommended" fields instead of strictly requiring them).

Comment thread magnet/evaluation.py Outdated
Comment thread magnet/evaluation.py Outdated
Comment thread magnet/schema.py Outdated
Comment thread magnet/schema.py Outdated
Comment thread magnet/schema.py Outdated
)
return self

# TODO: check with David what this should look like

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.

The claim_aggregation_strategy field looks something like:

claim_aggregation_strategy:
  type: fraction  # could be 'fraction', 'all', 'any'
  parameters:  # this is an optional dict with arbitrary parameters in theory, though we currently only have the 'fraction' type implemented that has a paremeter, and that paremeter is 'threshold'
    threshold: 0.6

Comment thread magnet/schema.py Outdated
Comment thread magnet/schema.py Outdated
description: str
claim: ClaimSchema

# --- Recommended metadata ---

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.

I'm leaning toward these being required metadata (if teams are missing these fields currently we are asking them to provide it).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@b-fenelon - have we settled on whether to make these fields required?

@b-fenelon b-fenelon Jun 18, 2026

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.

I would err on the side of making fields required. Those fields don't dictate evaluation strategy and probably shouldn't be a requirement for running a card (e.g. in testing), but we expect these entries for official submissions.

If this causes failures because of the example cards, I can populate fields as needed

Comment thread magnet/schema.py
pipeline: Optional[dict[str, Any]] = None

@model_validator(mode='after')
def exclusive_backends(self) -> 'EvaluationCardSchema':

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.

Might be good to check in here that if they don't define a kwdagger or pipeline field, that they should have symbols defined.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@b-fenelon just to clarify the order of checks, is it possible to have a card that defines both symbols and one of pipeline and kwdagger?

@b-fenelon b-fenelon Jun 18, 2026

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.

Yes, it's safe to say symbols is always valid (for now). Though, the current iteration of evaluating the kwdagger field may not make use of symbols, but I don't think we should restrict it

@dmjoy

dmjoy commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

I should mention I also played around with these changes locally and it seemed to work well enough on the few cards I threw at it (some valid, some not)

@nitesh201 nitesh201 changed the title Draft: initial evaluation schema (some questions marked with TODOs) Initial evaluation schema validation Jun 22, 2026
@nitesh201

Copy link
Copy Markdown
Contributor Author

@b-fenelon ready for review.

@b-fenelon

Copy link
Copy Markdown
Contributor

No objections here

@Erotemic Any strong thoughts?

@Erotemic Erotemic 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.

Two nitpicks and one real requested change in the inline comments.

Additionally, I don't see any tests. We should add tests for schemas that correctly validate and error. This is critical. This feature requires corresponding tests.

Comment thread magnet/schema.py
Comment thread magnet/schema.py Outdated
links: list[LinkSchema]

# --- Recommended ---
category: Optional[str] = None

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.

I prefer ... | None over Optional[...], but I'm not going to block the PR on this detail.

Comment thread magnet/evaluation.py Outdated
with open(path, 'r') as f:
cfg = yaml.safe_load(f)

EvaluationCardSchema.model_validate(cfg)

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.

Can we make validation optional? Type checking is growing on me, but I've hit too much friction in libraries that do aggressive type validation (cough jsonargparse cough), even though if you ignored the check the code would run correctly.

I suggest change validate_only (the name of which is sort of a code smell), to --validate which is a Value with choices=['only', 'error', 'warning', 'off']. If it is set to "only", we do the validate only behavior. If it is "error" we do the current behavior. For "warning" it is similar, but catches the error emits a warning and tries to proceed anyway, and "off" ignores it entirely. The default should be "error".

@brianhhu

brianhhu commented Jun 26, 2026

Copy link
Copy Markdown

@nitesh201 Can you make a push to address the final reviewer comments and get this merged?

@Erotemic

Erotemic commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

LGTM.

@Erotemic
Erotemic merged commit 47614e7 into main Jul 2, 2026
17 checks passed
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.

5 participants