Skip to content

Support Float32 density tracking and prepared fixed-grid MEPV selection #94

Closed

Description

@frankier

An explicitly Float32 grid/prior/bank does not currently produce a Float32 prepared MEPV scan. The density cache and EAP remain Float64, the Float32 grid misses prepared dispatch, and the generic variance path then fails on PBB's mixed-type SqDev restriction.

This is a follow-up to #93, reproduced at CAT ef85bb69d33cf32beb64d2361e7e5757a08c1907 with Julia 1.13.3, PBB main 530814fc69b82f35c9c5517aa17dafb39e83b3f7 (after its #22), and FittedItemBanks 0.7.7. The prepared-scan observations refer to that PR revision, not a claim that its code is already on CAT main.

Small reproduction

using ComputerAdaptiveTesting, FittedItemBanks, Distributions
using ComputerAdaptiveTesting: Aggregators, NextItemRules, Stateful
using PsychometricsBazaarBase: Integrators

grid = Integrators.even_grid(-4f0, 4f0, 33)
dist = Aggregators.PosteriorAbilityEstimator(Normal(0f0, 1f0))
tracker = Aggregators.AbilityTracker(Aggregators.GriddedAbilityTracker, dist, grid)
integral = Aggregators.AbilityIntegrator(grid, tracker)
point = Aggregators.MeanAbilityEstimator(dist, integral)
rule = preallocate(NextItemRules.FixedFirstItem(1,
    NextItemRules.ItemCriterionRule(point, NextItemRules.AbilityVariance(dist, integral))))
bank = TransferItemBank(Logistic(0f0, 1f0), Float32[-1, 0, 1, 2], ones(Float32, 4))
cat = Stateful.StatefulCat(CatRules(; next_item=rule, ability_estimator=point,
    termination_condition=TerminationConditions.RunForever()), bank)
Stateful.add_response!(cat, 1, true)
history = cat.tracked_responses[]
criterion = last(cat.rules.next_item.rules).criterion

typeof(tracker.density)  # Vector{Float64}
typeof(point(history))   # Float64
typeof(NextItemRules.init_thread(criterion, history)) # Speculator{...}
Stateful.next_item(cat)
# MethodError: no method matching (::SqDev{Float64})(::Float32)

The 2PL bank here avoids the separate Float32 promotion problem in FIB's guess/slip wrapper.

CAT-owned causes

  • ScalarGridIntegrator accepts only vectors with Float64 elements. Prepared MEPV dispatch uses this alias, excluding Float32 grids.
  • GriddedAbilityTracker stores Union{Nothing, Vector{Float64}}; grid_delta_density! also requires Float64 scratch at line 91.
  • Likelihood accumulation seeds sums/products with 0.0/1.0, promoting all-Float32 response evaluation. Empty histories need deliberate typed identity behavior when fixing this.

Fixing the upstream SqDev error alone restores neither Float32 caching nor prepared dispatch. Likewise, widening the dispatch alias alone leaves a mixed-precision implementation.

Scope and acceptance

  1. Preserve an appropriate numeric type across grid density, incremental updates, speculative stacks/scratch, EAP and candidate buffers. Respect deliberate mixed-precision inputs rather than blindly casting everything to the coordinate type. Keep Float64 defaults.
  2. Generalize prepared dispatch for supported Float32 scalar grids while retaining generic fallbacks for other domains, custom banks and unsupported configurations. Reuse PBB reductions and FIB responses; no new CAT-specific numerical kernel is needed.
  3. Test empty/nonempty histories, append/pop/clear/rebuild, speculation/rollback, and linear Float32 selection against an independent reference with precision-appropriate tolerances. Assert key intermediate types as well as final selections. Audit the analogous log path and document any remaining restriction.
  4. Rerun complete next_item benchmarks with Julia 1.13, including preparation, allocations, full criterion-vector comparisons and actual producer LLVM. Do not substitute a manually constructed prepared state for the public path.

Motivation and benchmark limits

The fresh Julia 1.13.3, 100,000-item linear run measured 49.109 ms for production CAT Float64 and 41.231 ms for SuperFastCAT Float32. An analysis-only CAT Float32 candidate probe measured 27.728 ms and emitted <8 x float> producer arithmetic (Float64 used <4 x double>). All four measured sizes selected the same items; maximum relative criterion error was about 3.8e-7 on that fixture.

That is evidence of an opportunity, not a supported end-to-end Float32 result or promised speedup. The probe manually built PreparedGridMEPV, rounded the real Float64 cached density on every scan, and used a local FIB affine wrapper to avoid response widening. The ordinary Float32 next_item call failed, so it has no successful runtime measurement. Raw artifacts are retained locally under CATExperiments/data/analysis/20261109-merged-paths/; these are not claimed to be published repository files.

Upstream tracking

  • PBB #23: mixed-type SqDev dispatch failure.
  • FIB #21: Float32 response/log-response widening in the guess/slip wrapper.
  • FIB #22: parameter conversion rejects Float32 and loses nonzero guesses on the successful Float64 path. Build banks explicitly until fixed.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions