Optimize learning vs earning allocation
Solve the exact finite-horizon Beta–Bernoulli bandit for allocating scarce units between a known earning baseline and uncertain actions that earn and update their posterior.
What it's for
Makes the exploration-versus-exploitation tradeoff explicit: when should scarce product or engineering capacity earn now, and when is one uncertain action worth trying because it improves later choices?
What you give it
Inputs split into evidence read from your connected systems, calibration your team owns, and numerical controls that affect precision but never the result's meaning.
| Field | Type | Role | Required |
|---|---|---|---|
| decision_horizon_units | integer ≥ 1, ≤ 15 | Your calibration | Yes |
| discount_rate_per_unit | number ≥ 0, ≤ 1 | Your calibration | Optional |
| known_baseline_reward_per_unit | number ≥ 0 | Your calibration | Yes |
| max_detail_rows | integer ≥ 1, ≤ 500 | Numerical control | Optional |
| maximum_exact_states | integer ≥ 100, ≤ 1000000 | Numerical control | Optional |
| minimum_expected_policy_value | number ≥ 0 | Your calibration | Optional |
| uncertain_actions | array of objects (5 fields) ≥ 1 item | Evidence | Yes |
Each uncertain_actions
record
| Field | Type | Required |
|---|---|---|
| cost_per_attempt | number (≥ 0) | Yes |
| id | string (non-empty) | Yes |
| posterior_alpha | number (> 0) | Yes |
| posterior_beta | number (> 0) | Yes |
| reward_per_success | number (≥ 0) | Yes |
{
"decision_horizon_units": 5,
"known_baseline_reward_per_unit": 0.6,
"maximum_exact_states": 10000,
"uncertain_actions": [
{
"cost_per_attempt": 0,
"id": "new-channel",
"posterior_alpha": 1,
"posterior_beta": 1,
"reward_per_success": 1
}
]
} What you get back
This is the actual output of running the example above — computed by the same function the platform calls, not an illustration.
{
"action_diagnostics": [
{
"action_id": "new-channel",
"adaptive_option_value_over_commit": 0.5867,
"commit_same_action_value": 2.5,
"expected_units_under_optimal_policy": 2.4667,
"initial_bayesian_q_value": 3.0867,
"initial_expected_net_reward_per_unit": 0.5,
"myopic_first": false,
"posterior_success_probability": 0.5,
"selected_first": true
},
{
"action_id": "known-baseline",
"adaptive_option_value_over_commit": 0.0333,
"commit_same_action_value": 3,
"expected_units_under_optimal_policy": 2.5333,
"initial_bayesian_q_value": 3.0333,
"initial_expected_net_reward_per_unit": 0.6,
"myopic_first": true,
"posterior_success_probability": null,
"selected_first": false
}
],
"assumptions": [
"Each uncertain action has a stationary Bernoulli success process with the submitted beta posterior, reward and attempt cost; every attempt produces both its declared immediate earning and an unbiased promptly observed outcome that updates the same future decision state.",
"One capacity unit is allocated per decision step, the known baseline earns a certain reward and produces no learning, rewards are additive and comparable, and discounting captures timing; switching, batching, delays, constraints, correlated arms, nonstationarity, harms, censoring, and delayed feedback must be modeled elsewhere or make this policy invalid.",
"The function solves the declared finite-horizon Bayesian bandit exactly inside a hard state budget and compares it with a recursively evaluated myopic policy; exploration value is a model-conditional option value, not causal proof or permission for an uncontrolled experiment.",
"Actions are aggregate interventions, product choices, experiments, technologies, or investment channels, never named employees; the first allocation is governed decision support and requires safety, causal-design, finance, and accountable-owner approval before deployment."
],
"configuration": {
"discount_rate_per_unit": 0,
"exact_dynamic_program": true,
"known_baseline_reward_per_unit": 0.6,
"maximum_exact_states": 10000,
"minimum_expected_policy_value": 0,
"posterior_updates_after_every_uncertain_action": true
},
"decision": "explore_uncertain_action_before_committing",
"method": "exact_finite_horizon_beta_bernoulli_bandit_v1",
"reachable_policy_state_diagnostics": [
{
"posterior_success_probabilities": { Truncated for display — the full payload is 266 lines.
How it works
Sequential Bayesian & bandits — Learn while deciding — update beliefs as evidence arrives and choose where the next unit of effort is worth spending.
- 1 Freeze up to four aggregate uncertain actions with tenant-calibrated beta posteriors, reward per success and attempt cost, plus the certain baseline reward, finite capacity horizon, discounting and exact-state work budget.
- 2 Use backward Bayesian dynamic programming over every reachable success/failure posterior state, comparing the known baseline with uncertain actions whose immediate reward and observation update all later choices.
- 3 Evaluate the recursively adaptive policy against a recursively evaluated myopic policy, identify when first-step exploration overrides immediate earning, and reconcile expected capacity units across every reachable policy branch.
Before you trust it
Every tool in the catalog ships with the conditions under which its answer is meaningful — and the conditions under which it should abstain instead of guessing.
Assumptions & guardrails
- The likelihood or reward model, prior support, action logging, delayed outcomes, and any stationarity assumptions match the deployment process.
- Action outcomes are stationary Bernoulli, promptly observed and decision-sufficient; rewards are additive and comparable, one unit is allocated per step, the baseline is known, and omitted switching, delay, correlation, capacity, safety or nonstationarity effects are immaterial.
- Posterior probability and adaptive selection are model-conditional; they are not substitutes for randomized propensities or guaranteed safety.
- Exploration value is conditional on the likelihood, posterior and reward model, not permission for an uncontrolled experiment; the state budget is an exactness boundary, and action IDs must never represent named employees.
Minimum evidence
- uncertain_actions: at least 1 rows/items
- known_baseline_reward_per_unit: required and organization-defined
- decision_horizon_units: required and organization-defined
How to validate it
Backtest the chosen action against simple feasible baselines on held-out scenarios, sweep costs/constraints/risk tolerance, and require constraint feasibility under adverse inputs.
Calibrating it to your org
Same for everyone
The mathematical kernel, validation rules, method version, and JSON output semantics are organization-independent; no tenant-trained coefficients or company benchmark is embedded in the function.
Specific to you
- tenant-calibrated beta posterior for each stationary Bernoulli action, finance-reconciled net reward, and proof that each allocation both earns the modeled immediate reward and resolves an unbiased outcome before the next decision
- action and baseline perimeter, posterior vintage, outcome and reward definition, causal and safety eligibility, one-unit capacity semantics, horizon, discounting, minimum policy value, exact-state work budget, and monitoring for stationarity and regret
Calibration workflow
- 1 Define the management decision, target outcome, aggregate unit, privacy boundary, cadence, and prediction/intervention horizon for this organization.
- 2 Build a tenant-scoped historical cohort using only information available before each prediction or decision; preserve zero periods, censoring, assignment probabilities, and unresolved outcomes when the method requires them.
- 3 Estimate statistical parameters on training history, but obtain costs, utilities, risk tolerance, practical-effect thresholds, capacity, and policy constraints from accountable decision owners.
- 4 Validate on later time windows or held-out aggregate units at the deployment grain, against a simple baseline and the function-specific validation strategy.
- 5 Deploy only if the returned decision clears evidence, overlap, calibration, robustness, and guardrail checks; warning, unsupported, schema-gap, and fallback decisions are abstentions.
- 6 Monitor realized outcomes, data drift, coverage, and decision regret; recalibrate at a governed cadence or after a detected regime/definition change, never merely because a stakeholder dislikes the result.
Call it from your AI
You don't wire up 388 tools in your MCP client. The GitRevio MCP server exposes 18 tools, three of which let an agent search the catalog, read a tool's schema, and run it — so the assistant finds this one on its own.
gitrevio_capabilities_search
{ "q": "solve the exact finitehorizon betabernoulli bandit" }
→ finds "optimize_learning_vs_earning_allocation"
gitrevio_capability_describe
{ "capability_id": "optimize_learning_vs_earning_allocation" }
→ returns the input schema and agent guidance shown on this page
gitrevio_capability_run
{ "capability_id": "optimize_learning_vs_earning_allocation", "arguments": { ... } }
→ returns the result shown above Works in Claude Desktop, Claude Code, Cursor, Cline, Continue.dev, Goose and Aider. See the MCP server.
Related tools
Calculate value of delay to decide
Calculate a period-by-period value-of-delay curve that separates prospectively available information from waiting cost and changing action economics under coherent scenarios.
Recommend stop continue scale decisions
Recommend stop, continue learning, or scale for aggregate initiatives using beta-binomial posterior rollout economics, independent harm gates, simulation precision, sampling cost, and opportunity decay.
Audit commercial technical commitment integrity
Audit signed commercial promises against explicitly allocated technical scope, dependency order, funded capacity, acceptance criteria and evidence; expose orphan scope, double allocation, cycles, late plans and maximum contractual penalty without interpreting legal rights from engineering activity.
Audit decision execution fidelity
Audit whether approved decisions actually became verified implementation at the promised aggregate-unit and component grain, with whole-unit bootstrap uncertainty and simultaneous gates for fidelity, overdue scope, unverifiable evidence, exceptions and critical gaps.
Audit KPI threshold bunching
Detect a post-target excess concentration immediately above a governed KPI threshold: compare within-unit pre/post local mass and above-versus-below mirror asymmetry, bootstrap whole units, report density bins and a smoothed log-density jump, and explicitly refuse to equate bunching with individual gaming or intent.
Audit release risk prediction integrity
Audit a complete eligible-change release-risk cohort for point-in-time prediction lineage, exact change-to-deployment linkage, mature mutually exclusive outcomes, selective labels, score-triggered intervention contamination, calibration and false alarms before the score influences a release decision.