stan-dev / stan-dev/cmdstan

`info` method - expose information about the model

Open
#1,178 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
238
Forks
106
Avg merge
2h 29m
Merged PRs (30d)
6

Description

Summary:

Add a new info method that lets tools (or users) get info about the model to help e.g. deciding if the model needs recompilation.

Description:

Currently, a lot of the metadata about a compiled model can only be retrieved by running inference (Stan version, stanc flags) or not at all (cpp compile options, compiler, ...). This limits the ability of wrappers like cmdstanr to make good decisions on when to recompile a model as a change in compiler options or Stan version will not be recognized by checking modification times.

Beyond choosing to recompile or not, other tools may benefit from this metadata in my own work, the SBC package tries to do caching of its results and needs to check if the model it is given is substantially equivalent to a model the cached results were compiled with. It could rely on modification time, but this could result in some unnecessary recomputations (e.g. when the model is modified, found to be problematic and then the change is reverted). For those more extended usages by tools, it might make sense to also include the Stan code and the contents of user-provided extra .hpp in the information stored.

Since all of the information is known at a compile time, a simple implementation would have a .json (or other format) created at compile time and embedded as a resource. The output format could be configurable, but since the primary consumers are likely to be tools, it should probably default to JSON or similar.

Additional information:

If there is an agreement on implementing this, I'd be happy to write a PR.

Current Version:

v2.32.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no files, tests, or entry points; begin by locating where compiled model metadata and command methods are handled. Define the metadata exposed by the new info method, including compilation details and possibly Stan or header contents, then determine how compile-time JSON or another embedded format should be produced and verify the output supports recompilation and caching decisions.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.