feat(ast): introduce Global Analyzer agent and rank aggregation for multi-metric optimization#3
Open
Aidaarka wants to merge 2 commits into
Open
Conversation
…metric optimization
…ulti-metric optimization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This Pull Request introduces a Global Analyzer module and Rank Aggregation to the
Trainerpipeline, significantly enhancing the Automatic Suffix Tuning (AST) process.While the original CriSPO architecture excels at single-prompt local feedback via the
Critiquemodule, it lacks a mechanism to evaluate cross-candidate trade-offs during multi-metric optimization (e.g., balancing ROUGE vs. AlignScore). This PR addresses this limitation. The newAnalyzerexplicitly evaluates thetop-kcandidates simultaneously, diagnoses metric conflicts, and generates a global guidance string to stabilize the meta-optimizer and prevent task drift.Key Changes in the Diff
1. Core Trainer Enhancements (
crispo/trainer/trainer.py)evaluatemethod to compute a mean rank (rank_score) when using aMetricDict. This mathematically penalizes prompts that overfit to a single metric.update_analyzerexecution block inside the mainfitloop. It isolates the top-performing prompt records of the current step and processes them to extract cross-metric trade-offs.fill_in_meta_promptmethod to accept theanalyzer_analysisstring, appending this global strategy to the instructions sent to the optimizer LLM.analyzer_prompt,analyzer_top_k, andanalyzer_num_examplestoTrainer.fit()to allow flexible control over the analysis phase.2. Analyzer Interfaces (
crispo/task/analyzer.py)AnalyzerPromptabstract base class, establishing a strict interface (fillandparsemethods) for structured global feedback extraction.3. Task-Specific Analyzer Prompts
crispo/task/ast/analyzer_suffix.py): ImplementedSuffixAnalyzerPromptto instruct the LLM to identify recurring failure patterns and output actionable suggestions safely inside<analysis>XML tags.experiments/summarization/ast/critique/analyzer_prompt.py): Implemented a domain-specific analyzer prompt tailored for abstractive summarization trade-offs.Impact & Benefits
Testing & Validation
Trainer.fitloop locally with theanalyzer_promptargument enabled.<analysis>XML tags during generation.