Implementation:Ucbepic Docetl Directive ChangeModelAcc
| Knowledge Sources | |
|---|---|
| Domains | Pipeline_Optimization, LLM_Operations |
| Last Updated | 2026-02-08 00:00 GMT |
Overview
Concrete tool for switching an operator to a more accurate (powerful) LLM model provided by the DocETL reasoning optimizer.
Description
The ChangeModelAccDirective class rewrites an operator to use a more powerful LLM model to optimize accuracy. It prioritizes model performance and quality over cost considerations, typically suggesting more capable models like gpt-5 for complex reasoning tasks. The directive includes comprehensive model benchmark data including MRCR retrieval scores and pricing across GPT-5, GPT-4.1, GPT-4o, and Gemini 2.5 model families.
Usage
The MOAR agent applies this directive when accuracy and quality are the primary concerns and cost is secondary. Suitable for complex reasoning tasks, critical analysis, or when maximum model performance is needed. Typically tried when it has not been used in past iterations.
Code Reference
Source Location
- Repository: Ucbepic_Docetl
- File: docetl/reasoning_optimizer/directives/change_model_acc.py
- Lines: 1-303
Signature
class ChangeModelAccDirective(Directive):
name = "change model acc"
description = "Rewrites an operator to use a more powerful LLM model to optimize accuracy."
def check_applicability(self, ...) -> Tuple[bool, str]: ...
def apply(self, ...) -> Tuple[List[Dict], List[Dict], str, dict]: ...
Import
from docetl.reasoning_optimizer.directives.change_model_acc import ChangeModelAccDirective
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| op_config | Dict | Yes | Operation configuration to transform |
| pipeline_ops | List[Dict] | Yes | Full pipeline operations list |
| op_idx | int | Yes | Index of target operation |
| dataset_descriptions | Dict | Yes | Dataset schema descriptions |
Outputs
| Name | Type | Description |
|---|---|---|
| new_ops | List[Dict] | Transformed operation configs |
| new_steps | List[Dict] | Updated pipeline steps |
| explanation | str | Human-readable description of changes |
| metadata | dict | Additional metadata about the transformation |
Usage Examples
# Directives are typically invoked by the MOAR agent automatically
# Example of manual invocation:
from docetl.reasoning_optimizer.directives.change_model_acc import ChangeModelAccDirective
directive = ChangeModelAccDirective()
applicable, reason = directive.check_applicability(op_config, pipeline_ops, op_idx, dataset_descriptions)
if applicable:
new_ops, new_steps, explanation, metadata = directive.apply(op_config, pipeline_ops, op_idx, dataset_descriptions)