> For the complete documentation index, see [llms.txt](https://help.metaforms.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.metaforms.ai/best-practices/ai-question-generation-batch-size-guide.md).

# AI Question Generation - Batch Size Guide

This document explains the recommended workflow for AI-assisted question generation across three generation tiers — 5-question batches for standard work, 3-question batches for moderate complexity, and single-question generation for complex setups — plus conditions for using 10-question batches responsibly. It includes a prompt guide with good and bad examples, and outlines common pitfalls. The goal is to maximize AI output accuracy and minimize rework.

## 1. Why 5 Questions Is the Recommended Standard

Generating a maximum of 5 questions per batch is the cornerstone of the Metaforms workflow for standard question types. Throughout this document, question complexity is referred to in tiers:

* L1–L2: Standard setups — single-select, multi-select, radio buttons, text inputs, grids, basic piping, standard logic, and quotas.
* L3 and above: Complex types requiring specialized handling — MaxDiff, Conjoint, JavaScript, Hybrid, Complex Loops, 3D Matrix, Patient Charts, and Custom Validation (covered in Section 2).

The 5-question batch applies to L1–L2 questions and balances four things: error minimization, AI learning, focused code review, and a tight sync-and-test cycle.

### 1.1 Why small batches work better

As batch size grows, the AI must hold more context simultaneously — question types, answer options, precodes, logic conditions, piping variables, and formatting standards. The likelihood of errors (wrong IDs, mismatched question text, misapplied logic, inconsistent formatting, phantom questions) increases with each additional question, and errors tend to cascade: a wrong pattern in question 3 of a 10-question batch often repeats through questions 4–10.

Smaller batches also support AI learning and focused review. When a programmer generates 5 questions, reviews them, and uses ‘Edit with AI’ to correct any issues, the AI retains that context for subsequent generations in the same project. With 10+ questions and multiple errors at once, the error surface is too broad for the AI to learn specific corrections. Smaller batches also let each question's XML, precodes, logic, and formatting be verified before moving on, and naturally support the recommended Generate → Sync to Decipher → Test → Fix → Next batch cycle.

## 2. Why 1 Question at a Time for Complex Questions

For high-complexity question types, even 3–5 questions at a time produces unreliable results. Single-question generation lets the AI dedicate its full context window to each setup.

### 2.1 Question types requiring single generation

| **Question Type**             | **Why Single Generation Is Required**                                                                                                                              |
| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| MaxDiff                       | Multi-step process (design files, DAT files, quota sheets, XML). Each step needs individual validation; combining steps causes compounding errors in quota logic.  |
| Conjoint Analysis             | Design file conversion, quota generation, and XML creation must be separate validated steps. Each conjoint question needs its design files verified independently. |
| JavaScript / Custom Scripting | Requires full HTML/XML context from browser inspector. Without exact structure and class info, the AI guesses and causes malfunctions.                             |
| Hybrid Questions              | Combine checkbox and radio columns with cross-column validation. AI must detect and apply validation between different input types — requires focused context.     |
| Complex Loops                 | Hidden variables control randomization, execute tags handle dynamic ordering. Errors in loop variables propagate unpredictably into nested structures.             |
| 3D Matrix                     | Rows × columns × dropdown cells often need manual programming workarounds. Individual generation and manual verification are essential.                            |
| Patient Chart / Multi-section | Healthcare layouts requiring precise masking and section-by-section programming with manual adjustments.                                                           |
| Custom Validation Logic       | Range limits, mutually exclusive options, and interdependent conditional rules — batching leads to logic errors and missed constraints.                            |

### 2.2 Core reasons

* Context window saturation: Complex questions need significantly more context (HTML/XML structure, design files, quota logic). Multiple at once exhausts the AI's effective context window.
* Multi-step validation: Each complex type requires intermediate validation that cannot be parallelized. MaxDiff needs DAT file verification before XML; JavaScript needs browser inspection between iterations; loops need variable validation before nesting.
* Specialization selection: Different complex types require different AI specializations (e.g., ‘Custom Styling & Scripting’ for JS, ‘MaxDiff’ for MaxDiff). Mixing specializations in one batch reduces accuracy.
* Iterative refinement: Complex questions often require back-and-forth — generate, inspect, feed back XML/HTML snippets, regenerate. This only works one question at a time.

## 3. Quick Reference: Batch Size Matrix

| **Batch Size** | **When to Use**                          | **Question Types**                                                                                 |
| -------------- | ---------------------------------------- | -------------------------------------------------------------------------------------------------- |
| 5 questions    | Standard workflow (L1–L2 complexity)     | Single/multi-select, radio, text input, grids, piping, basic logic, quotas                         |
| 3 questions    | Mixed complexity or dense logic sections | Moderate piping, nested conditions, multi-language setups                                          |
| 1 question     | Complex / advanced setups                | MaxDiff, Conjoint, JavaScript, Hybrid, Complex Loops, 3D Matrix, Patient Charts, Custom Validation |

## 4. Recommended Workflow Steps

* Study the questionnaire and identify sections by complexity level.
* Select the correct AI specialization(s) for the question type.
* Generate in the appropriate batch size — 5 for standard, 3 for moderate complexity, 1 for complex. Use prompts like ‘Generate Q1–Q5’ or ‘Generate next 5 questions.’
* Review the generated code — check precodes, logic, formatting, and question types.
* Fix issues immediately using ‘Edit with AI’ (Ctrl+K / Cmd+K) — this helps the AI learn for subsequent generations.
* Sync to Decipher after each batch to validate output in the survey environment.
* Test using the survey link before proceeding.
* Repeat until the full questionnaire is programmed.

## 5. Prompt Guide: Good vs. Bad Prompts

Prompt quality is one of the biggest factors in AI output accuracy. A clear, specific prompt is the difference between a clean generation and hours of rework.

### 5.1 Edit with AI: JavaScript / Custom Scripting

Select the ‘Custom Styling & Scripting’ specialization. With ‘Edit with AI’ (Ctrl+K / Cmd+K), select the relevant question first, then provide a specific instruction that includes the HTML/XML context from the browser inspector. Without this context, the AI guesses at class names and element structure.

| ✅  **Good Prompt**                                                                                                                                                     | ❌  **Bad Prompt**             |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| “Add custom JavaScript to Q14 to auto-sum the numeric inputs in rows r1–r5. Here is the current HTML structure: \[paste from inspector]”                               | “Add JavaScript to fix Q14”   |
| “Create a custom progress bar script. The survey container uses class .survey-page and the current page index is in element .page-counter. Here is the HTML: \[paste]” | “Add a progress bar”          |
| “Apply custom CSS to hide the back button on Q1. Here is the HTML from inspector: \[paste]”                                                                            | “Hide the back button”        |
| “Add JS to dynamically show/hide row r3 in Q9 based on the value selected in Q7. Here is the Q9 HTML structure: \[paste from inspector]”                               | “Make Q9 dynamic based on Q7” |

### 5.2 Edit with AI: Answer Validation

Select the ‘Answer Validation’ specialization. Select only the specific question that needs validation, then describe the exact rule — conditions, ranges, and error messages.

| ✅  **Good Prompt**                                                                                                                                        | ❌  **Bad Prompt**                 |
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| “Add validation to Q5: require exactly 3 selections from the checkbox list. Error message: Please select exactly 3 options.”                              | “Add validation to Q5”            |
| “Add range validation to Q8: numeric input must be between 18 and 99. Display error if outside range: Please enter a valid age between 18 and 99.”        | “Fix the validation on Q8”        |
| “Make options 98 (Don’t know) and 99 (Prefer not to say) mutually exclusive with all other options in Q12. If 98 or 99 is selected, deselect all others.” | “Add exclusive options to Q12”    |
| “Add sum validation to Q15 grid: all row values must sum to exactly 100. Error message: Your responses must total 100%.”                                  | “Validate Q15”                    |
| “Add cross-question validation: if Q3 answer is 1 (Yes), then Q4 must have at least one selection. Error: Please answer Q4 since you selected Yes in Q3.” | “Fix the logic between Q3 and Q4” |

### 5.3 Edit with AI: Hybrid Questions

Generate hybrid questions one at a time. When editing, describe the exact column structure, which columns are checkboxes vs. radio buttons, and what cross-column validation rules apply.

| ✅  **Good Prompt**                                                                                                                                                                                          | ❌  **Bad Prompt**                     |
| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------- |
| “Convert Q10 to a hybrid question: columns c1–c3 should be checkboxes (select all that apply), column c4 should be a radio button (single select). Add validation: if c4 is selected, c1–c3 must be empty.” | “Make Q10 a hybrid question”          |
| “Add cross-column validation to Q18: if any checkbox in column c1 (Awareness) is selected, the corresponding radio in column c2 (Preference) must also be answered for that row.”                           | “Add validation to Q18 columns”       |
| “Update Q22 hybrid setup: move the ‘None of the above’ row (r99) so it is mutually exclusive with all other rows. When r99 is checked in any column, deselect all other rows in that column.”               | “Fix the None option in Q22”          |
| “Create Q14 as a hybrid: rows are brands (r1–r8), column c1 is a checkbox for ‘Heard of’, column c2 is a radio for ‘Most preferred’. Only brands checked in c1 should be selectable in c2.”                 | “Create a hybrid for Q14 with brands” |

### 5.4 Quota Generation Prompts

Create quotas incrementally using the Quota tab (not the XML tab). Specify sheet name, conditions, limits, and quota logic type.

| ✅  **Good Prompt**                                                                              | ❌  **Bad Prompt**                            |
| ----------------------------------------------------------------------------------------------- | -------------------------------------------- |
| “Create quota for Q1 rows with the limits from the QNR”                                         | “Create all quotas”                          |
| “Create least filled quota for \[Sheet\_Name]”                                                  | “Add quotas as needed”                       |
| “Create gender x region quota with limits from the QNR”                                         | “Set up the quotas”                          |
| “Create quota tags for top 3 brands using least filled logic. Have highest priority for Brand1” | “Create Brand1\_Selection quota as per need” |

## 6. When 10-Question Batches Can Work

The platform supports 10-question generation, but the standard recommendation remains 5. Even under ideal conditions, 10-question batches carry higher error risk: the AI learning loop is weaker, code review is harder, and error cascade is more likely. This section documents the conditions under which 10-question batches can be used responsibly.

### 6.1 All of these conditions must be true

* L1–L2 complexity only — standard single-select, multi-select, radio, text, or number inputs. No logic, piping, validation, loops, JavaScript, or hybrid types.
* Same question type pattern — for example, 10 consecutive single-select Yes/No questions. The more uniform the block, the better the AI performs.
* No logic, piping, or conditional show/hide within the block.
* Previous batch was synced, tested, and error-free — the AI needs a clean baseline.
* Correct template and specialization already selected.
* You can review all 10 questions carefully before syncing. If not, use a 5-question batch instead.

### 6.2 Example: when it works

Scenario: Q6–Q15 are all single-select ‘Have you heard of \[Brand X]?’ with Yes/No options. No piping, no logic, no conditions.

Good prompt: “Generate Q6 through Q15. All are single-select Yes/No brand awareness questions. No logic or piping between them. Precodes: 1=Yes, 2=No.”

Why this works: Uniform question type, explicit precode format, no interdependencies, clear range specified.

### 6.3 Example: when it fails

Scenario: Q6 is a multi-select brand list, Q7 pipes from Q6, Q8–Q10 have show/hide logic based on Q6, Q11 is a text input, Q12–Q13 are grids with different column headers, Q14 has answer validation, Q15 is a ranking question.

Why this fails: Mixed question types, piping dependencies, conditional logic, and validation rules. This should be split into at least 3 separate batches (Q6–Q7, Q8–Q10, Q11–Q15) or smaller if individual questions need specialized handling.

### 6.4 Post-generation review checklist

* All 10 question IDs match the questionnaire (no skipped or duplicated IDs).
* Question type is correct for every question (no unexpected type switches).
* Precodes follow the expected format across all 10 questions.
* No extra or phantom questions generated beyond the requested range.
* No values incorrectly added to checkbox or text input questions.
* Formatting is consistent (font, style, spacing) across all 10 questions.
* Fix any issues immediately using ‘Edit with AI’ before syncing.

## 7. Common Pitfalls to Avoid

The patterns below consistently lead to problems and are listed roughly in order of how often they occur.

* Generating full surveys or large sections in a single prompt — prompts like ‘generate everything’, ‘finish the survey’, or ‘generate till end’ are the most common issue. They produce inconsistent output and make errors hard to isolate.
* Confusing ‘Generate with AI’ and ‘Edit with AI’ — using ‘Generate with AI’ to modify existing code creates extra and incorrect code. Use ‘Edit with AI’ for modifications; ‘Generate with AI’ only for new content.
* Making corrections directly in Decipher instead of using ‘Edit with AI’ — manual corrections outside the platform prevent the AI from learning, so the same mistakes repeat.
* Using ‘Generate Next 5’ when fewer than 5 questions remain — causes phantom questions at the end. Specify the exact remaining questions instead (e.g., ‘Generate Q48–Q50’).
* Using prompts for changes the platform handles better — ‘Update Question Type’ and ‘Update Styling’ are faster and more reliable than prompts for attribute-level changes.
* Relying on AI for quick manual fixes — small syntax corrections and quick formatting changes are often faster done manually.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.metaforms.ai/best-practices/ai-question-generation-batch-size-guide.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
