design(adapters): callers cannot tell which adapter reality produced a score, and sampling depends on it

未关闭
#1,680 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
ai

调研方向

Read the existing backend.resolve_adapter(name).weights.binding_type route and the ValidationResult fields described in the issue; inspect how mot.generation carries metadata. Compare the three proposed approaches and review #1654 and #1679 for context. Done means the discussion settles on how callers and sampling strategies can identify the route behind a result, with the existing route documented at minimum.

由索引模型根据 Issue 内容生成。

描述

area/adapter-functions area/requirement area/sampling enhancement needs-design p2

What happens today

core.check_certainty(...) hands you back 0.83. core.requirement_check(...) hands you back a float.
Requirement.validate() hands you back a ValidationResult. In each case the value looks the same
whether it came from an aLoRA adapter, a LoRA adapter, a hand-written prompt run against the base model,
or LLM-as-a-judge.

There is no way to ask, for a given result, which of those produced it. ValidationResult carries
result, reason, score, thunk, context and error. The thunk field is populated on every
path, so it cannot be used to tell them apart either, and its docstring still describes it as the output
"produced during LLM-as-a-Judge validation", which stopped being true when requirement rerouting landed.

Why that is a problem

The mechanism behind a score used to be fixed for a given setup. Three changes make it variable:

  • prompt fallback adds a weightless path that runs the capability's instruction against the base model,
    chosen automatically when no trained adapter exists for the target model (#1654),
  • availability-aware resolution can pick a different trained rung depending on the model (#1654),
  • requirement validation reroutes to an adapter whenever one is registered, and registration now happens
    as a side effect of any adapter-function call.

Mellea's own sampling strategies consume these scores to decide whether to accept a candidate, repair it,
or try again. So a rejection-sampling loop can start making different decisions because the evidence
behind its verdicts changed, and neither the user nor the loop can see that happen. Anyone using these
scores as a gate in a pipeline has the same problem, with the added wrinkle that a prompt-backed score is
weaker than one from trained weights.

How it should behave

A caller who needs to know should be able to ask, per result, which reality produced it. Sampling
strategies should be able to record it. At minimum, the existing route should be documented.

What already exists

backend.resolve_adapter(name).weights.binding_type returns local_file, embedded, server_mediated
or prompt. It is public and works today. It answers "what is registered right now" rather than "what
produced this result", and it is not mentioned anywhere in the docs.

Telemetry has the right information already: the adapter_function_invocation_complete hook payload
carries binding_type and revision. That needs the hooks extra plus a registered plugin, so it serves
operators rather than application code.

Detail: possible shapes
  1. Document the resolve_adapter(...).weights.binding_type route. Cheapest first step, and it could land
    alongside the prompt-fallback documentation.
  2. Record the binding type, and ideally the resolved revision, on the result metadata. There is an
    established home for this: mot.generation already carries model, provider and usage.
  3. Give ValidationResult an explicit provenance field so sampling strategies can log or branch on it,
    and correct the thunk docstring while we are there.

Options 2 and 3 touch surfaces shared across every backend, which is why this is filed for discussion
rather than bolted onto the PR that exposed it.

Related

Found while reviewing #1654, which introduces the weightless prompt reality. A worked example of the
mechanism behind a score changing without any signal is #1679.

主要语言
Python
星标
1.8k
派生
161
平均合并
4 天 3 小时
30 天内合并 PR
45

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

generative-computing/mellea 的其他 Issue

查看 generative-computing/mellea 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。