`m decompose`: the docs example, the smaller-model advice and the generated script don't match what the CLI does

オープン
#1,863 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 3 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
18/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
markdown, ollama, python

調査の方向性

Start by running the reproduction block on a fresh checkout with Ollama up, then read docs/docs/how-to/m-decompose.md against cli/decompose/decompose.py (default model near line 203, --enable-script-run pass-through near line 456), pipeline.py:171/:596 and cli/decompose/m_decomp_result_v3.py.jinja2:26, where the model id is hardcoded. Run uv run pytest test/decompose test/cli/test_decompose_unit.py test/cli/test_decompose_input.py and the shell examples in docs/examples/m_decompose/ before touching anything. Done means the page's commands run verbatim with matching output, the template starts the session with the model/backend/endpoint actually passed, and the PR pastes transcripts plus per-model run counts for the model advice.

索引モデルが issue の本文から書いたものです。

説明

What users see

Someone following how-to/m-decompose.md hits a series of dead ends:

  1. The page's own example (task.txt followed by python output/m_decomp_result/m_decomp_result.py) points at a path that never gets created.
  2. The page says the default model is a small Granite model and suggests another small Granite model to avoid a big download. The real default is mistral-small3.2:latest (24B, 15 GB), and the small models we tried failed the pipeline.
  3. Even when a smaller model works, the generated script hardcodes mistral-small3.2:latest, so running it pulls the 15 GB model anyway.
  4. The OpenAI example fails immediately with an assertion error.

There is no single big bug here. The CLI, the template, the docs and the examples were each right at some point and have drifted apart. #1838 asks for the Granite version strings on this page to be updated, and #1862 does that, but those edits sit on top of claims that are wrong for other reasons. I'd like the page, the CLI and the examples fixed together.

Terms used below: a job is one task the CLI decomposes. --input-file makes one job per non-empty physical line, and each job gets its own output directory.

What happened

I ran everything on a checkout based on Mellea main (the cli/decompose code is identical to main), with Ollama on macOS. Each run is a single sample, so read the pass/fail results as indicative, not as rates. Measuring them properly is part of the work.

1. The multi-line example creates four jobs, not one.
docs/docs/how-to/m-decompose.md shows a task.txt that is one task wrapped over four lines. The CLI makes one job per non-empty line, so it decomposes four sentence fragments and writes m_decomp_result_1 to m_decomp_result_4. The documented m_decomp_result/ directory does not exist. This behaviour is old (v0.9.0 does the same). #1761, which is not in a release yet, added \n escapes inside a line, and it updated refactor-prompts-with-cli.md but not this page. A fix that uses \n therefore works on main but not on the 0.9.0 CLI.

Also, if a later job fails, the outputs of the earlier jobs are deleted (the docstring says so, but it surprises people). On granite4.1:8b, jobs 1 and 2 completed, job 3 failed to parse, and the output directory ended up empty.

The shell examples have the same problem, from reading the code (I did not run them). docs/examples/m_decompose/example.txt has three non-empty lines, so decompose_using_cli.sh writes three numbered directories, and decompose_intermediary_python_command.sh then runs python ./m_decomp_result.py, which won't exist.

2. Small models fail the pipeline.

  • granite4.1:3b, single-line task: failed after about 50 s (TagExtractionError).
  • granite4.2:3b: failed after about 6 min (TagExtractionError) in 3 of 3 CLI runs (two single-line, one with the 4-line task.txt). One call to the Python API with a shorter, different prompt did succeed.
  • granite4.1:8b, single-line task: completed, and the generated script ran end to end.

There is no documented minimum model, and the CLI doesn't warn when a small model is likely to fail.

3. The generated script ignores the model you passed.
cli/decompose/m_decomp_result_v3.py.jinja2:26 has mellea.start_session(model_id="mistral-small3.2:latest"). A script generated with --model-id granite4.1:8b still starts a Mistral session. The CLI help says --enable-script-run makes the script expose argparse overrides for backend, model, endpoint and API key. The option is passed through (decompose.py:456), but no template under cli/decompose/ refers to it, so I don't see how it can work. With the model edited by hand to the 8B, the script ran and exited 0 and produced a blog post.

4. The generated validators are brittle.
In that run, 3 of the script's sampling calls ended with Invoking select_from_failure after 2 failed attempts. One generated validator (validations/val_fn_1.py:13) checks line.startswith("Title:"), while the model wrote **Title:**. I did not look into the other failures.

5. The OpenAI example is incomplete.
--backend openai --model-id gpt-4o-mini fails with AssertionError: Required to provide "backend_endpoint". pipeline.py:219-224 requires both --backend-endpoint and --backend-api-key. The page shows neither.

6. The default model is wrong on the page.
On main, line 62 says m decompose defaults to granite4.1:3b (lines 28 and 89 also use it). #1862 changes those three lines to granite4.2:3b. The real default is mistral-small3.2:latest (decompose.py:203, pipeline.py:171 and :596), which the Ollama library lists at 15 GB. The same page's "~15 GB" note already contradicts the Granite default.

7. Smaller doc gaps.

  • The subtask field table omits general_instructions, which the API returns.
  • The output includes a validations/ directory that the page never mentions.
  • docs/examples/m_decompose/README.md and decompose_using_cli.sh suggest granite4:latest as an alternative to Mistral. I haven't tried it.

Not tested: I never ran the default mistral-small3.2:latest model, so I can't say whether the pipeline works reliably on it.

What we expected

Every command on the how-to page works as written, the example output matches the page, and the model advice is true. A user who passes --model-id X gets a script that uses X.

How to reproduce

Use a fresh output directory each time. The CLI creates it only after the LLM run and fails with FileExistsError if it already exists.

# The page's task: one task wrapped over four lines
printf '%s\n' \
  'Write a short blog post about the benefits of morning exercise.' \
  'Include a catchy title, an introduction paragraph, three main benefits' \
  'with explanations, and a conclusion that encourages readers to start' \
  'their morning exercise routine.' > task.txt

# A single-line version that does complete on a larger model
echo 'Write a short blog post about the benefits of morning exercise, with a title, an introduction, three benefits and a conclusion.' > task_single.txt

# 1. Look for "run pipeline job 1/4" in the output, and for output1/m_decomp_result/ afterwards
mkdir output1 && m decompose run --input-file task.txt --out-dir ./output1/ --model-id granite4.1:8b

# 2 and 3. Single line with a small model, then with the 8B; then check which model the script uses
mkdir output2 && m decompose run --input-file task_single.txt --out-dir ./output2/ --model-id granite4.1:3b
mkdir output3 && m decompose run --input-file task_single.txt --out-dir ./output3/ --model-id granite4.1:8b
grep -n start_session output3/*/*.py

# 5. Fails with the backend_endpoint assertion
mkdir output4 && m decompose run --input-file task_single.txt --out-dir ./output4/ --backend openai --model-id gpt-4o-mini

Success criteria

Whoever picks this up should paste the evidence for each point into the PR.

  1. Docs run verbatim. Every command and snippet on how-to/m-decompose.md is run exactly as written, and the output matches the page. Paste the transcript.
  2. The sample task works. The example is a task the CLI treats as one job (for example one line, or \n escapes if we ship that), and ls shows the directory names the page claims. The shell examples in docs/examples/m_decompose/ are fixed or removed, and run.
  3. Model advice is measured. The page recommends a model only if it completes the sample task reliably. Run it at least 10 times per model and report the model, the number of runs, the failures and the timings in the PR. Maintainers agree the bar when reviewing. If no small model passes, the page says so and states the smallest model that did.
  4. The script follows the CLI. A script generated with a non-default --model-id starts a session with that model (and the chosen backend and endpoint), and runs without any other model being pulled (ollama list before and after). --enable-script-run either works or is removed from the help text.
  5. Generated validators are checked. At least the Title: case is fixed, and a test or note explains why the other sampling calls failed.
  6. The OpenAI path works. The page shows --backend-endpoint and --backend-api-key, and the example is run against a real endpoint (Ollama's OpenAI-compatible /v1 endpoint is enough).
  7. The default model is documented correctly, and has been run end to end at least once.
  8. Tests and examples all run, before and after. Report pass/fail counts for:
    • uv run pytest test/decompose test/cli/test_decompose_unit.py test/cli/test_decompose_input.py
    • uv run pytest -m slow docs/examples/m_decompose (needs Ollama; the example is marked slow, so it is skipped by default)
    • both shell examples in docs/examples/m_decompose/, run by hand
    • uv run poe clidocs if any CLI help text changes
    • npx markdownlint-cli2 "docs/docs/**/*.md"
  9. Regression tests. Tests cover the chosen behaviour for multi-line input and for the script's model.

Decisions for maintainers before work starts

  • Default model. Is a 24B, 15 GB default right for a first run? Changing it means making the pipeline reliable on smaller models first.
  • Failed jobs. Should a failure in job N delete the finished output of jobs 1 to N-1, or keep it?
  • Released docs. The 0.9.0 snapshot has the same page errors. Do we fix version-0.9.0 too? If so, any \n fix won't work there, because the 0.9.0 CLI has no \n expansion.

Environment

Mellea main at the time of writing (2026-11-23), Python 3.12, macOS, Ollama running locally. Models: granite4.1:3b, granite4.2:3b, granite4.1:8b.

Related: #1838, #1862, #1761

主要言語
Python
スター
1.8k
フォーク
161
平均マージ
4日 3時間
マージ済み PR(30日)
45

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

generative-computing/mellea のほかの issue

generative-computing/mellea の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。