File size: 3,487 Bytes
aa466c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import streamlit as st  # pyre-ignore
import numpy as np
import time
from models import Action  # pyre-ignore
from server.env import DebugOpsEnv  # pyre-ignore
from run_baseline import random_agent, heuristic_agent  # pyre-ignore

st.set_page_config(page_title="DebugOps-RX", page_icon="🐞", layout="wide")

st.title("🐞 DebugOps-RX Benchmark")
st.markdown("Evaluating LLM Agents in Real-World Debugging Uncertainty. **[Train, Test, OOD]** Splits.")

tab1, tab2 = st.tabs(["🏆 Leaderboard", "▶️ Live Agent Run"])

# ── Leaderboard ──
with tab1:
    st.subheader("Leaderboard (Mean Score ± Std over 5 Seeds)")
    
    # We display statically calculated tables from our run_baseline.py outputs for instant viewing
    st.markdown("""
    ### 🟢 Train Split
    | Agent | Easy | Medium | Hard | Extreme |
    |---|---|---|---|---|
    | **Heuristic** | 0.77 ± 0.01 | 0.18 ± 0.01 | 0.23 ± 0.00 | 0.79 ± 0.00 |
    | **Random** | 0.07 ± 0.06 | 0.04 ± 0.06 | 0.02 ± 0.03 | 0.00 ± 0.01 |

    ### 🔴 OOD Split
    | Agent | Easy | Medium | Hard | Extreme |
    |---|---|---|---|---|
    | **Heuristic** | 0.78 ± 0.01 | 0.18 ± 0.01 | 0.23 ± 0.00 | 0.79 ± 0.00 |
    | **Random** | 0.07 ± 0.05 | 0.03 ± 0.06 | 0.02 ± 0.03 | 0.00 ± 0.01 |
    """)

# ── Live Run ──
with tab2:
    st.subheader("Live Evaluation")
    
    col1, col2, col3 = st.columns(3)
    agent_sel = col1.selectbox("🤖 Select Agent", ["Heuristic", "Random"])
    diff_sel = col2.selectbox("🔥 Difficulty", ["easy", "medium", "hard", "extreme"])
    split_sel = col3.selectbox("🔀 Split", ["train", "test", "ood"])
    
    if st.button("🚀 Run Agent", use_container_width=True):
        agent_fn = heuristic_agent if agent_sel == "Heuristic" else random_agent
        
        env = DebugOpsEnv(seed=42)
        try:
            obs = env.reset(difficulty=diff_sel, split=split_sel)
        except Exception as e:
            st.error(f"Error loading task: {e}")
            st.stop()
            
        st.info(f"Loaded Task. Bug: `{env.hidden.bug_type}` | Noise (η): `{env.hidden.eta:.2f}` | Drift (δ): `{env.hidden.delta:.2f}`")
        
        trajectory = []
        done = False
        step_count = 0
        
        log_container = st.container()
        
        with log_container:
            for step_count in range(30):
                if done: break
                
                action = agent_fn(obs)
                obs, reward, done, info = env.step(action)
                trajectory.append(action)
                
                target = action.target or "N/A"
                if action.type == "analyze_logs":
                    st.toast(f"Step {step_count+1}: Extracted Logs")
                    st.text(f"Action: {action.type} -> Observes:\n{obs.logs}")
                else:
                    st.text(f"Step {step_count+1} | Action: {action.type} | Target: {target} | Reward: {reward}")
                    
                time.sleep(0.1) # UI delay for live effect

        score = env.grade(trajectory)
        
        st.success(f"✅ Episode Finished in {step_count} steps.")
        c1, c2, c3, c4, c5 = st.columns(5)
        c1.metric("Correctness", f"{score.correctness:.2f}")
        c2.metric("Efficiency", f"{score.efficiency:.2f}")
        c3.metric("Reasoning", f"{score.reasoning_quality:.2f}")
        c4.metric("Robustness", f"{score.robustness:.2f}")
        c5.metric("🎯 Final Score", f"{score.final():.3f}")