A Coding Implementation to Parsing, Analyzing, Visualizing, and Fine-Tuning Agent Reasoning Traces Using the lambda/hermes-agent-reasoning-traces Dataset

By Topline Newsroom
1 min readSource: www.marktechpost.com
A Coding Implementation to Parsing, Analyzing, Visualizing, and Fine-Tuning Agent Reasoning Traces Using the lambda/hermes-agent-reasoning-traces Dataset
Share

The story

A Coding Implementation to Parsing, Analyzing, Visualizing, and Fine-Tuning Agent Reasoning Traces Using the lambda/hermes-agent-reasoning-traces Dataset

In this tutorial, we explore the lambda/hermes-agent-reasoning-traces dataset to understand how agent-based models think, use tools, and generate responses across multi-turn conversations. We start by loading and inspecting the dataset, examining its structure, categories, and conversational format to get a clear idea of the available information. We then build simple parsers to extract key compon

From the source

News Hub @media (max-width:767px){.tdi_8{margin-left:auto!important}} .tdb_mobile_search{margin-bottom:0;clear:none}.tdb_mobile_search a{display:inline-block!important;position:relative;text-align:center;color:var(--td_theme_color,#4db2ec)}.tdb_mobile_search a>span{display:flex;align-items:center;justify-content:center}.tdb_mobile_search svg{height:auto}.tdb_mobile_search svg,.tdb_mobile_search svg *{fill:var(--td_theme_color,#4db2ec)}#tdc-live-iframe .tdb_mobile_search a{pointer-events:none}.td-search-opened{overflow:hidden}.td-search-opened #td-outer-wrap{position:static}.td-search-opened .td-search-wrap-mob{position:fixed;height:calc(100% + 1px)}.td-search-opened .td-drop-down-search{height:calc(100% + 1px);overflow-y:scroll;overflow-x:hidden}.tdi_8{display:inline-block}.tdi_8 .tdb-head

!pip -q install -U datasets pandas matplotlib seaborn transformers accelerate trl import json, re, random, textwrap from collections import Counter, defaultdict import pandas as pd import numpy as np import matplotlib.pyplot as plt from datasets import load_dataset, concatenate_datasets random.seed(0) CONFIG = "kimi" ds = load_dataset("lambda/hermes-agent-reasoning-traces", CONFIG, split="train") print(ds) print("Config:", CONFIG, "| Fields:", ds.column_names) print("Categories:", sorted(set(ds["category"]))) COMPARE_BOTH = False if COMPARE_BOTH: ds_kimi = load_dataset("lambda/hermes-agent-reasoning-traces", "kimi", split="train") ds_glm = load_dataset("lambda/hermes-agent-reasoning-traces", "glm-5.1", split="train") ds_kimi = ds_kimi.add_column("source", ["kimi"] * len(ds_kimi)) ds_glm =

THINK_RE = re.compile(r" (.?) ", re.DOTALL) TOOL_CALL_RE = re.compile(r" \s(\{.?\})\s ", re.DOTALL) TOOL_RESP_RE = re.compile(r" \s(.?)\s* ", re.DOTALL) def parse_assistant(value: str) -> dict: thoughts = [t.strip() for t in THINK_RE.findall(value)] calls = [] for raw in TOOL_CALL_RE.findall(value): try: calls.append(json.loads(raw)) except json.JSONDecodeError: calls.append({"name": " ", "arguments": {}}) final = TOOL_CALL_RE.sub("", THINK_RE.sub("", value)).strip() return {"thoughts": thoughts, "tool_calls": calls, "final": final} def parse_tool(value: str): raw = TOOL_RESP_RE.search(value) if not raw: return {"raw": value} body = raw.group(1) try: return json.loads(body) except: return {"raw": body} first_gpt = next(t for t in sample["conversations"] if t["from"] == "gpt") p = par

Who and what

Key names and topics in this story: Coding Implementation, Parsing, Analyzing, Visualizing.

Where to follow next

A Coding Implementation to Parsing, Analyzing, Visualizing, and Fine-Tuning Agent Reasoning Traces Using the lambda/hermes-agent-reasoning-traces Dataset
#ai#coding-implementation#parsing#analyzing#visualizing
Share

Related stories