"""A self-authored server failure-triage suite (section 18). Every case and every reference snippet below was written from scratch for this experiment. Nothing here is derived from any employer's logs, code, or specifications. The task is single-label classification into one of six root-cause categories. Each case is given a retrieval-style context: several reference snippets in a rotating order, only one of which names the correct category. Short-context configurations therefore lose real information some of the time, which is what makes the latency/accuracy tradeoff honest rather than staged. """ LABELS = ["MEMORY", "THERMAL", "POWER", "FIRMWARE", "INTERCONNECT", "STORAGE"] # Reference pool: one snippet per category, deliberately similar in length. REFERENCE = { "MEMORY": ( "MEMORY: Single-bit errors reported per DIMM rank, ECC correction counts that " "climb on one channel, and row-hammer style adjacency patterns indicate a MEMORY " "root cause. Corrected ECC events allow execution to continue; an uncorrectable " "double-bit error escalates to a machine-check condition." ), "THERMAL": ( "THERMAL: Core frequency dropping in step with rising package temperature, " "PROCHOT assertion, fan tachometer stalls, and errors that appear only after a " "sustained load ramp indicate a THERMAL root cause. Throttling is protective and " "usually leaves no error-correction counters behind." ), "POWER": ( "POWER: Rail voltage sagging below its tolerance band during load transients, " "abrupt loss of all telemetry with no preceding warning, redundant supply " "failover events, and correlated resets across independent components indicate a " "POWER root cause." ), "FIRMWARE": ( "FIRMWARE: Faults that appear only after a specific microcode or BMC revision, " "that disappear when the previous image is restored, or that reproduce on every " "unit of a batch at the same code path indicate a FIRMWARE root cause. Hardware " "telemetry typically stays clean." ), "INTERCONNECT": ( "INTERCONNECT: Link retraining events, lane degradation from x16 to x8 or x4, " "CRC or replay counters climbing on a PCIe or fabric port, and errors that follow " "the cable or riser rather than the endpoint indicate an INTERCONNECT root cause." ), "STORAGE": ( "STORAGE: Rising reallocated-sector or media-error counts, command timeouts and " "bus resets aimed at one device, SMART wear indicators near their threshold, and " "I/O errors confined to a single namespace indicate a STORAGE root cause." ), } _RAW_CASES = [ ("Corrected ECC events on channel B rank 1 have grown from 12 to 9,400 per hour over " "four days. No other subsystem reports errors and the node has not reset.", "MEMORY"), ("Under a sustained all-core stress load the package reaches 96 C, PROCHOT asserts, " "and clocks drop to 1.2 GHz. Errors vanish when the load is halved.", "THERMAL"), ("The node lost all telemetry mid-run with no warning entry. The rack PDU logged a " "brief 11.4 V reading on a 12 V rail at the same second.", "POWER"), ("A validation fleet began failing the same test on the same instruction path the day " "after microcode 0x2b was applied. Reverting to 0x2a clears it fleet-wide.", "FIRMWARE"), ("A GPU riser reports 41 link retraining events per hour and has negotiated down from " "x16 to x4. Moving the card to another riser moves the errors with the riser.", "INTERCONNECT"), ("One NVMe namespace returns I/O errors while its neighbours are clean. Its media-error " "count rose from 0 to 260 and SMART wear is at 98 percent.", "STORAGE"), ("A double-bit uncorrectable error on DIMM A2 triggered a machine-check shutdown. The " "same slot logged climbing corrected counts for a week beforehand.", "MEMORY"), ("Fan 3 tachometer reads zero and the inlet sensor shows 48 C. Nodes above it in the " "rack are unaffected. Clocks fall whenever utilisation exceeds 60 percent.", "THERMAL"), ("Two independent add-in cards and the BMC all reset within the same 50 ms window. No " "component logged an internal fault before the reset.", "POWER"), ("A BMC upgrade introduced a sensor-polling stall that reports spurious critical " "thresholds. Every unit on the new image shows it; the sensors themselves read normal " "over the physical bus.", "FIRMWARE"), ("A fabric port shows replay counters climbing at 300 per minute with correctable CRC " "errors. Replacing the cable ends the errors; the endpoint was never swapped.", "INTERCONNECT"), ("A SATA device produces command timeouts and bus resets every few minutes. Its " "reallocated-sector count has climbed to 1,100 and continues to rise.", "STORAGE"), ("Corrected parity events on a cache line repeat on one core with no machine-check " "shutdown. Memory patrol scrub reports the same physical address each pass.", "MEMORY"), ("Throughput falls 30 percent twelve minutes into every run and recovers after a cool " "down. Package temperature tracks the fall exactly and no error counter moves.", "THERMAL"), ("A redundant supply logged a failover to the secondary module. The primary now reads " "zero output current and the chassis runs on one module.", "POWER"), ("A driver reports an unsupported capability that the silicon does implement. The " "option ROM image predates the part by two revisions; updating it resolves the fault.", "FIRMWARE"), ("A switch downstream port dropped from Gen5 to Gen3 and logs lane-degradation events. " "The endpoint reports no internal errors at all.", "INTERCONNECT"), ("Read latency on one drive rose from 0.2 ms to 40 ms and its media-error log grows " "each hour. The controller and every other attached drive are clean.", "STORAGE"), ("ECC correction counts rose on all eight DIMMs of one channel after a reseat, and only " "on that channel. The memory controller reports no uncorrectable events.", "MEMORY"), ("A node throttles within 90 seconds of load only when the adjacent blank panel is " "removed. Restoring the panel restores full clocks.", "THERMAL"), ("A firmware image whose watchdog interval was mis-scaled reboots each node at almost " "exactly 4,096 seconds of uptime, across the whole batch.", "FIRMWARE"), ("An accelerator disappears from the bus under load and returns after a rescan. Its " "port logs a retraining burst at each disappearance; the card passes standalone tests " "in another slot.", "INTERCONNECT"), ("Voltage on the 3.3 V rail droops to 2.9 V during load transients and recovers at " "idle. Faults appear only at the droop instants.", "POWER"), ("Write amplification climbed and the device entered read-only mode after its wear " "indicator crossed 100 percent. No bus or link errors were logged.", "STORAGE"), ] def _context_for(index: int, correct_label: str) -> str: """Six snippets, rotated per case so the useful one is not always first.""" ordered = LABELS[index % len(LABELS):] + LABELS[: index % len(LABELS)] return "\n\n".join(REFERENCE[label] for label in ordered) CASES = [ { "id": f"case-{i + 1:02d}", "task": ( f"{text}\n\nClassify the root cause as exactly one of: " f"{', '.join(LABELS)}. Reply with the label." ), "context": _context_for(i, label), "expected_phrase": label, } for i, (text, label) in enumerate(_RAW_CASES) ]