AI Engineer39 min
An Agent That Fixes Its Own Mistakes - Saloni Gandhi & Ziwei Guo, LinkedIn
Conference Presentation, Tutorial
Project Scope & Objective
- LinkedIn is deploying a Recursive Self-Improvement (RSI) system focused on "user understanding" for the Career Agent to help members achieve career goals.
- The core goal is to create an AI loop where the system learns from production traces, identifies bottlenecks via objective evaluation, and iteratively optimizes itself.
- Current optimization scope targets the "harness" (planning, context, tools, artifact storage) and prompt engineering, explicitly excluding direct base model fine-tuning.
Optimization Ladder Strategy
- Level 1 (Prompt Updates): The immediate, most straightforward optimization layer for iterating AI systems.
- Level 2 (Structural Context): Optimizing the session state management and system structure.
- Level 3 (Workflow Design): Automatically designing entire workflows and meta-information structures.
- Level 4 (Harness Code): Modifying the underlying orchestration code itself.
- Level 5 (Optimizer Code): Optimizing the code that drives the improvement loop.
- Current active focus is on Level 1 (prompt optimization) with plans to expand to higher complexity levels.
The 7-Step RSI Workflow
- Step 1 (Trace Generation): Run the agent to generate outputs and log process traces (e.g., for a Career Agent query).
- Step 2 (Evaluation): Use an evaluation engine (specifically the "ARM Judge") to score outputs and identify performance gaps.
- Step 3 (Reflection/Root Cause Analysis): Diagnose the underlying cause of failures through a four-part internal process:
- Clustering: Group failing traces by dimension without LLM involvement.
- L2 Judge Diagnosis: Use an LLM to assign root causes and tags to individual rows.
- Deduplication: Merge similar free-text root causes into canonical labels (e.g., merging "missing profile data" with "profile data doesn't show full picture").
- Ranking: Group and rank canonical issues by frequency to identify major bottlenecks.
- Step 4 (Edit Proposal): Generate specific edits (currently prompts, potentially workflows or code in the future) based on identified root causes.
- Step 5 (Validation): Use the same evaluation engine and rubrics to validate proposed edits against a holdout set.
- Step 6 (Evolution): Adapt and update the system prompts based on validated good candidates.
- Step 7 (Holdout Re-evaluation): Run final evaluation to confirm the new system outperforms the old baseline before updating the production version.
Target Agent: User Understanding
- Input: Member ID, which fetches search history, profile data, location, and preference data.
- Output: A "memory embedding" describing the user, including:
- Preferred job titles (e.g., Network Manager) with confidence scores.
- Citations supporting the titles (e.g., frequency in saved searches).
- Reasoning chains (e.g., "state of preference anchors primary title").
- Scoring: Judges use a 1-3 scale (1: Poor, 2: Fair, 3: Good) across specific dimensions like "Goal Summary" and "Preferred Job Title."
Key Findings: Evaluation Quality & Human Alignment
- Alignment Metrics: Analysis of ~180-200 human reviews revealed judge alignment varies by score:
- Score 1 (Poor): ~55% alignment with humans.
- Score 2 (Fair): ~57% alignment with humans.
- Score 3 (Good): ~80% alignment with humans.
- Dimensional Variance: Alignment was weakest for "Preferred Job Titles" and "Work Type" (~47-50%), indicating these rubrics need clearer definitions.
- Common Failure Modes:
- Judges prioritized plausibility over completeness (accepting plausible titles while missing omitted intent signals).
- Ambiguity in rubrics regarding expertise fields (Domain vs. Function vs. Skill).
- Overly harsh scoring on formatting errors (e.g., capitalization) rather than semantic meaning.
- Misalignment on whether unexplicitly stated member preferences should be considered valid.
- Impact of Improvements: After refining rubrics to normalize titles, handle concurrent employment, and clarify partial credit:
- Human alignment increased from 57% to 64%.
- Mean error decreased from 0.96 to 0.74.
- Alignment Metrics: Analysis of ~180-200 human reviews revealed judge alignment varies by score:
Key Findings: Reflection & Root Cause Diagnosis
- L2 Judge Challenge: Root cause attribution is significantly harder than simple scoring; agreement is high for model errors but low for rubric-related issues.
- Taxonomy Gap: Initial reflection systems lacked a mechanism to explicitly flag the judge itself as the error source, causing the system to sometimes blame the rubric incorrectly.
- Risk of Hallucination: The reflection system sometimes validated the L1 judge's rationale without independent verification, leading to modifications based on incorrect problem identification.
- Remediation: Introduced targeted changes to the L2 reflection agent to enforce independent validation and improve root cause taxonomy.
Strategic Focus Areas
- Quality: Extensive human annotation to improve L1/L2/L3 judge quality and mitigate LLM non-determinism.
- Automation: Established a weekly/bi-weekly cadence workflow to automatically run the RSI loop and suggest updates.
- Production Updates: Currently deploying changes via human-in-the-loop verification; planning to increase automation as trust metrics solidify.
Scaling Roadmap & Enterprise Vision
- Prerequisites for Scale: Successful RSI adoption requires a hierarchy of capabilities: Base Agents → Standardized Evaluation → Agentic Reflection → RSI Loop.
- Five-Pillar Acceleration Plan:
- Sanitize Evaluation Infrastructure: Build reusable, human-calibrated frameworks and metrics.
- Automate Feedback Loops: Systematically collect traces and detect recurring failures.
- Scale Automated Optimization: Move from ad-hoc changes to repeatable prompt/code optimization.
- Validation and Trust: Implement robust holdout evaluations and regression testing.
- Democratize RSI: Provide self-service components so teams can adopt the loop without building the full pipeline.
- Objective: The goal is not just to improve performance at a single point but to increase the first derivative of the performance curve (accelerate the rate of improvement).
Outcomes & Milestones
- Successfully deployed the first RSI-optimized improvement to production, validated by human review and quantitative metrics.
- Shifted focus from experimental workflows to reliable, continuous engineering loops.
- Identified that evaluation quality is as critical as the optimization engine; without trustworthy feedback, the RSI loop cannot function reliably.