Evaluation

What Is ML-Based Scoring?

An evaluation method that uses trained models or learned scorers to assign quality scores to LLM outputs, retrieval results, or agent traces.

What Is ML-Based Scoring?

ML-based scoring is an LLM-evaluation method that uses a trained model, classifier, regressor, or embedding-based scorer to grade AI outputs. It shows up in eval pipelines and production traces when exact match, regex, or simple word overlap cannot capture quality. The scorer returns a numeric score, label, or probability for responses, retrieved context, tool calls, or agent trajectories. FutureAGI uses this pattern through fi.evals surfaces such as HallucinationScore, Groundedness, and CustomEvaluation so teams can threshold, alert, and regression-test model behavior.

Why ML-Based Scoring Matters in Production LLM and Agent Systems

Bad ML-based scoring fails quietly. A classifier that over-rewards polished language can pass hallucinated answers. A learned relevance scorer trained on short support tickets can under-score long legal or medical responses. A reward model tuned on one product surface can drift when the prompt, retriever, or model family changes. The production symptom is not an exception; it is false confidence in dashboards.

Developers feel the pain during release gates: the eval suite says the model improved, then users report unsupported claims two days later. SREs see normal latency and token cost while quality falls. Compliance teams see missing evidence in audit samples. Product teams see thumbs-down rate, refund requests, or escalations rise in one cohort while the global score stays flat.

Agentic systems make the failure harder to isolate. A planner can pick the wrong tool, a retriever can supply near-miss context, and a final answer can still sound fluent. One ML-based score on the final response may hide the bad step. In 2026 multi-step pipelines, useful scoring is layered: retrieval relevance, tool choice, final answer support, and trajectory efficiency each need a separate signal. Logs usually show this as score-distribution shift, scorer-human disagreement, repeated failures for one dataset slice, or higher eval-fail-rate-by-cohort after a model or prompt rollout.

How FutureAGI Handles ML-Based Scoring

FutureAGI’s approach is to make the learned score inspectable, versioned, and tied to the eval surface that produced it. At the eval:* layer, teams can run HallucinationScore for unsupported claims, Groundedness for context-backed answers, AnswerRelevancy for query fit, or CustomEvaluation when the scoring target is domain-specific.

A real workflow starts with a LangChain RAG agent instrumented through traceAI-langchain. Each trace contains the user input, retrieved context, final response, tool spans, and token fields such as llm.token_count.prompt. FutureAGI attaches Groundedness to the final answer and a CustomEvaluation called refund_policy_quality to score whether the answer follows the company’s refund rules. The evaluator stores result.score beside the trace, so the engineer can compare the new prompt against the previous release on the same dataset.

The next action depends on the failure. If Groundedness drops below 0.80 for enterprise-policy questions, the release gate fails and the team opens the lowest-scoring traces. If the custom scorer disagrees with human annotations on more than 20% of a holdout sample, the scorer is recalibrated before it controls routing. Unlike Ragas faithfulness, which mainly checks final-answer support against context, this setup can combine final-answer scoring with trace-level evidence before a regression ships.

How to Measure or Detect ML-Based Scoring

Treat the scorer as a model under test, not an oracle:

  • HallucinationScore returns a comprehensive hallucination detection score; use it to watch unsupported claims across model versions.
  • CustomEvaluation returns a domain-specific score or label; compare it with human annotations before using it in release gates.
  • Score distribution should move gradually; sudden compression near 0 or 1 often means the scorer is miscalibrated.
  • Eval-fail-rate-by-cohort identifies slices where the score predicts user pain, such as one language, tenant, retriever, or tool route.
  • Trace fields such as llm.token_count.prompt and traceAI integration metadata explain whether scoring changes track prompt size or model swaps.
  • User-feedback proxies like thumbs-down rate and escalation rate validate whether the score maps to real outcomes.
from fi.evals import HallucinationScore

metric = HallucinationScore()
result = metric.evaluate(
    response=answer,
    context=retrieved_context,
)
print(result.score)

Re-check thresholds after any model, prompt, corpus, or annotation-policy change. A score that predicted quality last quarter may become a weak signal after the task distribution shifts.

Common Mistakes

These mistakes make ML-based scores look precise while hiding bad evaluation design:

  • Training on a tiny golden set. The scorer memorizes examples instead of learning the quality boundary you need in production.
  • Treating probabilities as calibrated. A 0.91 score is not a pass threshold until checked against human labels and live failures.
  • Mixing scoring targets. Helpfulness, factual support, tool choice, and compliance need separate labels or nobody can own the fix.
  • Averaging across cohorts. High-volume easy tasks can hide failures in regulated workflows, multilingual traffic, or long-context questions.
  • Letting the scorer see leaked metadata. If offline labels include fields missing at runtime, the live score will not predict behavior.

Good ML-based scoring starts with a clear target, a holdout set, and a threshold tied to one release decision. Anything broader becomes a dashboard decoration.

Frequently Asked Questions

What is ML-based scoring?

ML-based scoring uses a trained model, classifier, regressor, or embedding scorer to grade LLM outputs and return a numeric or categorical evaluation signal.

How is ML-based scoring different from LLM-as-a-judge?

LLM-as-a-judge is one form of ML-based scoring where a language model grades outputs against a rubric. ML-based scoring is broader and can include classifiers, NLI models, embedding similarity, reward models, or learned rankers.

How do you measure ML-based scoring in FutureAGI?

Use `fi.evals` classes such as `CustomEvaluation`, `HallucinationScore`, or `Groundedness`, then track score distribution, human agreement, and eval-fail-rate-by-cohort.