Research
Intent mining
Measured behavior
Evaluation |
Result |
Interpretation |
|---|---|---|
Two cosmetic label variants across two runs |
One aggregate with support |
Default grouping normalizes case, punctuation, and spacing |
Out-of-range model evidence |
|
An intent cannot cite steps outside its source trajectory |
Conflicting independent reviews |
|
The result records both reviews |
Duplicate reviewer |
|
Support counts each reviewer once |
Two-dimension rubric with required grounding omitted |
Aggregate |
The aggregate keeps the absent required dimension explicit |
The checks cover evidence bounds and aggregation. Semantic accuracy depends on the model and taxonomy chosen by the application. Measure it with a labeled domain corpus and independent reviewers.
Represent an inferred intent
An IntentCandidate binds a label to one or more inclusive step ranges. Its
kind records whether the label was declared, inferred from behavior, or
proposed in hindsight from an unsuccessful run.
from mari_components.trajectories import parse_intent_candidates
candidates = parse_intent_candidates(
runs,
{
"intents": [
{
"intent": "Compare retention policies",
"kind": "inferred",
"evidence": [
{"trajectory_id": "run-17", "start": 2, "end": 6}
],
}
]
},
)
Field |
Meaning |
|---|---|
|
Human-readable proposed intent |
|
|
|
Existing trajectory ID and an inclusive, in-bounds step range |
|
What the run achieved. Especially useful for hindsight proposals |
|
Gaps between the cited behavior and the proposed intent |
|
Stable hash of kind, normalized label, and evidence ranges |
Group intent candidates
aggregate_intents(candidates, *, key=normalize_intent) groups proposals and
returns all observed labels, candidate IDs, trajectory IDs, kinds, and support.
Replace key with a taxonomy lookup, embedding cluster assignment, or reviewed
mapping owned by the application.
from mari_components.trajectories import aggregate_intents
groups = aggregate_intents(
candidates,
key=lambda label: reviewed_taxonomy[label],
)
Cluster and monitor proposed intents
Before relabeling, applications can group semantically similar proposals with
caller-owned vectors. cluster_intents uses cosine-normalized single-link
clustering and returns each cluster’s medoid, cohesion, labels, members, and
ambiguous members. detect_novel_intents measures each proposal against
caller-owned centroids. compare_intent_windows compares reviewed cluster
matches with Jensen–Shannon divergence and explicit new or retired clusters.
from mari_components.trajectories import cluster_intents, detect_novel_intents
clustering = cluster_intents(
candidates,
embeddings,
similarity_threshold=0.82,
ambiguity_margin=0.03,
)
novel = detect_novel_intents(
new_candidates,
new_embeddings,
reviewed_centroids,
threshold=0.75,
)
Three-label vector example |
Cosine relationship |
Result |
|---|---|---|
“reset password” / “recover login” |
|
Same cluster at |
“reset password” / “cancel account” |
|
Separate cluster |
Single-link clustering can bridge distant members through intermediate points. Cohesion scores and ambiguous IDs expose that behavior. The caller supplies stable taxonomy IDs when it matches clusters across time.
Relabel outcomes in hindsight
A hindsight record describes an achieved intent found in a failed run. Set
kind="hindsight" and cite the supporting steps. Keep the original run under
its existing identity. A training system can consume the candidate through an
adapter owned by the application.
from mari_components.trajectories import IntentReview, summarize_intent_reviews
reviews = summarize_intent_reviews(
candidates,
[
IntentReview(candidate_id=candidate_id, reviewer_id="judge-a", valid=True),
IntentReview(candidate_id=candidate_id, reviewer_id="judge-b", valid=False),
],
)
assert reviews[0].agreement == 0.5
summarize_intent_reviews(candidates, reviews) deduplicates reviewer identity.
The result reports valid and invalid counts along with duplicates. The caller
sets any acceptance threshold.
For repeated reviews by the same reviewer, the first supplied review wins.
Order review records deliberately and inspect duplicate_reviewer_ids before
promotion. Keep stable taxonomy IDs in application storage so a label edit
preserves the intended group identity.
Task-adaptive evaluation dimensions
An intent label describes the aim inferred from behavior. A rubric carries the criteria used to judge that behavior. Mari stores each as a separate value.
from mari_components.trajectories import (
parse_rubric_assessments,
parse_trajectory_rubric,
score_trajectory_rubric,
)
rubric = parse_trajectory_rubric(task, rubric_output)
assessments = parse_rubric_assessments(run, rubric, judge_output)
score = score_trajectory_rubric(
run,
rubric,
assessments,
required_minimum=0.7,
)
print(score.overall, score.required_failures, score.missing_dimensions)
Function |
Options and behavior |
|---|---|
|
Requires unique dimensions with positive weights. Preserves |
|
Accepts scores/confidence in |
|
Confidence-weights repeated assessments. Reports missing and required failures separately from the weighted mean |
The required_failures field lists required dimensions below the configured
minimum. A caller can inspect it beside the weighted score before changing
application behavior.
Connect reviewed intent groups to procedure mining, and use conversation knowledge to search the observations behind a proposed intent. Evidence-bound labels and searchable source content serve different steps of the same review workflow.
One scored rubric, as data
Dimension |
Weight |
Required |
Assessment |
Result |
|---|---|---|---|---|
Grounding |
|
yes |
missing |
Listed in both |
Efficiency |
|
false |
|
Included in the weighted mean |
Aggregate |
n/a |
n/a |
n/a |
|
Research and implementations
AgentHERApache-2.0 implementationHindsight Supervised LearningAdaRubricApache-2.0 implementationHindsight Experience Replay
Mari implements evidence-bound proposals and independent review summaries. Rubric arithmetic is deterministic. Training pipelines and model judges enter through application code.