BEARS
BEARS is a technique for improving the reliability and trustworthiness of Neuro-Symbolic (NeSy) models by calibrating their concept-level uncertainty using Deep Ensembles [1], a Bayesian technique, without requiring extra data.
Typically, NeSy models tend to be overconfident about their concept predictions, even when these concepts are wrong due to Reasoning Shortcuts (RSs) [2]: solutions that attain high accuracy using low-quality concepts.
BEARS addresses this by constructing ensembles of NeSy models, each encouraged to disagree on which concepts to predict.
These models are then averaged together:
- Ambiguous concepts (those affected by reasoning shortcuts) show high uncertainty.
- Reliable concepts retain high confidence.
This makes it easy for users to detect and distrust low-quality concepts by leveraging concept uncertainty.
The approach is described in the UAI 2024 paper: Marconato, Emanuele, et al. "BEARS Make Neuro-Symbolic Models Aware of their Reasoning Shortcuts." Uncertainty in Artificial Intelligence. PMLR, 2024.”
References:
[1] Lakshminarayanan, Balaji, Alexander Pritzel, and Charles Blundell. "Simple and scalable predictive uncertainty estimation using deep ensembles." Advances in neural information processing systems 30
[2] Marconato, Emanuele, et al. "Not all neuro-symbolic concepts are created equal: Analysis and mitigation of reasoning shortcuts." Advances in Neural Information Processing Systems 36
Input and Output
Input
The input is an image. In the current implementation, the model focuses on the MNIST Even-Odd dataset, which consists of an image of shape (1, 28, 56), created by concatenating two MNIST digits side by side. The task is to predict the sum of the two digits in the image.
Output
The model returns four elements:
ys: the predicted label, i.e., the sum of the two digits.p_ys: the probability distribution over all possible sums.cs: the predicted concepts, i.e., the individual digit values.p_cs: the probability distributions over the possible values for each digit.
Init project
Install requirements.
pip install -r requirements.txt
Run a development environment
Install requirements.
pip install -r requirements-dev.txt
If useful, install local version for tango-interfaces.
pip uninstall tango-interfaces
pip install -e <path>/tango-interfaces/
Run tracking server and model registry
Run local tracking server and model registry.
mlflow ui
Prepare the environment for training/serving
Export the following environment variables.
export MLFLOW_TRACKING_URI="http://127.0.0.1:5000"
export MLFLOW_EXPERIMENT_NAME="test"
Use these if the server requires authentication.
export MLFLOW_TRACKING_USERNAME=<username>
export MLFLOW_TRACKING_PASSWORD=<password>
Make a training run
To make a run,
- ensuring that you have correctly exported the environment variables as described above
- execute the following command (this operation takes some time as creates environment).
mlflow run --env-manager local ./src
Running local model server
Install requirements.
pip install -r requirements-dev-modelserver.txt
Run a model server
Access experiment from tracking server web UI at http://127.0.0.1:5000.

Copy experiment runid.

Use the runid to set the corresponding environment variable.
export MLFLOW_RUN_ID=<runid>
Serve the model identified by the runid.
mlflow models serve -m runs:/$MLFLOW_RUN_ID/model --enable-mlserver -p 5001