Answers.Body: <p>The behavior you're observing is likely due to the nature of how GPT-3.5 generates text. It's a complex model trained on a large dataset, but it doesn't have an inherent understanding of the concepts of &quot;lists&quot; or &quot;variable length&quot; in the same way humans do.</p>
  <p>When you ask for a &quot;variable length&quot; list, GPT-3.5 doesn't have a direct way to understand what that means. Instead, it might default to generating lists with a fixed number of items because it doesn't have any specific instructions on how to handle variable lengths.</p>
  <p>To overcome this, you might need to approach the problem in a slightly different way. Instead of asking for a variable length list directly, you can ask for a list with a specific range, and then manually trim it down to the desired length afterwards.</p>
  <p>For example, you could ask for a list with a range between 5 and 15 items, and then manually remove any excess items once you receive the response.</p>
  <p>Keep in mind that while this method might work better for getting variable length lists, it's not foolproof. GPT-3.5 might still produce lists with a consistent length due to its training data and patterns it learned during training.</p>
  <p>If you absolutely need precise control over the length of the list, you might need to implement some post-processing on the generated output to trim it down to your desired length. This could be done using some form of list summarization or filtering algorithm after receiving the response from the model.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-19T16:11:44.703Z
Answers.Text: Sadly stripping list entries later will be not feasible in my current case. However you explanation why this can't work is really helpful, thanks!
Answers.UserDisplayName: flori
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-19T13:53:26.600Z
Answers.LastActivityDate: 2023-09-19T13:53:26.600Z
Answers.UserDisplayName: Kanan Suleyman
Body: <p>I struggle to get a variable list out of an LLM. Even with a prompt like</p>
  <pre><code>short list of the most important steps to build a house, with a variable length between 5 and 15 entries
  </code></pre>
  <p>The resulting list has most of the time exactly 15 entries, sometimes exactly 10, but never eg. 6 or 8 also never 13. Why? How to overcome this?</p>
  <p>I also tried prompts like <code>… maximum 15 entries</code>, however this also produces always exactly 15 entries, never less.</p>
  <p>The topic of the lists can vary and I expect the ideal list will depend on the complexity of the topic, sometimes 6 entries will have all relevant information, but sometimes more will be needed. The LLM should fiddle this out by itself.</p>
  <p>Is this a general LLM problem? I experienced this with Open AIs GPT-3.5.</p>
  
Tags: <open-ai><large-language-models><prompt-design>
Title: How to prompt an LLM for a real variable list length?
UserDisplayName: flori
ThreadText: # How to prompt an LLM for a real variable list length?
  
  (Asked by: username_0 on 2023-09-19)
  
  I struggle to get a variable list out of an LLM. Even with a prompt like
  
  ```
  short list of the most important steps to build a house, with a variable length between 5 and 15 entries
  
  ```
  
  The resulting list has most of the time exactly 15 entries, sometimes exactly 10, but never eg. 6 or 8 also never 13. Why? How to overcome this?
  
  I also tried prompts like `… maximum 15 entries`, however this also produces always exactly 15 entries, never less.
  
  The topic of the lists can vary and I expect the ideal list will depend on the complexity of the topic, sometimes 6 entries will have all relevant information, but sometimes more will be needed. The LLM should fiddle this out by itself.
  
  Is this a general LLM problem? I experienced this with Open AIs GPT-3.5.
  
  **Tags:** open-ai, large-language-models, prompt-design
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-09-19. Score: 1
  
  The behavior you're observing is likely due to the nature of how GPT-3.5 generates text. It's a complex model trained on a large dataset, but it doesn't have an inherent understanding of the concepts of "lists" or "variable length" in the same way humans do.
  
  When you ask for a "variable length" list, GPT-3.5 doesn't have a direct way to understand what that means. Instead, it might default to generating lists with a fixed number of items because it doesn't have any specific instructions on how to handle variable lengths.
  
  To overcome this, you might need to approach the problem in a slightly different way. Instead of asking for a variable length list directly, you can ask for a list with a specific range, and then manually trim it down to the desired length afterwards.
  
  For example, you could ask for a list with a range between 5 and 15 items, and then manually remove any excess items once you receive the response.
  
  Keep in mind that while this method might work better for getting variable length lists, it's not foolproof. GPT-3.5 might still produce lists with a consistent length due to its training data and patterns it learned during training.
  
  If you absolutely need precise control over the length of the list, you might need to implement some post-processing on the generated output to trim it down to your desired length. This could be done using some form of list summarization or filtering algorithm after receiving the response from the model.
  
  > **Comments:**
  > **username_0**: Sadly stripping list entries later will be not feasible in my current case. However you explanation why this can't work is really helpful, thanks!  
  
  ---
  
  