expectedparrot / edsl

Design, conduct and analyze results of AI-powered surveys and experiments. Simulate social science and market research with large numbers of AI agents and LLMs.
https://docs.expectedparrot.com
MIT License
176 stars 18 forks source link

QuestionLinearScale response is sometimes invalid "0" when question_options start at "1" #18

Closed rbyh closed 21 hours ago

rbyh commented 8 months ago

LLM will sometimes return "0" when the question_options are [1,2,3, ... ], even when the question_text notes the scale (eg, "...on a scale from 1 to 7":

image image

Perhaps the prompt is too confusing:

image
rbyh commented 8 months ago

Currently, QuestionLinearScale uses the QuestionMultipleChoice prompt without modification. Suggest modifying as follows:

        You are being asked the following question: {{question_text}}
        The options are 
        {% for option in question_options %}
        {{option}}
        {% endfor %}                       
        Return a valid JSON formatted like this, selecting only the option number: 
        {"answer": <put option number here>, "comment": "<put explanation here>"}
        Only 1 option may be selected.
apostolosfilippas commented 8 months ago

@rbyh check the commit b718410 I think it should fix this

rbyh commented 8 months ago

The problem with linear scale questions is that the option codes could be confusing. If you want the scale to start with 0 then 0: 0, 1: 1, etc, is fine but not if you want to start with 1 or some other number. Without the ability to test for confusion, it might be cleanest for the prompt to not use answer codes and then skip the answer code translation step afterwards.

rbyh commented 8 months ago

I suggest this because I've found the problem occurs even when the question prompt specifies the scale, which I would expect to eliminate confusion.