Files
AILang/experiments/2026-05-12-cross-model-authoring/qwen-yaml.md
T
Brummel 525112e32e experiment(cma): bracket-free formats tested — they make Qwen WORSE, not better (refs #68)
Tested the user's bracket-free ideas (indent, YAML) against the annotated-paren
result. Hypothesis was that removing the closing token removes the repetition
tail. The opposite held.

Instrument note (the watch-out paid off twice): a real YAML library auto-quotes
and gives *,-,true special meaning, which collides with the AILang operators —
Qwen wrote `- *` (multiply), a YAML alias marker, and the library crashed. That
is a measurement bug, not a model failure. Rebuilt with a hand-written literal
indent parser (atoms verbatim, no quoting); `- *` then round-trips fine.

With the instrument fixed, the result is monotone across four formats:
  format 4 annotated parens 7/8 > plain Form-A parens 6/8 > yamlish indent 3/8
  > YAML library 2/8.
More explicit structure marking helps this model; less hurts. Qwen's weakness
is structure-tracking at depth, and indentation makes it track the nesting
itself — as error-prone as matching parens but without the redundant cue. The
bracket-free surfaces fail EARLIER (L3/L4), before the L7 repetition ceiling is
even reached.

Lever for an LLM-authored language: redundant explicit structure (depth-
annotated brackets), not a lighter surface. Synthesis in format-findings.md;
raw ladders qwen-yaml.md (PyYAML, discarded) and qwen-yamlish.md (own parser).
2026-06-02 18:49:35 +02:00

8.9 KiB

Qwen format probe — YAML surface

Model: Qwen/Qwen3-Coder-Next; single-shot; YAML dialect; converted via verified PyYAML round-trip.


L0_const — green

tokens: prompt=649 completion=58

model YAML:

module:
- m
- fn:
  - answer
  - type:
    - fn-type:
      - params: []
      - ret:
        - own:
          - con:
            - Int
  - params: []
  - body:
    - '42'

converted Form-A:

(module m (fn answer (type (fn-type (params) (ret (own (con Int))))) (params) (body 42)))

L1_arith — yaml-convert

tokens: prompt=651 completion=87

model YAML:

module:
- demo_m
- fn:
  - triple
  - type:
    - fn-type:
      - params:
        - own:
          - con:
            - Int
      - ret:
        - own:
          - con:
            - Int
  - params:
    - x
  - body:
    - app:
      - app:
        - *
      - x
      - '3'

yaml-convert:

converter rejected model YAML: while scanning an alias
  in "<unicode string>", line 20, column 11:
            - *
              ^
expected alphabetic or numeric character, but found '\n'
  in "<unicode string>", line 20, column 12:
            - *
               ^

L2_print — yaml-convert

tokens: prompt=646 completion=94

model YAML:

module:
- demo_c
- fn:
  - m
  - type:
    - fn-type:
      - params: []
      - ret:
        - own:
          - con:
            - Unit
      - effects:
        - IO
  - params: []
  - body:
    - seq:
      - app:
        - print
        - '7
      - do:
        - io/print_str
        - '"\n"'

yaml-convert:

converter rejected model YAML: while parsing a block mapping
  in "<unicode string>", line 17, column 9:
          - app:
            ^
expected <block end>, but found '<scalar>'
  in "<unicode string>", line 22, column 12:
            - '"\n"'
               ^

L3_adt — green

tokens: prompt=665 completion=136

model YAML:

module:
- demo_m
- data:
  - Light
  - ctor:
    - Red
  - ctor:
    - Green
- fn:
  - code
  - type:
    - fn-type:
      - params:
        - own:
          - con:
            - Light
      - ret:
        - own:
          - con:
            - Int
  - params:
    - l
  - body:
    - match:
      - l
      - case:
        - pat-ctor:
          - Red
        - '0'
      - case:
        - pat-ctor:
          - Green
        - '1'

converted Form-A:

(module demo_m (data Light (ctor Red) (ctor Green)) (fn code (type (fn-type (params (own (con Light))) (ret (own (con Int))))) (params l) (body (match l (case (pat-ctor Red) 0) (case (pat-ctor Green) 1)))))

L4_rec — yaml-convert

tokens: prompt=677 completion=359

model YAML:

module:
- demo_m
- data:
  - IntList
  - ctor:
    - Nil
  - ctor:
    - Cons
  - con:
    - Int
  - con:
    - IntList
- fn:
  - length
  - type:
    - fn-type:
      - params:
        - own:
          - con:
            - IntList
      - ret:
        - own:
          - con:
            - Int
  - params:
    - xs
  - body:
    - match:
      - xs
      - case:
        - pat-ctor:
          - Nil
        - '0'
      - case:
        - pat-ctor:
          - Cons
          - h
          - t
        - app:
          - +
          - '1'
          - app:
            - length
            - t
- fn:
  - main
  - type:
    - fn-type:
      - params: []
      - ret:
        - own:
          - con:
            - Unit
      - effects:
        - IO
  - params: []
  - body:
    - let:
      - xs
      - term-ctor:
        - IntList
        - Cons
        - '1'
        - term-ctor:
          - IntList
        - Cons
        - '2'
        - term-ctor:
          - IntList
        - Cons
        - '3'
        - term-ctor:
          - IntList
        - Nil
      - seq:
        - app:
          - print
          - app:
            - length
            - xs
      - do:
        - io/print_str
        - '"\n"

yaml-convert:

converter rejected model YAML: while scanning a quoted scalar
  in "<unicode string>", line 83, column 11:
            - '"\n"
              ^
found unexpected end of stream
  in "<unicode string>", line 83, column 16:
            - '"\n"
                   ^

L5_series_len — check

tokens: prompt=945 completion=215

model YAML:

module:
- demo_m
- fn:
  - main
  - type:
    - fn-type:
      - params: []
      - ret:
        - own:
          - con:
            - Unit
      - effects:
        - IO
  - params: []
  - body:
    - let:
      - s
      - new:
        - Series
        - con:
          - Float
        - '3'
    - let:
      - s
      - app:
        - Series.push
        - s
        - '1.0'
    - let:
      - s
      - app:
        - Series.push
        - s
        - '2.0'
    - let:
      - s
      - app:
        - Series.push
        - s
        - '3.0'
    - seq:
      - app:
        - print
      - app:
        - Series.len
      - s
    - do:
      - io/print_str
      - '"\n"'

converted Form-A:

(module demo_m (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params) (body (let s (new Series (con Float) 3)) (let s (app Series.push s 1.0)) (let s (app Series.push s 2.0)) (let s (app Series.push s 3.0)) (seq (app print) (app Series.len) s) (do io/print_str "\n"))))

check:

error: [surface-parse-error] parse error: expected term, got `)` at byte 134

L6_series_at — check

tokens: prompt=953 completion=226

model YAML:

module:
- demo_m
- fn:
  - main
  - type:
    - fn-type:
      - params: []
      - ret:
        - own:
          - con:
            - Unit
      - effects:
        - IO
  - params: []
  - body:
    - let:
      - s
      - new:
        - Series
        - con:
          - Float
        - '3'
    - let:
      - s1
      - app:
        - Series.push
        - s
        - '1.0'
    - let:
      - s2
      - app:
        - Series.push
        - s1
        - '2.0'
    - let:
      - s3
      - app:
        - Series.push
        - s2
        - '3.0'
    - seq:
      - app:
        - print
      - app:
        - Series.at
      - s3
      - '0'
    - do:
      - io/print_str
      - '"\n"'

converted Form-A:

(module demo_m (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params) (body (let s (new Series (con Float) 3)) (let s1 (app Series.push s 1.0)) (let s2 (app Series.push s1 2.0)) (let s3 (app Series.push s2 3.0)) (seq (app print) (app Series.at) s3 0) (do io/print_str "\n"))))

check:

error: [surface-parse-error] parse error: expected term, got `)` at byte 134

L7_sma — check

tokens: prompt=1036 completion=469

model YAML:

module:
- demo_m
- fn:
  - main
  - type:
    - fn-type:
      - params: []
      - ret:
        - own:
          - con:
            - Unit
      - effects:
        - IO
  - params: []
  - body:
    - let:
      - s
      - new:
        - Series
        - con:
          - Float
        - '3'
    - let:
      - s
      - app:
        - Series.push
        - s
        - '1.0'
    - let:
      - s
      - app:
        - Series.push
        - s
        - '5.0'
    - seq:
      - app:
        - print
      - app:
        - /
      - app:
        - Series.sum
      - s
      - '3.0'
    - let:
      - s
      - app:
        - Series.push
      - s
      - '3.0'
    - seq:
      - app:
        - print
      - app:
        - /
      - app:
        - Series.sum
      - s
      - '3.0'
    - let:
      - s
      - app:
        - Series.push
      - s
      - '8.0'
    - seq:
      - app:
        - print
      - app:
        - /
      - app:
        - Series.sum
      - s
      - '3.0'
    - let:
      - s
      - app:
        - Series.push
      - s
      - '6.0'
    - seq:
      - app:
        - print
      - app:
        - /
      - app:
        - Series.sum
      - s
      - '3.0'
    - let:
      - s
      - app:
        - Series.push
      - s
      - '2.0'
    - seq:
      - app:
        - print
      - app:
        - /
      - app:
        - Series.sum
      - s
      - '3.0'
    - do:
      - io/print_str
      - '"\n"'

converted Form-A:

(module demo_m (fn main (type (fn-type (params) (ret (own (con Unit))) (effects IO))) (params) (body (let s (new Series (con Float) 3)) (let s (app Series.push s 1.0)) (let s (app Series.push s 5.0)) (seq (app print) (app /) (app Series.sum) s 3.0) (let s (app Series.push) s 3.0) (seq (app print) (app /) (app Series.sum) s 3.0) (let s (app Series.push) s 8.0) (seq (app print) (app /) (app Series.sum) s 3.0) (let s (app Series.push) s 6.0) (seq (app print) (app /) (app Series.sum) s 3.0) (let s (app Series.push) s 2.0) (seq (app print) (app /) (app Series.sum) s 3.0) (do io/print_str "\n"))))

check:

error: [surface-parse-error] parse error: expected term, got `)` at byte 134

Ladder

  • L0_const: green
  • L1_arith: yaml-convert
  • L2_print: yaml-convert
  • L3_adt: green
  • L4_rec: yaml-convert
  • L5_series_len: check
  • L6_series_at: check
  • L7_sma: check