In general, the disclosure describes various aspects of techniques for attention-based explanations for artificial intelligence behavior. A device comprising a memory and a computation engine executing a processor may be configured to perform the techniques. The memory may store the artificial intelligence model and the image. The computation engine may receive a query regarding the image, and execute the artificial intelligence model to analyze the image in order to output the result to the query. The artificial intelligence model may, when analyzing the image to output the result, segment the image into hierarchically arranged semantic areas in which objects in the image are segmented into parts, determine, based on the query, an attention mask for the areas, update, based on the attention mask, the image to visually identify which of the areas formed a basis for the result, and output the updated image.
Attention-based explanations for artificial intelligence behavior