Subtraction and simplicity report · NVIDIA/hyperflare-inference #688

Raw Markdown for agents: https://autobot.eidonix.com/p/2763df19-836f-4f17-8be4-480ef55839a4.md

Subtraction, Simplicity & Conventions review — PR #688 (fix(helios): align proposal_confidence manifest messages with submission-row layout)

Key findings

Verdict: the code change is already lean — there is nothing to subtract from behaviour. What should be replaced is the added prose and the added test scaffolding, as detailed below.


1. Convention break: two layout errors depart from the module's expected/got diagnostic form, and the PR made them longer while less informative

Every other buffer-layout failure in the same function reports the expected layout and the actual dtype/shape:

helios/src/execution/manifest.rs:632-641

                    return Err(Error::execution(
                        ExecutionError::Manifest,
                        format!(
                            "completion_logprobs: expected Int32 shape {expected:?} with \
                             even last extent {}..={LOGPROB_FIELDS}; got {:?} shape {:?}",
                            LOGPROB_PAIR_FIELDS * 2,
                            output.dtype,
                            output.shape,
                        ),
                    ));

helios/src/execution/manifest.rs:643-652

                    if flags.dtype != Dtype::Int32 || flags.shape != [self.request_capacity()] {
                        return Err(Error::execution(
                            ExecutionError::Manifest,
                            format!(
                                "logprob_requested: expected Int32 shape {:?}; got {:?} shape {:?}",
                                [self.request_capacity()],
                                flags.dtype,
                                flags.shape,
                            ),
                        ));
                    }

and the required-buffer table at manifest.rs:801-817 uses format!("invalid required buffer layout: {name}").

The two literals this PR rewrote do neither:

helios/src/execution/manifest.rs:830

            return Err("proposal confidence requires [2, request_capacity, draft_capacity] float32 frames indexed by submission row (sized to max_active.next_power_of_two()) and draft depth 1..=T-1".into());

helios/src/execution/manifest.rs:871

                    return Err("confidence output requires a speculative graph whose confidence_width equals draft_tokens and [2, request_capacity, draft_capacity] float32 submission-row frames covering confidence_width within draft depth 1..=T-1".into());

Guarding predicates (unchanged by this PR): manifest.rs:827-829 — Float32, rank 3, shape[0] == 2, shape[1] == self.request_capacity(), (1..completion_token_capacity).contains(shape[2]); and manifest.rs:861-870 — kind == Speculative, confidence_width == draft_tokens, dtype/shape as above, shape[2] >= confidence_width, shape[2] <= T-1.

Concretely, replace both literals with the module's own expected/got form, which removes the prose restatement of the layout and the next_power_of_two() formula from the error path (that formula is already defined at manifest.rs:583-585 and stated in helios/manifest.md:211-213) while adding the diagnosis the message currently lacks:

// :830
return Err(format!(
    "proposal_confidence: expected Float32 shape [2, {}, 1..{}]; got {:?} shape {:?}",
    2, self.request_capacity(), self.completion_token_capacity - 1,
    buffer.dtype, buffer.shape,
).into());

and the graph arm (:871) in the same form, prefixed with the graph name so the failing graph is identified (graph.name, iterated at manifest.rs:850), e.g. "{name} confidence output: expected ... got ...". This shortens both strings, removes the "submission row"/"submission-row" prose pair, and brings the diagnostics back under the convention that AGENTS.md:188-193 frames as "Reject unsupported abstractions and churn" (comment/prose expansion that does not carry behaviour) and AGENTS.md:122-128 ("Resolve references where they are needed") frames in the other direction — prose that introduces identifiers must resolve them.

Note the internal spelling inconsistency the PR introduces and does not explain: manifest.rs:830 says "submission row", manifest.rs:871 says "submission-row". The test asserts the hyphenated spelling for one arm and the spaced spelling for the other (tests.rs:1367, :1392), so the inconsistency is now locked in by test.

2. Duplication: the same contract sentence is now normative in five places, two of them undefined in context

The same statement of the layout now exists in:

  1. helios/src/execution/manifest.rs:830 (buffer arm, verbatim quoted above)
  2. helios/src/execution/manifest.rs:871 (graph arm, verbatim quoted above)
  3. helios/manifest.md:164-169
survival outputs have T−1 positions. Proposal-confidence buffers
(`proposal_confidence`) are contiguous `float32` storage with shape
`[2, request_capacity, draft_capacity]`, indexed by completion frame, submission
row (sized to `request_capacity = max_active.next_power_of_two()`), and draft
depth `1..=T−1`, covering each graph’s confidence width. Cores
  1. helios/model-contract.md:227-233
A program producing confidence declares `confidence_width`, equal to its actual
D. `proposal_confidence` is contiguous FP32 storage with shape
`[2, request_capacity, draft_capacity]`, where
`request_capacity = max_active.next_power_of_two()` and `draft_capacity` is in
draft depth `1..=T−1` covering every declared output width. Frame index selects
the completion frame, and submitted rows retain their lane order. There is no
unframed confidence layout.
  1. helios/README.md:301-304
A produced confidence sidecar declares `confidence_width` and uses two FP32
frames shaped `[2, request_capacity, draft_capacity]` indexed by submission row
(sized to `max_active.next_power_of_two()`) and draft depth `1..=T−1`. Host
dependencies are derived

helios/manifest.md is the execution-manifest specification and already defines the quantity at helios/manifest.md:205-213 ("Request storage capacity is max_active.next_power_of_two(). … while SchedulerLimits.request_slots remains the captured transport capacity"). Concretely: keep the full normative statement in helios/manifest.md only; reduce model-contract.md:227-233 and README.md:301-304 to the shape plus a reference to the manifest specification, and reduce the two error strings to the expected/got form in finding 1. That removes three copies of the formula and is the version that survives the next contract change.

Two identifier defects the new text introduces (repo-prose skill .agents/skills/repo-prose/SKILL.md:20-25, "Explain concepts before identifiers … On first reference, give the object's semantic role"):

3. Test scaffolding: the new 64-line test duplicates an existing fixture and its rejections; only the message assertions are new

New test: helios/src/execution/tests.rs:1334-1396 (proposal_confidence_validation_describes_submission_row_layout). Setup at tests.rs:1339-1351:

    value.graphs[0].kind = GraphKind::Speculative;
    value.graphs[0].token_capacity = 6;
    value.graphs[0].draft_tokens = 5;
    value.graphs[0].packed_token_capacity = 24;
    value.graphs[0].confidence_width = 5;
    value.buffers.push(BufferDescriptor {
        name: "proposal_confidence".into(),
        address: 0x20000,
        nbytes: 2 * 4 * 5 * 4,
        dtype: Dtype::Float32,
        shape: vec![2, 4, 5],
        strides: vec![20, 5, 1],
    });
    value.validate().unwrap();

The neighbouring test already builds the identical configuration — tests.rs:1319-1327:

    value.graphs[0].kind = GraphKind::Speculative;
    value.graphs[0].token_capacity = 6;
    value.graphs[0].draft_tokens = 5;
    value.graphs[0].packed_token_capacity = 24;
    value.graphs[0].confidence_width = 5;
    value.buffers.push(BufferDescriptor { name: "proposal_confidence".into(),
        address: 0x20000, nbytes: 2 * 4 * 5 * 4, dtype: Dtype::Float32,
        shape: vec![2, 4, 5], strides: vec![20, 5, 1] });
    value.validate().unwrap();

and the graph-arm rejections the new test re-derives already exist at tests.rs:1161 (width_mismatch, confidence_width = 4) and tests.rs:1163-1168 (buffer too shallow), plus the buffer shape/dtype family at tests.rs:29-53 (optional_speculative_survival_validates_frame_layout).

The unique value is the message assertions only. Concretely: delete the [test] and the four-row (shape, strides, nbytes, dtype) table at tests.rs:1354-1371, and append the assertions to eight_token_completions_accept_shorter_proposal_confidence (tests.rs:1311-1332), which already has the valid manifest and already mutates confidence_width/draft_tokens/token_capacity at :1328-1330 — i.e. width_exceeds (tests.rs:1373-1376) is the same mutation already written there:

    value.graphs[0].confidence_width = 6;
    value.graphs[0].draft_tokens = 6;
    value.graphs[0].token_capacity = 7;
    assert!(value.validate().is_err());

The negative assertions are weaker than their length suggests and are asymmetric:

helios/src/execution/tests.rs:1370

        assert!(!error.contains("request slot"), "{error}");

helios/src/execution/tests.rs:1394

        assert!(!error.contains("request_slots"), "{error}");

"request slot" is not a substring of "request_slots" and vice versa, so the buffer loop cannot catch a regression that reintroduces the graph arm's old wording, and the graph loop cannot catch the buffer arm's old wording. Either use one uniform absence check, or drop the negative assertions and rely on the positive expected/got text from finding 1 (which no old spelling can produce). Note also the convention tension: AGENTS.md:194-199 asks that "Tests must exercise the affected behavior or contract" and warns that text checks cannot establish runtime correctness — asserting on a message prose string is the least durable form of this; asserting the expected shape fields in the message (finding 1's format! form) keeps the test tied to the geometry contract instead of to English.

4. Nothing to subtract from the logic — stated plainly

Confirmed against pr_diff and the head file:

5. Cross-file doc completion (repo convention, follow-up or blocker — needs a maintainer call)

The three Helios documents are now aligned, but the same contract is still printed with the old row extent outside helios/:

request_slots is not a rename of request_capacity; it is a different quantity elsewhere (SchedulerLimits.request_slots = captured transport capacity, helios/manifest.md:211-213), so these three sites are substantively wrong, not merely stylistically stale. The closest precedent is PR #542, which was blocked in review ("the batch-capacity specification is false in eleven places") until the author corrected docs/ as well. The description's claim that the PR "aligned all three specifications" is true of helios/* only; it does not mention docs/. Either extend the diff by three lines or state the exclusion in the description.


Open questions / not found