Skip to content

[API Proposal]: Add a provider-neutral subset / multi-label decision primitive #7808

Open

Description

@mo3in

Background

The decision abstraction proposed in [dotnet/extensions#7764](#7764) and implemented experimentally in [#7795](#7795) currently defines three useful decision semantics:

Binary
Choice
Score

These cover:

Binary:
    Does one proposition apply?

Choice:
    Which exactly one member of a closed unordered set applies?

Score:
    Where does the state fall on an ordered scale?

There is another common bounded-decision shape that does not fit these semantics cleanly:

Which zero or more members of a caller-defined set apply?

This is commonly described as multi-label classification, subset selection, or set-valued classification.

Example

Consider semantic tool shortlisting:

Candidates:

inspect_project
validate_graph
search_docs
deploy
restart_host

For one user request, several tools may simultaneously be relevant:

inspect_project    0.96
validate_graph     0.91
search_docs        0.83
deploy             0.12
restart_host       0.03

The intended answer is not a Choice, because more than one candidate may apply.

It can be represented today as multiple Binary questions:

Is inspect_project relevant?
Is validate_graph relevant?
Is search_docs relevant?
...

but that loses the fact that this is one semantic operation over one caller-owned candidate domain.

Proposed semantic primitive

Conceptually:

public sealed class SubsetDecisionQuestion : DecisionQuestion
{
    public IReadOnlyList<DecisionCandidate> Candidates { get; }
}

with a corresponding result such as:

public sealed class SubsetDecisionAnswer : DecisionAnswer
{
    public IReadOnlyList<DecisionProbability> Probabilities { get; }
}

The important semantic difference from Choice is:

Choice:

P(A) + P(B) + P(C) ≈ 1
exactly one outcome is selected

whereas:

Subset:

P(A applies) ∈ [0, 1]
P(B applies) ∈ [0, 1]
P(C applies) ∈ [0, 1]

the probabilities are not mutually exclusive
and do not need to sum to 1

Each probability represents the provider's estimate that the corresponding candidate belongs in the applicable subset.

Selection policy should remain outside the model contract

I would not require the provider to return a finalized SelectedCandidates collection.

For example:

candidate A → 0.92
candidate B → 0.81
candidate C → 0.55

Different applications may legitimately use:

threshold >= 0.8
top K
maximum candidate count
cost-aware selection
fallback rules

Those are application/framework policies.

The portable model capability should preserve the probabilities and let the consumer decide how to turn them into a subset.

This keeps the same architectural rule established in [#7764](#7764):

model
    → probabilistic evidence

application policy
    → action

Potential consumers

This primitive is useful beyond tool selection:

tool shortlisting
Agent Skill selection
applicable policy detection
tagging
multi-label classification
capability selection
risk-signal detection
context filtering
RAG relevance gating
workflow candidate selection

For example, the Agent Framework integration proposal in [microsoft/agent-framework#8545](microsoft/agent-framework#8545) currently describes tool and Skill shortlisting using batches of Binary questions.

A first-class subset primitive would represent that operation more directly without making MAF-specific concepts part of MEAI.

Why not just use Choice?

Choice models a categorical distribution:

exactly one candidate applies

and therefore has the invariant:

Σ P(candidate) ≈ 1

A subset decision models independent or correlated membership:

zero, one, or many candidates may apply

and therefore cannot use the same probability semantics.

Why not just use multiple Binary questions?

That is a viable fallback and should remain supported.

The question is whether multi-label/subset inference is sufficiently common and provider-native to deserve a first-class portable semantic, just as a categorical Choice is more meaningful than manually constructing one Binary question per category.

A first-class primitive could also allow providers to execute subset classification efficiently without implying one physical model call per candidate.

Open questions

  1. Is Subset, MultiLabel, or another name clearer for the provider-neutral abstraction?
  2. Should the result expose only per-candidate inclusion probabilities, leaving all thresholding to applications?
  3. Should the contract make any statement about dependencies between candidate probabilities?
  4. Should candidate identity reuse the exact opaque DecisionCandidate.Id semantics from Choice?
  5. Is there enough provider evidence to include this in the initial experimental surface, or should it be explored as a follow-up primitive after Binary / Choice / Score stabilize?
  6. Should semantic cardinality constraints such as “at most N candidates may apply” ever be part of the question contract, or should cardinality always remain consumer/application policy?

The goal is not to expand decision inference into a general selection framework.

It is to determine whether:

which members of this bounded set apply?

is a sufficiently distinct and reusable model capability to deserve a portable semantic alongside Binary, Choice, and Score.

Activity

  1. mo3in commented on Oct 6, 2026

    @mo3in
    Author

    One additional semantic detail may be worth making explicit if this primitive moves forward: the returned values should represent per-candidate marginal inclusion probabilities, not a joint distribution and not an independence assumption.

    For example:

    P(A applies) = 0.80
    P(B applies) = 0.70
    

    should not imply:

    P(A and B) = 0.56
    

    A provider may internally model dependencies between candidates, but the portable result only exposes the marginal probability that each individual candidate belongs to the applicable subset.

    I think the protocol invariants should therefore be roughly:

    exactly one probability entry for every requested candidate
    no missing candidates
    no additional candidates
    no duplicate candidate IDs
    candidate IDs round-trip exactly
    every probability is finite and in [0, 1]
    no requirement that probabilities sum to 1
    

    This would preserve the same strict request/response correlation model introduced for Choice in [#7795](#7795), while clearly distinguishing subset semantics from a categorical distribution.

    It also means that the common abstraction should avoid making claims about a joint distribution over all possible subsets. Representing that would require up to 2^N outcomes and is a substantially different capability.

    A related API-review question may therefore be:

    Should SubsetDecisionAnswer explicitly document its probabilities as marginal inclusion probabilities, with dependency/joint-distribution semantics intentionally left provider-specific?

    I would also lean toward Subset over MultiSelect as the API term: MultiSelect can suggest that the provider is expected to return a finalized selected collection, while the proposed contract intentionally preserves probabilities and leaves thresholding / top-K / cardinality policy to the consumer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-aiMicrosoft.Extensions.AI librariesuntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions