Skip to main content
Skip to content
Agentic Finance

Did the AI Implement the Formula It Cited? A 2027 Fidelity Test

Test a cited formula with hand-verifiable inputs. This 2027 denominator audit separates mathematical fidelity, plausible output, and untested trading usefulness.

A copper magnifying lens rests over a simple arrangement of ivory mathematical blocks on cobalt blue.
Reading options: audio, text size & sections

What Matters: A citation can identify the intended formula without proving that generated code implements it. DN uses a deliberately authored denominator mismatch to show a small, decisive fidelity test. On observations 1, 2 and 3, sample standard deviation is 1; dividing by N instead produces about 0.8165. Neither output alone establishes a useful trading model.

Evidence: The formula source and RD-Agent documentation were checked on 28 November 2026. DN executed original calculations and boundary tests on that date. This 2027 demonstration evaluates an intentional teaching mismatch, not a discovered defect in RD-Agent or an observed mistake from an AI coding run.

Begin with a testable implementation claim

“The code uses standard deviation” leaves several choices unresolved. Is the input treated as a sample or a whole population? Are missing observations omitted or rejected? Is the result calculated over a trailing window? Does the current observation belong to that window? A citation can help define the intended method, but these choices still have to appear in an executable contract.

A useful fidelity claim is narrower: given these finite observations, implement this stated sample-standard-deviation expression, with this denominator and this handling of invalid input. It can be checked before running a larger research pipeline. If the small contract fails, a convincing final chart does not repair the mismatch.

RD-Agent’s finance documentation describes research workflows that develop factors and models. It provides a reason to take the translation from research statement to implementation seriously. Our test is an independent teaching example; no autonomous research loop or model endpoint was run.

The reference expression

The NIST statistical handbook defines the sample standard deviation using squared deviations from the sample mean, divided by N − 1, followed by a square root. We use that expression as the specification. A population-convention calculation divides by N. Both conventions exist; the fidelity question is which one the implementation promised to use.

Take the values 1, 2 and 3. Their mean is 2. The deviations are −1, 0 and 1, whose squares sum to 2. With three observations, the sample divisor is two. The sample variance is therefore one and the sample standard deviation is one. Every step can be checked without trusting the candidate program.

Hand-verifiable denominator test
StepSpecified sample formulaDeliberate candidate mismatch
Input1, 2, 31, 2, 3
Mean22
Squared deviations1 + 0 + 1 = 21 + 0 + 1 = 2
DivisorN − 1 = 2N = 3
Standard deviation10.81649658
Absolute mismatchReference0.18350342

Plausible output is a weak check

The candidate result is positive, finite and smaller than the range. It looks reasonable. A test that checks only that the program returns a number would pass it. Even a visual inspection of a long series might not reveal the difference, especially if the chart rescales itself. The defect relative to our specification becomes clear only when the expected value is independently known.

For this sample, the candidate is about 18.35 percent below the specified result. That relative difference is a property of these two definitions on this finite input. It is not an estimate of trading losses or a claim that one convention is universally better. If the method had explicitly requested the population convention, the same candidate arithmetic would satisfy that part of the request.

A constant sample is useful but cannot distinguish the conventions

Now use 5, 5 and 5. Every deviation is zero. Dividing zero by either two or three still gives zero, and both standard deviations are zero. This is a useful boundary case, but it is a poor sole test for the denominator. A faulty implementation could pass it while failing the intended formula on any nonconstant sample.

A strong small test set combines distinguishing and boundary cases. The executed fixture also uses −3, −1 and 1, whose sample standard deviation is two. It checks that negative observations are handled as ordinary values rather than rejected merely because they are negative. A single observation is rejected for the declared sample formula because its denominator would be zero.

Repair the narrow claim, then expand the audit

Changing the candidate denominator to N − 1 makes the 1, 2, 3 example agree exactly with the stated result. That repair resolves the demonstrated mismatch. It does not prove that every numerical or data-handling detail is correct. The right next step is to identify the other choices that the larger method actually depends on and add tests for them.

For a rolling feature, supply a short timestamped sequence and manually identify the observations that should enter each output. For a weighted statistic, choose weights that make an arithmetic error visible. For a missing-value rule, include one deliberate gap and state whether the output should disappear, carry forward or use fewer observations. These cases address specific implementation questions rather than collecting impressive-looking test counts.

The source-to-output record

A practical fidelity evidence chain
RecordWhat to specifyWhat it prevents
SourceExact document or pinned code versionA changing reference being treated as fixed
InterpretationInputs, units, denominator and timingA vague name substituting for a formula
FixtureSmall inputs and independent expected outputsThe candidate defining its own answer
ImplementationThe exact code version under testA repaired version being confused with the failed one
ResultPasses, mismatches, rejected cases and limitationsA clean final chart hiding unresolved failures

Keep the original failed case after repairing it. It becomes a regression check: a later refactor should not reintroduce the same denominator error. Also preserve the declared interpretation. Otherwise a future maintainer may change the code to a different valid convention and unknowingly break compatibility with the research method.

Run the denominator comparison

Formula fidelity: denominator check

Enter a small numeric sample. Compare sample standard deviation with population standard deviation and inspect the difference.

Works in your browser with your inputs. No account, data subscription or broker connection is required.

The selected denominator implements a different convention from the stated sample formula.

Observations
3
Mean
2.00000000
Sum of squared deviations
2.00000000
Sample standard deviation
1.00000000
Candidate standard deviation
0.81649658
Absolute mismatch
0.18350342

A match on one input does not establish formula fidelity across timing, missing values or all edge cases.

The initial result is a worked example. Changing an input changes the stated scenario, not an exchange account or a verified market result.

The browser worksheet accepts two to one hundred finite observations. Its selected denominator controls the candidate result, while the reference remains the sample formula. Try the default sample, the constant boundary and a scaled sample such as 2, 4 and 6. Scaling those observations doubles both standard deviations and preserves the relative convention difference.

The worksheet rejects blank input, nonfinite values, an unsupported convention and an insufficient sample. It does not silently decide how to impute missing data. Displayed precision is for comparing this arithmetic; eight decimal places should not be mistaken for eight decimal places of knowledge about a financial quantity.

Formula correctness and financial usefulness are separate questions

A correct implementation can describe an irrelevant feature, use badly timed observations or feed a model that fails on later data. A useful-looking backtest can also contain an implementation mismatch that accidentally improves its score. Neither outcome allows the fidelity question to be skipped. Establish what was computed before arguing about whether it was useful.

Once the formula is verified, prediction evaluation needs a declared target, information cutoff, comparison baseline and unused evaluation observations. Portfolio evaluation adds position sizing, execution timing and costs. The formula test supplies one piece of that chain. It should appear as a completed narrow check, not a badge that certifies the entire system.

What an AI-assisted review should ask for

Ask the assistant to restate the formula in plain language, identify every convention it has chosen and show the expected result for a tiny input before writing the implementation. Review that specification independently. Then compare the returned program with the accepted examples. This workflow makes an ambiguity visible early without assuming that the assistant’s explanation and code necessarily agree.

When a discrepancy appears, record whether the source was ambiguous, the interpretation differed, the code was wrong or the test expectation was wrong. Those are different findings. Calling every mismatch an AI hallucination would obscure the actual cause, just as accepting every plausible number would hide it.

Choose a tolerance that belongs to the quantity

The expected result should include a comparison rule. Exact integer identities can often be checked exactly; floating-point calculations may need an absolute or relative tolerance. State that rule before inspecting a mismatch. A tolerance chosen afterward merely to accept the candidate changes the test instead of resolving the implementation question.

Our displayed decimals are rounded, while the executable checks retain floating-point values and use a small numerical tolerance for the Python cross-check. The denominator difference is far larger than that tolerance. For a quantity near zero, a relative error alone can become undefined or misleading; an absolute bound may be more informative. For a large-scale input, the same absolute bound can be unnecessarily strict. These choices should reflect numerical precision and the accepted specification. They are separate from any later economic threshold such as whether a forecast difference would change a position.

Methodology and limits

DN calculated the examples with original standard-library Python and cross-checked sample values with Python’s statistics implementation. Independent browser tests use hand-known outputs for the nonconstant and constant cases, the corrected denominator and invalid inputs. The scripts and result record distinguish the deliberate candidate from the stated reference.

No real AI-generated code was graded, no upstream bug was established and no financial performance was tested. The next useful artifact is a small, replayable formula card stored with the research in the Research Desk: source, accepted interpretation, exact input, expected output and remaining questions. That record makes a citation operationally checkable.

Download the dated source and scenario record (JSON) · Download the reproducible calculation pack (ZIP).

Frequently asked questions

Did DN discover an error in RD-Agent?

No. DN intentionally wrote a denominator mismatch for a teaching example. The article does not evaluate an observed AI coding session or establish an upstream defect.

Is dividing by N always wrong?

No. It is a different convention. It fails this particular contract because the cited reference is the sample-standard-deviation formula using N−1. The intended convention must be stated before grading the implementation.

Why can a constant sample hide the problem?

All squared deviations are zero, so both denominators produce zero. Include a nonconstant sample with a hand-known result as well as useful boundary cases.

Primary sources and evidence

Editorial disclosure: This research explains documented capabilities and original worked examples. Inclusion does not imply endorsement, a commercial relationship or verified trading performance. No placement in this article was purchased.

Corrections and updates: Send source-backed corrections to press@decentralised.news. This 2027 edition was checked on 28 November 2026; documentation, permissions and product availability can change.

Get the most talked about stories directly in your inbox

Join the Decentralised News briefing for independent crypto, DeFi and AI analysis. No spam, unsubscribe anytime.