A code and data repository accompanying Szőcs, O., Zhou, H., & Wu, C. M. (2025). The Forest for the Trees: Global vs. Local Advice in Human-AI Interaction.
Citation: Szőcs, O., Zhou, H., & Wu, C. M. (2025). The Forest for the Trees: Global vs. Local Advice in Human-AI Interaction. Proceedings of the Annual Meeting of the Cognitive Science Society, 47. Retrieved from https://escholarship.org/uc/item/3g44f555
@inproceedings{szocs2025forest,
title = {The Forest for the Trees: Global vs. Local Advice in Human-AI Interaction},
author = {Sz\H{o}cs, Orsolya and Zhou, Hanqi and Wu, Charley M},
doi = {10.31234/osf.io/ha6nr_v1},
booktitle = {Proceedings of the 47th Annual Conference of the Cognitive Science Society},
editor = {Ruggeri, Azzurra and Barner, David and Walker, Caren and Bramley, Neil},
publisher = {{Cognitive Science Society}},
year = {2025},
address = {San Francisco, CA},
}Preprint version: https://doi.org/10.31234/osf.io/ha6nr_v1
This repository contains everything you need to reproduce our study on global (high-level) vs. local (low-level) AI advice in a hierarchical decision-making task. It includes:
- The HTML/JS/PHP code for running the colour-configuration experiment.
- Raw and processed participant data (JSON).
- Scripts and notebooks to generate the reward landscapes used in the experiment.
- Analysis scripts and notebooks to clean, analyse, and visualise the data.
git clone https://github.com/orsiszocs/global-vs-local-ai-advice.git
cd global-vs-local-ai-adviceExperiment code and Analysis code have their own setup steps below. The former refers to the contents of the experiment/ folder, while the latter to the contents of the analysis/ folder.
The anonymised dataset is stored as an array of participant objects in analysis/data/ColourCombo_101_flagged.json. Each object has this general structure:
{
"id": "51>56",
"workerID": "anon",
"assignmentID": "anon",
"experimentData": {
"age": "34",
"gender": 0,
"usefulAi": 7,
"followedAi": 7,
"prolificId": "anon",
"roundsData": [
..., {
"trials": [{
"timestamp": "2025-01-13T20:18:30.735Z",
"suggestion": [[0, 0, 0, 0, 0, 0, 0, 0], [-1, 1, -1, 1]],
"combination": [1, -1, 1, 1, 1, -1, 1, 1],
"noisyReward": 111,
"coefficients": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
},
...],
"landscape": {
"id": 42,
"blockNr1": 2,
"blockNr2": 0,
"maxReward": 191,
"minReward": 29,
"rewardScalar": 17.307808543287482,
"coefficientsLow": [-0.34809894829249627, ...],
"coefficientsHigh": [0.5196949568663821, ...],
"initialCombination": [1, -1, 1, 1, 1, -1, -1, 1]
},
"roundType": "assisted",
"lowColour1": "#dcbeff",
"lowColour2": "#800000",
"highColour1": "#ffe119",
"highColour2": "#4363d8",
"bonusPayment": 0.23833333333333329,
"relativeScore": 0.8972222222222221,
"usefulAiRound": "7"
},
...],
"strategyAi": "I looked at the colours they suggested and just did trial and error and found i'd find the colour combination quicker.",
"bonusReward": 1.22,
"strategyOwn": "it was just a case of trial and error. trying different combinations",
"allActionsData": [..., {
"action": "square clicked",
"timestamp": "2025-01-13T20:06:46.813Z",
"combination": [1, 1, 1, 1, -1, 1, 1, 1]
}, ...],
"recommendationType": "high",
"aiInstructionColours": {
"lowColour1": "#4363d8",
"lowColour2": "#800000",
"highColour1": "#ffe119",
"highColour2": "#dcbeff"
}
},
"reward": "1.22",
"task_start": "2025-01-13 20:09:03",
"task_end": "2025-01-13 20:33:20",
"assigned": "1",
"completed": "1",
"outlier": false
}Field explanations
idParticipant identifier combining cohort and start order.rewardBonus payment (£) obtained by the participant.outlierBoolean flag marking whether this participant's data was an outlier.experimentData.genderEncoded as0 = Female,1 = Male, and2 = Other.experimentData.usefulAiParticipant’s agreement with “The AI assistant was useful.” on a 1-7 Likert scale.experimentData.followedAiParticipant’s agreement with “I followed the AI’s suggestions.” on a 1-7 Likert scale.experimentData.roundsDataParticipant's rounds as an array.experimentData.roundsData[].trialsTrials from a round as an array.experimentData.roundsData[].trials[].suggestionThe low-level and high-level features suggested by the AI advisor.experimentData.roundsData[].trials[].combinationParticipant's selection.experimentData.roundsData[].trials[].noisyRewardParticipant's reward.experimentData.roundsData[].trials[].coefficientsThe AI advisor's coefficients when generating its suggestion.experimentData.roundsData[].landscape.blockNr1One of the two rectangles that the local AI refers to.experimentData.roundsData[].landscape.coefficientsHighThe high-level coefficients of this landscape as an array.experimentData.roundsData[].landscape.initialCombinationThe random combination shown to the participant in the beginning of the round.experimentData.roundsData[].roundTypeRound type:"assisted"(AI-assisted),"individual"(no AI support), or"tutorial"(the very first round).experimentData.roundsData[].lowColour2One of the square colours.experimentData.roundsData[].usefulAiRoundParticipant’s agreement with “The AI assistant was useful in this round.” on a 1-7 Likert scale.experimentData.strategyAiParticipant's response to “What strategies did you use when completing the rounds with the help of the AI?”experimentData.strategyOwnParticipant's response to “What strategies did you use when completing the rounds on your own?”experimentData.recommendationTypeAI condition:"high"(global) or"low"(local).
- Prerequisites
- PHP ≥ 7.2
- MySQL (or MariaDB) ≥ 5.7
- A local web-server environment of your choice (e.g. XAMPP, MAMP, LAMP, Docker, etc.)
- A modern browser with ES module support
- Launch your preferred PHP + MySQL stack so that PHP pages can run and connect to a database.
- Serve the experiment by either:
-
Deploying the
experiment/folder into your web-root. For example:- XAMPP (Windows):
C:\xampp\htdocs\experiment - MAMP (Mac):
/Applications/MAMP/htdocs/experiment
- XAMPP (Windows):
-
Or using PHP's built-in server from the repo root:
php -S localhost:8000 -t experiment/
-
- Set up the database
- Create a database named
db(or pick your own name). - Use
experiment/create_table.sqlto set up theColourCombotable.
- Create a database named
- Configure
databasecall.php- Open
experiment/databasecall.phpand find the TODO block. Update it with your host/user/password/database.
- Open
-
Open in your browser:
http://localhost/experiment/experiment.html?STUDY_ID=test&PROLIFIC_PID=test&SESSION_ID=test -
The page will auto-assign the AI condition. At the end of the experiment, a row is populated in the
ColourCombotable.
-
Prerequisites
- Conda or Miniconda
- Python 3.11+
-
Create and activate environment
cd analysis conda env create -f environment.yml conda activate global-vs-local-analysis -
Register Jupyter kernel (optional)
python -m ipykernel install --user --name global-vs-local-analysis --display-name "Python (global-vs-local-analysis)" -
In your code editor, open the
analysis/folder as your workspace root.
The scripts and notebooks under analysis/methods/ prepare reward landscape sets and simulate AI advisor behaviour.
01_advisor_suggestion_order.ipynbCounts how often an AI suggestion is the true 1st, 2nd, …, 16th best suggestion across random landscapes.02_advisor_high_low_comparison_basic_landscapes.pyGenerates random landscapes and computes global vs. local AI values.03_preselect_landscape_trios.pyFrom 100 000 random landscapes, preselects 100 trios minimising global vs. local AI value differences.04_advisor_high_low_comparison_preselected_landscapes.pyComputes AI values for the 100 preselected landscape trios.05_select_landscape_trios.ipynbFrom the 100 preselected landscape trios, selects the final 20 trios minimising global–local reward imbalance.06_advisor_high_low_comparison_histogram.ipynbCompares AI value difference distribution between completely random and selected landscape trios.07_visualise_landscape_and_suggestion_graphs.pyDraws each landscape as a graph and highlights suggestions.08_linear_regression_performance.ipynbSimulates the performance of linear regression + softmax over 20 trials.09_landscape_coefficient_statistics.ipynbPlots coefficients distributions from the final selected landscapes.
The scripts and notebooks under analysis/results/ load experimental data, flag outliers, visualise data and perform statistical analyses.
01_flag_outliers.ipynbFlags outliers by combined Z-score on distinct selections vs. average score.02_time_and_payment.ipynbShows participants' completion time and total payment.03_check_data_validity.pyTests data integrity.04_individual_performance_10.ipynbPlots learning curves, free-text strategies, payments, and AI ratings for the 10-participant cohort.05_individual_performance_40.ipynbPlots learning curves, free-text strategies, payments, and AI ratings for the 40-participant cohort.06_individual_performance_51.ipynbPlots learning curves, free-text strategies, payments, and AI ratings for the 51-participant cohort.07_simulate_counterfactual_advisor.pyFor each real trial, simulates 100 counterfactual suggestions from the opposite AI type.08_analysis_101.ipynbPlots and analyses participant scores, rewards, AI adherence, counterfactual AI value and adherence, ratings, AI values, completion time.
If anything is unclear or you run into trouble, please contact Orsolya Szőcs at orsoszocs@gmail.com.