Artificial Grammar Learning Task
| Field | Value |
|---|
| Name | Artificial Grammar Learning Task |
| Version | v0.1.0 |
| URL / Repository | https://github.com/TaskBeacon/T000082-artificial-grammar-learning-task |
| Short Description | Classic Reber finite-state artificial grammar learning paradigm |
| Created By | TaskBeacon |
| Date Updated | 2026-08-01 |
| PsyFlow Version | 0.3.0 |
| PsychoPy Version | 2025.1.1 |
| Modality | Behavior |
| Language | Chinese instructions; canonical Latin-letter stimuli |
| Voice Name | Disabled |
1. Task Overview
This task measures implicit acquisition of sequential regularities. Participants first memorize and reproduce strings generated by the classic Reber finite-state grammar without being told that a grammar exists. After a five-minute interval, they learn that the training strings followed a complex rule system and classify novel grammatical and one-position-violation strings using intuitive judgments. Primary outcomes are classification accuracy and response time; training reproduction accuracy is retained as a manipulation/engagement measure.
2. Task Flow

Block-Level Flow
| Step | Description |
|---|
| Load mode | main.py loads the human, QA, scripted-sim, or sampler-sim YAML profile while preserving one task implementation. |
| Initialize runtime | Collect or inject subject_id, construct TaskSettings, initialize trigger runtime, window, keyboard, and StimBank. |
| Training instructions | training_instruction teaches immediate letter-string reproduction but does not reveal the grammar. |
| Training block | generate_training_schedule(...) creates two independently shuffled passes through 16 fixed grammatical strings (32 logical trials). |
| Interphase interval | delay_fixation is shown for 300 s between acquisition and classification (delay_start/delay_end). |
| Test instructions | test_instruction reveals that the strings followed a complex system and teaches F = conforms, J = does not conform, emphasizing intuitive judgment. |
| Classification block | generate_test_schedule(...) shuffles 16 novel grammatical and 16 paired one-position-violation strings. No feedback is provided. |
| Summary and export | Display completion, accuracy, and mean RT; export one CSV row per training or test trial. |
Trial-Level Flow
| Trial Type | Step | Duration / Response | Visible Stimulus and Logic |
|---|
| Training | Study string | 3.0 s | letter_string: one centered uppercase P/T/S/X/V string. |
| Training | Immediate reproduction | 10.0 s per keystroke | recall_prompt and recall_typed; P/T/S/X/V append, Backspace deletes, Enter submits. |
| Training | Retry | 0.75 s, when needed | retry_notice; an incorrect reproduction is re-presented, up to three attempts total. |
| Training | ITI | 0.5 s | Neutral fixation; no grammar or correctness feedback. |
| Test | Grammaticality classification | 10.0 s | test_string above spatially separated classify_left (F, conforms) and classify_right (J, does not conform). |
| Test | ITI | 0.5 s | Neutral fixation; test trials never show correctness feedback. |
Controller Logic
| Feature | Description |
|---|
| Grammar validation | is_grammatical(...) walks the explicit Reber transition table and accepts only strings ending in the terminal state. |
| Training schedule | A custom item scheduler is required because two complete passes through a fixed pool must be preserved while shuffling each pass independently. |
| Test schedule | The scheduler validates disjoint positive pools, 50/50 grammaticality, one substituted character per negative item, and the recorded violation index before shuffling. |
| Determinism | Training and test orders derive from PsyFlow block seeds; trial factors are fully formed before run_trial(...). |
Other Logic
| Feature | Description |
|---|
| Training correctness | Exact submitted string equality determines recall_correct; training attempts and timeouts are retained. |
| Test correctness | F is correct for grammatical items and J for nongrammatical items; timeouts are missing (correct = null). |
| Summary metrics | Completed trials, overall accuracy, grammatical hit rate, nongrammatical correct-rejection rate, and mean response time are computed from test rows. |
| Simulation | The scripted responder reproduces strings exactly and classifies correctly; the sampler independently controls recall and classification accuracy. |
3. Configuration Summary
Settings below are from config/config.yaml.
a. Subject Info
| Field | Meaning |
|---|
subject_id | Three-digit participant identifier (101-999) in human mode; deterministic ID in QA/sim. |
b. Window Settings
| Parameter | Value |
|---|
| Size | 1280 x 800 |
| Units | degrees of visual angle (deg) |
| Background | #F5F5F2 |
| Fullscreen | false |
| Monitor geometry | 35.5 cm width, 57 cm viewing distance |
c. Stimuli
| Name | Type | Description |
|---|
training_instruction | text | Chinese incidental-learning and reproduction instructions. |
letter_string | text | Centered monospaced grammatical training string. |
recall_prompt | text | Chinese prompt and editing/submission key reminder. |
recall_typed | text | Participant's current monospaced reproduction. |
retry_notice | text | Neutral re-presentation notice. |
delay_fixation | text | Fixation during the five-minute interval. |
test_instruction | text | Grammar disclosure, intuitive judgment instruction, and F/J mapping. |
test_string | text | Novel grammatical or one-position-violation string. |
classify_left / classify_right | text | Spatially separated conforms/not-conforms options. |
fixation | text | Neutral inter-trial fixation. |
good_bye | text | Test completion and performance summary. |
d. Timing
| Phase | Duration |
|---|
| Training study string | 3.0 s |
| Recall response | 10.0 s per key event |
| Retry notice | 0.75 s |
| Training-test interval | 300.0 s |
| Classification response | 10.0 s maximum |
| ITI | 0.5 s |
e. Triggers
| Event | Code |
|---|
experiment_start / experiment_end | 1 / 99 |
training_block_start / training_block_end | 10 / 19 |
training_string | 20 |
recall_entry / recall_key / recall_timeout / recall_retry | 21 / 22 / 23 / 24 |
delay_start / delay_end | 30 / 31 |
test_block_start / test_block_end | 40 / 49 |
test_grammatical / test_nongrammatical | 50 / 51 |
classify_conforms / classify_violates / classification_timeout | 60 / 61 / 62 |
iti | 70 |
4. Methods (for academic publication)
Participants completed a computerized behavioral artificial grammar learning task based on the classic Reber paradigm (Knowlton & Squire, 1994, 1996). During incidental acquisition, each of 16 unique letter strings generated by a finite-state grammar over P, T, S, X, and V was displayed centrally for 3 s. Participants immediately reproduced the string using the keyboard. Incorrectly reproduced strings could be presented up to three times, and the complete 16-item set was administered twice in independently randomized orders. Participants were not informed of the grammar during this phase, and no grammatical-rule feedback was provided.
After a 300-s fixation interval, participants were told that all acquisition strings followed a complex rule system. They were instructed to rely on intuition rather than explicitly derive the rules and classified 32 novel strings using a two-alternative forced choice (F = conforms, J = does not conform). Half of the test strings were grammatical and half were paired strings containing exactly one substituted character that caused a finite-state violation. Positive training and test pools were disjoint, test order was randomized, the response deadline was 10 s, and no trial-level feedback was shown.
The concrete stimulus pools and their grammatical status were validated against an explicit Reber finite-state transition table before runtime. Custom scheduling was limited to preserving fixed item identities, disjoint pools, two complete training passes, and a balanced test; it did not adapt to participant behavior. Trial-level data included stimulus identity, grammaticality, paired source and violation position, reproduction response/attempts, classification response and RT, and correctness. The principal dependent measures were grammaticality classification accuracy, grammatical hit rate, nongrammatical correct-rejection rate, and mean classification response time.