Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Wandb Weave Model Definition

From Leeroopedia
Knowledge Sources
Domains Model_Architecture, Evaluation
Last Updated 2026-02-14 00:00 GMT

Overview

A model abstraction pattern that encapsulates inference logic and configuration as a versioned, evaluable unit.

Description

Model Definition provides a standard interface for wrapping inference logic (LLM calls, ML models, rule-based systems) into a structured object whose configuration is automatically version-tracked. By defining model attributes as class fields and the inference logic as a traced method, changes to either the code or configuration are captured as new versions.

Usage

Use this principle when building an evaluable model. The model must expose a standard inference method (predict, infer, forward, or invoke) so the evaluation framework can automatically dispatch dataset examples to it.

Theoretical Basis

The Model pattern combines:

  1. Configuration as State: Model parameters (prompt templates, temperature, model name) are stored as Pydantic fields, enabling automatic serialization and versioning.
  2. Inference as Method: A single entry point method processes inputs and returns predictions.
  3. Method Discovery: The framework searches for methods named predict, infer, forward, or invoke (in that order).
  4. Automatic Tracing: The inference method must be decorated with @weave.op to enable call tracking during evaluation.

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment