Spaces:
Running
Running
Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,550 +1,305 @@
|
|
| 1 |
-
---
|
| 2 |
-
title: LogTriageEnv
|
| 3 |
-
emoji: 🚨
|
| 4 |
-
colorFrom: red
|
| 5 |
-
colorTo: red
|
| 6 |
-
sdk: docker
|
| 7 |
-
pinned: false
|
| 8 |
-
tags:
|
| 9 |
-
- openenv
|
| 10 |
-
- reinforcement-learning
|
| 11 |
-
- sre
|
| 12 |
-
- log-analysis
|
| 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 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
##
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
---
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
**
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
|
| 266 |
-
|
|
| 267 |
-
|
|
| 268 |
-
|
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
| 285 |
-
|
| 286 |
-
|
| 287 |
-
|
| 288 |
-
``
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
| 306 |
-
"difficulty": "medium",
|
| 307 |
-
"max_steps": 12,
|
| 308 |
-
"action_schema": { ... }
|
| 309 |
-
},
|
| 310 |
-
{
|
| 311 |
-
"id": "silent_degradation",
|
| 312 |
-
"name": "Silent Degradation with Noise",
|
| 313 |
-
"difficulty": "hard",
|
| 314 |
-
"max_steps": 15,
|
| 315 |
-
"action_schema": { ... }
|
| 316 |
-
}
|
| 317 |
-
]
|
| 318 |
-
}
|
| 319 |
-
```
|
| 320 |
-
|
| 321 |
-
---
|
| 322 |
-
|
| 323 |
-
## 9. Setup & Installation
|
| 324 |
-
|
| 325 |
-
### Prerequisites
|
| 326 |
-
|
| 327 |
-
- Python 3.10+
|
| 328 |
-
- Docker
|
| 329 |
-
- Hugging Face account + CLI
|
| 330 |
-
|
| 331 |
-
### Local installation
|
| 332 |
-
|
| 333 |
-
```bash
|
| 334 |
-
git clone https://github.com/<your-username>/logtriage-env
|
| 335 |
-
cd logtriage-env
|
| 336 |
-
|
| 337 |
-
# Install dependencies
|
| 338 |
-
pip install -r server/requirements.txt
|
| 339 |
-
|
| 340 |
-
# Validate OpenEnv compliance
|
| 341 |
-
openenv validate .
|
| 342 |
-
|
| 343 |
-
# Run the server locally
|
| 344 |
-
uvicorn server.app:app --host 0.0.0.0 --port 7860 --reload
|
| 345 |
-
```
|
| 346 |
-
|
| 347 |
-
### Run baseline inference
|
| 348 |
-
|
| 349 |
-
```bash
|
| 350 |
-
export HF_TOKEN=your_key_here
|
| 351 |
-
python inference.py
|
| 352 |
-
```
|
| 353 |
-
|
| 354 |
-
### Validate all 3 tasks manually
|
| 355 |
-
|
| 356 |
-
```bash
|
| 357 |
-
python scripts/run_grader.py --task single_crash
|
| 358 |
-
python scripts/run_grader.py --task cascading_failure
|
| 359 |
-
python scripts/run_grader.py --task silent_degradation
|
| 360 |
-
```
|
| 361 |
-
|
| 362 |
-
---
|
| 363 |
-
|
| 364 |
-
## 10. Docker Usage
|
| 365 |
-
|
| 366 |
-
```bash
|
| 367 |
-
# Build
|
| 368 |
-
docker build -t logtriage-env .
|
| 369 |
-
|
| 370 |
-
# Run
|
| 371 |
-
docker run -p 7860:7860 logtriage-env
|
| 372 |
-
|
| 373 |
-
# Test health
|
| 374 |
-
curl http://localhost:7860/health
|
| 375 |
-
|
| 376 |
-
# Test reset
|
| 377 |
-
curl -X POST http://localhost:7860/reset
|
| 378 |
-
|
| 379 |
-
# Run baseline inside container
|
| 380 |
-
docker run -e HF_TOKEN=your_key -e API_BASE_URL=https://api.groq.com/openai/v1 -e MODEL_NAME=llama-3.3-70b-versatile logtriage-env python inference.py
|
| 381 |
-
```
|
| 382 |
-
|
| 383 |
-
---
|
| 384 |
-
|
| 385 |
-
## 11. Hugging Face Spaces Deployment
|
| 386 |
-
|
| 387 |
-
The environment is deployed as a containerized HF Space tagged with `openenv`.
|
| 388 |
-
|
| 389 |
-
**Space URL:** `https://huggingface.co/spaces/<username>/logtriage-env`
|
| 390 |
-
|
| 391 |
-
The Space uses a Docker SDK with the following configuration:
|
| 392 |
-
|
| 393 |
-
```yaml
|
| 394 |
-
# README.md (HF Space header)
|
| 395 |
-
title: LogTriageEnv
|
| 396 |
-
emoji: 🚨
|
| 397 |
-
colorFrom: red
|
| 398 |
-
colorTo: red
|
| 399 |
-
sdk: docker
|
| 400 |
-
pinned: false
|
| 401 |
-
tags:
|
| 402 |
-
- openenv
|
| 403 |
-
- reinforcement-learning
|
| 404 |
-
- sre
|
| 405 |
-
- log-analysis
|
| 406 |
-
```
|
| 407 |
-
|
| 408 |
-
---
|
| 409 |
-
|
| 410 |
-
## 12. Baseline Inference Script
|
| 411 |
-
|
| 412 |
-
`inference.py` uses an OpenAI-compatible client with configurable provider settings to run any LLM (default: `meta-llama/Llama-3.3-70B-Instruct` via Hugging Face router) as a zero-shot SRE agent against all 3 tasks and reports structured scores.
|
| 413 |
-
|
| 414 |
-
### Environment Variables
|
| 415 |
-
|
| 416 |
-
| Variable | Default | Description |
|
| 417 |
-
|---|---|---|
|
| 418 |
-
| `HF_TOKEN` | *(required)* | API key for the LLM provider |
|
| 419 |
-
| `API_BASE_URL` | `https://router.huggingface.co/v1` | API endpoint |
|
| 420 |
-
| `MODEL_NAME` | `meta-llama/Llama-3.3-70B-Instruct` | Model identifier |
|
| 421 |
-
| `ENV_URL` | `http://localhost:7860` | LogTriageEnv server |
|
| 422 |
-
|
| 423 |
-
### Key Features
|
| 424 |
-
|
| 425 |
-
- **System prompt** — Structured SRE triage persona with action schema enforced via JSON output
|
| 426 |
-
- **Conversation history** — Bounded to 8 turns to stay within context limits
|
| 427 |
-
- **Fallback logic** — Heuristic fallback if LLM fails to parse or call; avoids episode crashes
|
| 428 |
-
- **Step rate limiting** — 200ms sleep between steps to avoid provider rate limits
|
| 429 |
-
- **Health check** — Validates environment is reachable before running tasks
|
| 430 |
-
- **Seeded reproducibility** — All tasks run with `seed=42`
|
| 431 |
-
|
| 432 |
-
### Usage
|
| 433 |
-
|
| 434 |
-
```bash
|
| 435 |
-
export HF_TOKEN=your_key_here
|
| 436 |
-
export API_BASE_URL=https://api.groq.com/openai/v1 # or HF router
|
| 437 |
-
export MODEL_NAME=llama-3.3-70b-versatile
|
| 438 |
-
|
| 439 |
-
python inference.py
|
| 440 |
-
```
|
| 441 |
-
|
| 442 |
-
### Output
|
| 443 |
-
|
| 444 |
-
The script prints a per-task score bar and returns a JSON block with full breakdown:
|
| 445 |
-
|
| 446 |
-
```json
|
| 447 |
-
{
|
| 448 |
-
"api_base_url": "https://api.groq.com/openai/v1",
|
| 449 |
-
"model_name": "llama-3.3-70b-versatile",
|
| 450 |
-
"seed": 42,
|
| 451 |
-
"results": [
|
| 452 |
-
{ "task_id": "single_crash", "score": 0.9999, "steps_taken": 4, "breakdown": {} },
|
| 453 |
-
{ "task_id": "cascading_failure", "score": 0.65, "steps_taken": 7, "breakdown": {} },
|
| 454 |
-
{ "task_id": "silent_degradation", "score": 0.55, "steps_taken": 5, "breakdown": {} }
|
| 455 |
-
],
|
| 456 |
-
"average_score": 0.7333,
|
| 457 |
-
"runtime_seconds": 97.4
|
| 458 |
-
}
|
| 459 |
-
```
|
| 460 |
-
|
| 461 |
-
---
|
| 462 |
-
|
| 463 |
-
## 13. Baseline Scores
|
| 464 |
-
|
| 465 |
-
Scores produced by `inference.py` using `llama-3.3-70b-versatile` via Groq API (`seed=42`):
|
| 466 |
-
|
| 467 |
-
| Task | Difficulty | Score |
|
| 468 |
-
|---|---|---|
|
| 469 |
-
| Single Service Crash | Easy | 0.9999 |
|
| 470 |
-
| Cascading Failure | Medium | 0.6500 |
|
| 471 |
-
| Silent Degradation | Hard | 0.5500 |
|
| 472 |
-
| **Average** | | **0.7333** |
|
| 473 |
-
|
| 474 |
-
> **Note:** Scores are clamped to the open interval (0, 1) — strictly between 0 and 1.
|
| 475 |
-
> A score of exactly 1.0 or 0.0 would fail Phase 2 validation.
|
| 476 |
-
|
| 477 |
-
---
|
| 478 |
-
|
| 479 |
-
## 14. OpenEnv Spec Compliance
|
| 480 |
-
|
| 481 |
-
| Requirement | Status |
|
| 482 |
-
|---|---|
|
| 483 |
-
| Typed `Action` Pydantic model | ✅ |
|
| 484 |
-
| Typed `Observation` Pydantic model | ✅ |
|
| 485 |
-
| `step(action)` → `(observation, reward, done, info)` | ✅ |
|
| 486 |
-
| `reset()` → initial observation | ✅ |
|
| 487 |
-
| `state()` → current state | ✅ |
|
| 488 |
-
| `openenv.yaml` with metadata | ✅ |
|
| 489 |
-
| `openenv validate` passes | ✅ |
|
| 490 |
-
| `/tasks` endpoint | ✅ |
|
| 491 |
-
| `/grader` endpoint | ✅ |
|
| 492 |
-
| `/baseline` endpoint | ✅ |
|
| 493 |
-
| Dockerfile builds cleanly | ✅ |
|
| 494 |
-
| HF Space deploys and responds | ✅ |
|
| 495 |
-
| Baseline script reproducible | ✅ |
|
| 496 |
-
|
| 497 |
-
---
|
| 498 |
-
|
| 499 |
-
## 15. Pre-Submission Checklist
|
| 500 |
-
|
| 501 |
-
- [ ] `openenv validate .` passes with no errors
|
| 502 |
-
- [ ] `docker build -t logtriage-env .` succeeds
|
| 503 |
-
- [ ] `docker run -p 7860:7860 logtriage-env` starts cleanly
|
| 504 |
-
- [ ] `GET /health` returns 200
|
| 505 |
-
- [ ] `POST /reset` returns valid observation
|
| 506 |
-
- [ ] `POST /step` with valid action returns observation + reward
|
| 507 |
-
- [ ] `GET /tasks` returns all 3 tasks with action schema
|
| 508 |
-
- [ ] `POST /grader` returns score in (0.0, 1.0) — strictly between 0 and 1
|
| 509 |
-
- [ ] `POST /baseline` completes and returns scores for all 3 tasks
|
| 510 |
-
- [ ] HF Space URL responds to ping with 200
|
| 511 |
-
- [ ] Baseline script runs end-to-end with `HF_TOKEN` set
|
| 512 |
-
- [ ] All 3 graders return varying scores (not constant)
|
| 513 |
-
- [ ] README includes all required sections
|
| 514 |
-
- [ ] `requirements.txt` is complete and pinned
|
| 515 |
-
|
| 516 |
-
---
|
| 517 |
-
|
| 518 |
-
## 16. Project Structure
|
| 519 |
-
|
| 520 |
-
```
|
| 521 |
-
logtriage-env/
|
| 522 |
-
├── README.md # This file (also HF Space header)
|
| 523 |
-
├── openenv.yaml # OpenEnv metadata
|
| 524 |
-
├── Dockerfile # Container definition
|
| 525 |
-
├── requirements.txt # Top-level deps
|
| 526 |
-
├── inference.py # Baseline inference script
|
| 527 |
-
│
|
| 528 |
-
├── server/
|
| 529 |
-
│ ├── __init__.py
|
| 530 |
-
│ ├── app.py # FastAPI app + OpenEnv create_app()
|
| 531 |
-
│ ├── environment.py # LogTriageEnvironment class
|
| 532 |
-
│ ├── models.py # TriageAction, TriageObservation (Pydantic)
|
| 533 |
-
│ ├── scenarios/
|
| 534 |
-
│ │ ├── __init__.py
|
| 535 |
-
│ │ ├── single_crash.py # Task 1 scenario generator
|
| 536 |
-
│ │ ├── cascading.py # Task 2 scenario generator
|
| 537 |
-
│ │ └── silent_degrade.py # Task 3 scenario generator
|
| 538 |
-
│ ├── graders/
|
| 539 |
-
│ │ ├── __init__.py
|
| 540 |
-
│ │ ├── base_grader.py # Abstract grader interface
|
| 541 |
-
│ │ ├── crash_grader.py # Task 1 grader
|
| 542 |
-
│ │ ├── cascade_grader.py # Task 2 grader
|
| 543 |
-
│ │ └── noise_grader.py # Task 3 grader
|
| 544 |
-
│ ├── log_generator.py # Realistic log synthesis engine
|
| 545 |
-
│ └── requirements.txt # Server deps
|
| 546 |
-
│
|
| 547 |
-
└── scripts/
|
| 548 |
-
├── run_grader.py # Manual grader testing CLI
|
| 549 |
-
└── validate_checklist.py # Pre-submission checklist runner
|
| 550 |
-
```
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: LogTriageEnv
|
| 3 |
+
emoji: 🚨
|
| 4 |
+
colorFrom: red
|
| 5 |
+
colorTo: red
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- openenv
|
| 10 |
+
- reinforcement-learning
|
| 11 |
+
- sre
|
| 12 |
+
- log-analysis
|
| 13 |
+
- grpo
|
| 14 |
+
- llm-training
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# LogTriageEnv — Train LLM Agents to Triage Production Incidents
|
| 18 |
+
|
| 19 |
+
> **Meta × PyTorch × Scaler OpenEnv Grand Finale 2026 | OGrohit**
|
| 20 |
+
>
|
| 21 |
+
> A production-grade OpenEnv environment simulating real-world SRE incident triage workflows.
|
| 22 |
+
> Live on HuggingFace Spaces — [try it now](https://huggingface.co/spaces/OGrohit/logtriage-env)
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## TL;DR — What Is This?
|
| 27 |
+
|
| 28 |
+
**Problem:** Every 2AM, six services fire alerts simultaneously. One root cause is hidden in thousands of log lines. Average engineer takes 45 minutes to resolve.
|
| 29 |
+
|
| 30 |
+
**Solution:** LogTriageEnv — an RL environment that trains LLMs to solve incidents in under 8 steps by learning to trace causality backward through microservice dependency graphs.
|
| 31 |
+
|
| 32 |
+
**Results:** After GRPO training on Qwen 2.5-3B-Instruct, the cascading_failure task showed **+0.080 improvement** in agent performance, proving the environment successfully trains agents to reason about root causes — not just pattern-match on log keywords.
|
| 33 |
+
|
| 34 |
+
---
|
| 35 |
+
|
| 36 |
+
## Why This Environment Exists
|
| 37 |
+
|
| 38 |
+
### The 2AM SRE Problem
|
| 39 |
+
|
| 40 |
+
```
|
| 41 |
+
You wake up. Six services are alerting.
|
| 42 |
+
|
| 43 |
+
api-gateway → ERROR logs flooding in
|
| 44 |
+
auth-service → WARNING logs piling up
|
| 45 |
+
payment-service → TIMEOUT errors everywhere
|
| 46 |
+
|
| 47 |
+
What do you do?
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Every on-call SRE at Meta, Google, Amazon, and Cloudflare faces this daily. The challenge isn't finding errors — it's finding the **real root cause** when symptoms appear before causes.
|
| 51 |
+
|
| 52 |
+
### Why LLMs Currently Fail
|
| 53 |
+
|
| 54 |
+
Standard LLMs pattern-match on log keywords. They page whoever logs first.
|
| 55 |
+
|
| 56 |
+
```
|
| 57 |
+
api-gateway → logs ERROR first (SYMPTOM)
|
| 58 |
+
auth-service → logs WARNING (AFFECTED)
|
| 59 |
+
payment-db → ACTUAL ROOT CAUSE (silent, not logging)
|
| 60 |
+
|
| 61 |
+
Naive agent: pages api-gateway team ❌
|
| 62 |
+
Actual fix needed: kill-query:payment-db ✅
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
**Baseline scores (LLaMA 3.3 70B via Groq):**
|
| 66 |
+
|
| 67 |
+
| Task | Score | Why It Fails |
|
| 68 |
+
|------|-------|--------------|
|
| 69 |
+
| Single Crash (Easy) | 0.99 | Too simple to fail |
|
| 70 |
+
| Cascading Failure (Medium) | 0.65 | Symptoms before causes |
|
| 71 |
+
| Silent Degradation (Hard) | 0.55 | 60% noise hides the real issue |
|
| 72 |
+
|
| 73 |
+
Even frontier models struggle. The environment is genuinely hard — and that's the point.
|
| 74 |
+
|
| 75 |
+
---
|
| 76 |
+
|
| 77 |
+
## What LogTriageEnv Does
|
| 78 |
+
|
| 79 |
+
### Service Topology
|
| 80 |
+
|
| 81 |
+
```
|
| 82 |
+
[api-gateway]
|
| 83 |
+
│
|
| 84 |
+
┌─────────┼─────────┐
|
| 85 |
+
│ │ │
|
| 86 |
+
[auth-service] [payment-service] [notification-service]
|
| 87 |
+
│ │ │
|
| 88 |
+
[user-db] [payment-db] [email-queue]
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
7 microservices. 3 injectable fault types. Realistic log generation.
|
| 92 |
+
|
| 93 |
+
### Three Difficulty Levels
|
| 94 |
+
|
| 95 |
+
| Level | Task | Agent Must Learn |
|
| 96 |
+
|--------|------|------------------|
|
| 97 |
+
| 🟢 Easy | **Single Service Crash** | Match error pattern → identify service → remediate |
|
| 98 |
+
| 🟡 Medium | **Cascading Failure** | Trace BACKWARD through graph — root cause never logs first |
|
| 99 |
+
| 🔴 Hard | **Silent Degradation** | Filter 60% noise, detect slow degradation, avoid over-escalation |
|
| 100 |
+
|
| 101 |
+
### Action Space
|
| 102 |
+
|
| 103 |
+
Agents don't output free-form text. They output **structured actions**:
|
| 104 |
+
|
| 105 |
+
```python
|
| 106 |
+
classify_severity → P1 (outage), P2 (degradation), P3 (warning)
|
| 107 |
+
identify_root_cause → Points to one of 7 services
|
| 108 |
+
escalate → Pages correct team (sre/backend/dba/security)
|
| 109 |
+
remediate → restart/rollback/scale/flush-cache/kill-query
|
| 110 |
+
request_more_logs → Get more context
|
| 111 |
+
resolve → Mark incident resolved
|
| 112 |
+
ignore → Mark as noise
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
**Key rule:** Identifying the right service but escalating the wrong team scores **zero**. Only correct combinations earn rewards.
|
| 116 |
+
|
| 117 |
+
---
|
| 118 |
+
|
| 119 |
+
## Reward Function
|
| 120 |
+
|
| 121 |
+
Dense, shaped signal across the full trajectory — not just binary win/lose:
|
| 122 |
+
|
| 123 |
+
| Action | Reward |
|
| 124 |
+
|--------|--------|
|
| 125 |
+
| Correct severity classification | +0.30 |
|
| 126 |
+
| Correct root cause identification | +0.35 |
|
| 127 |
+
| Correct remediation applied | +0.25 |
|
| 128 |
+
| Escalated to correct team | +0.10 |
|
| 129 |
+
| Speed bonus (fast resolution) | +0.10 |
|
| 130 |
+
| Wrong escalation | −0.10 |
|
| 131 |
+
| Ignoring a P1 incident | −0.50 |
|
| 132 |
+
| Over-escalating P3 as P1 | −0.15 |
|
| 133 |
+
|
| 134 |
+
**Design insight:** Partial credit rewards directionally correct behavior. An agent that identifies the right service but wrong action gets partial credit — creating a useful learning gradient.
|
| 135 |
+
|
| 136 |
+
---
|
| 137 |
+
|
| 138 |
+
## Training Results
|
| 139 |
+
|
| 140 |
+
### What We Trained
|
| 141 |
+
|
| 142 |
+
- **Model:** Qwen 2.5-3B-Instruct via Unsloth 4-bit QLoRA
|
| 143 |
+
- **Algorithm:** GRPO (Group Relative Policy Optimization) via HuggingFace TRL
|
| 144 |
+
- **Episodes:** 50 per task (150 total)
|
| 145 |
+
- **Hardware:** NVIDIA T4 GPU (Colab)
|
| 146 |
+
|
| 147 |
+
### Results
|
| 148 |
+
|
| 149 |
+
| Task | First 10 Episodes | Last 10 Episodes | Improvement | Status |
|
| 150 |
+
|------|-------------------|------------------|-------------|--------|
|
| 151 |
+
| Single Crash (Easy) | +0.255 | +0.245 | −0.010 | Flat |
|
| 152 |
+
| Cascading Failure (Medium) | +0.210 | +0.290 | **+0.080** | ✅ Learning |
|
| 153 |
+
| Silent Degradation (Hard) | +0.235 | +0.160 | −0.075 | Needs larger model |
|
| 154 |
+
|
| 155 |
+
**Key finding:** The cascading_failure task showed **+0.080 improvement** — the agent learned to trace causality backward through the dependency graph. This is exactly the capability the environment was designed to train.
|
| 156 |
+
|
| 157 |
+
**Why other tasks flat:** Qwen 3B is too small for complex reasoning. Onsite with Qwen 32B + A100 will show steeper curves.
|
| 158 |
+
|
| 159 |
+
### Reward Curve
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
|
| 163 |
+
*Reward curves across 50 episodes per task. Higher = faster incident resolution with fewer wrong actions. Note: Qwen 3B sufficient for cascading_failure, larger model needed for all three tasks to improve.*
|
| 164 |
+
|
| 165 |
+
---
|
| 166 |
+
|
| 167 |
+
## Architecture
|
| 168 |
+
|
| 169 |
+
### Environment (OpenEnv Compliant)
|
| 170 |
+
|
| 171 |
+
```
|
| 172 |
+
LogTriageEnv
|
| 173 |
+
├── OpenEnv Spec ✅
|
| 174 |
+
│ ├── reset() → observation
|
| 175 |
+
│ ├── step(action) → observation, reward, done
|
| 176 |
+
│ └── state() → current episode state
|
| 177 |
+
│
|
| 178 |
+
├── 7 Microservice Simulation
|
| 179 |
+
│ ├── api-gateway, auth-service, user-db
|
| 180 |
+
│ ├── payment-service, payment-db
|
| 181 |
+
│ ├── notification-service, email-queue
|
| 182 |
+
│ │
|
| 183 |
+
│ └── Fault Injector
|
| 184 |
+
│ ├── Single crash (easy)
|
| 185 |
+
│ ├── Cascading failure (medium)
|
| 186 |
+
│ └── Silent degradation (hard + noise)
|
| 187 |
+
│
|
| 188 |
+
└── REST API (FastAPI)
|
| 189 |
+
├── /reset, /step, /state
|
| 190 |
+
├── /tasks (list all tasks)
|
| 191 |
+
├── /grader (score after episode)
|
| 192 |
+
└── /health
|
| 193 |
+
```
|
| 194 |
+
|
| 195 |
+
### Training Pipeline
|
| 196 |
+
|
| 197 |
+
```
|
| 198 |
+
1. Environment Reset → Get incident scenario
|
| 199 |
+
2. LLM Agent rolls out episode (max 15 steps)
|
| 200 |
+
3. Collect (prompt, response, reward) per step
|
| 201 |
+
4. After 50 episodes, run GRPO fine-tuning
|
| 202 |
+
5. Update model weights → repeat
|
| 203 |
+
```
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
## Quick Start
|
| 208 |
+
|
| 209 |
+
### Try the Environment (No Training)
|
| 210 |
+
|
| 211 |
+
```bash
|
| 212 |
+
docker run -p 7860:7860 logtriage-env
|
| 213 |
+
curl http://localhost:7860/health
|
| 214 |
+
```
|
| 215 |
+
|
| 216 |
+
### Train Your Own Agent
|
| 217 |
+
|
| 218 |
+
```bash
|
| 219 |
+
# Clone
|
| 220 |
+
git clone https://github.com/OGrohit/logtriage-env
|
| 221 |
+
cd logtriage-env
|
| 222 |
+
|
| 223 |
+
# Install
|
| 224 |
+
pip install -r requirements.txt
|
| 225 |
+
|
| 226 |
+
# Run training (Colab or local)
|
| 227 |
+
python train.py \
|
| 228 |
+
--model Qwen/Qwen2.5-3B-Instruct \
|
| 229 |
+
--task all \
|
| 230 |
+
--episodes 50 \
|
| 231 |
+
--use_unsloth \
|
| 232 |
+
--env_url https://ogrohit-logtriage-env.hf.space
|
| 233 |
+
```
|
| 234 |
+
|
| 235 |
+
---
|
| 236 |
+
|
| 237 |
+
## Project Links
|
| 238 |
+
|
| 239 |
+
| Resource | URL |
|
| 240 |
+
|----------|-----|
|
| 241 |
+
| **Live Environment** | https://huggingface.co/spaces/OGrohit/logtriage-env |
|
| 242 |
+
| **Trained Model** | https://huggingface.co/OGrohit/logtriage-sre-agent |
|
| 243 |
+
| **Blog Post** | https://huggingface.co/blog/OGrohit/logtriage-sre-agent |
|
| 244 |
+
| **GitHub** | https://github.com/OGrohit/logtriage-env |
|
| 245 |
+
| **Hackathon** | Meta × PyTorch × Scaler OpenEnv Grand Finale 2026 |
|
| 246 |
+
|
| 247 |
+
---
|
| 248 |
+
|
| 249 |
+
## What Judges Look For
|
| 250 |
+
|
| 251 |
+
| Criterion | Weight | How We Deliver |
|
| 252 |
+
|-----------|--------|----------------|
|
| 253 |
+
| **Environment Innovation** | 40% | Novel SRE domain, 3 difficulty levels, causal reasoning required |
|
| 254 |
+
| **Storytelling** | 30% | Blog post + README + 3-min pitch |
|
| 255 |
+
| **Reward Improvement** | 20% | +0.080 on cascading_failure proves learning |
|
| 256 |
+
| **Pipeline Setup** | 10% | GRPO + Unsloth + checkpoints + merge_curves.py |
|
| 257 |
+
|
| 258 |
+
---
|
| 259 |
+
|
| 260 |
+
## What's Next — Phase 4 Onsite
|
| 261 |
+
|
| 262 |
+
**Deferred to hackathon (April 25-26):**
|
| 263 |
+
|
| 264 |
+
| Task | Reason |
|
| 265 |
+
|------|--------|
|
| 266 |
+
| Silent Degradation full training | Needs Qwen 32B + A100 |
|
| 267 |
+
| 3-task combined GRPO | Heavy compute |
|
| 268 |
+
| Steeper reward curves | Larger model |
|
| 269 |
+
|
| 270 |
+
**Onsite command:**
|
| 271 |
+
```bash
|
| 272 |
+
python train.py \
|
| 273 |
+
--model Qwen/Qwen2.5-32B-Instruct \
|
| 274 |
+
--task all \
|
| 275 |
+
--episodes 100 \
|
| 276 |
+
--use_unsloth \
|
| 277 |
+
--env_url https://ogrohit-logtriage-env.hf.space \
|
| 278 |
+
--push_to_hub \
|
| 279 |
+
--hub_model_id OGrohit/logtriage-sre-agent
|
| 280 |
+
```
|
| 281 |
+
|
| 282 |
+
---
|
| 283 |
+
|
| 284 |
+
## OpenEnv Compliance Checklist
|
| 285 |
+
|
| 286 |
+
- [x] Typed `Action` Pydantic model
|
| 287 |
+
- [x] Typed `Observation` Pydantic model
|
| 288 |
+
- [x] `step(action) → (observation, reward, done, info)`
|
| 289 |
+
- [x] `reset() → initial observation`
|
| 290 |
+
- [x] `state() → current state`
|
| 291 |
+
- [x] `openenv.yaml` with metadata
|
| 292 |
+
- [x] `/tasks` endpoint
|
| 293 |
+
- [x] `/grader` endpoint
|
| 294 |
+
- [x] HF Space deployed and healthy
|
| 295 |
+
- [x] Baseline inference script
|
| 296 |
+
|
| 297 |
+
---
|
| 298 |
+
|
| 299 |
+
## License
|
| 300 |
+
|
| 301 |
+
MIT License — anyone can use LogTriageEnv to train LLM agents for incident triage.
|
| 302 |
+
|
| 303 |
+
---
|
| 304 |
+
|
| 305 |
+
*Project: LogTriageEnv | Author: OGrohit | Hackathon: Meta × PyTorch × Scaler OpenEnv Grand Finale 2026*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|