SEZ9 opened a new issue, #13417:
URL: https://github.com/apache/seatunnel/issues/13417

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue+label%3A%22Improve%22)
 and found no similar issues.
   
   ### What would you like to be improved?
   
   The LLM validator can veto a config that the deterministic checks already 
accepted, and a veto triggers a whole-config rewrite.
   
   `seatunnel_cli/agents.py`:
   
   ```python
   def _run_validator(self, config: str) -> str:
       # First do local validation
       local_result = validate_hocon(config)
       ...
       prompt = f"""Validate this SeaTunnel HOCON config:
       ...
       Local validation result: {local_result}
       ...
       result = self.client.quick_chat(prompt, system=VALIDATOR_SYSTEM)
       return result.strip()                      # only the LLM verdict is 
returned
   ```
   
   `validate_hocon()` runs, but its outcome is only interpolated into the 
prompt as text — the function returns the model's verdict. A `FAIL` then sends 
the config into `_run_fix()`, which is asked to rewrite the whole thing:
   
   ```
   Fix ALL the issues and return the corrected config.
   ```
   
   Three things follow:
   
   1. A config that passes the local structural check and the engine check can 
still be rewritten because the model disliked it. During data collection for 
the CLI we saw a large number of cases where the LLM validator returned `FAIL` 
and the engine then ran the same config successfully.
   2. There is no stop condition when a repair round changes nothing. If the 
model returns an equivalent config, the loop spends another round on it.
   3. Rewriting the whole config to address one complaint is how filters, field 
mappings and routing labels get lost between rounds.
   
   Measured on a fixed 100-task benchmark against this code: **283 internal fix 
rounds, with 95 of 100 tasks triggering at least one**. Three trivial smoke 
tasks (FakeSource→Console and similar) each triggered the maximum of 3 fix 
rounds. That cost is latency and risk, not correctness, because the engine had 
already accepted most of those configs.
   
   ### How should we improve?
   
   Make the deterministic layers the source of truth and narrow the model's 
role:
   
   - L1 (`validate_hocon`), L2 (engine `--check`) and L3 (execution) decide 
whether a config is valid.
   - The LLM validator reports only semantics the engine cannot judge — whether 
the config answers the request — and when L1 and L2 both pass it may emit 
warnings but not trigger a rewrite.
   - `_run_validator()` returns a structured result (status, failed 
constraints, evidence, whether it is repairable) instead of a free-text verdict 
that is matched with `startswith("PASS")`.
   - Compute a normalised hash of the config after each repair round and stop 
when it does not change.
   - Record per-role call counts, tokens and duration so this is measurable 
rather than anecdotal.
   
   Acceptance I would aim for: internal fix rounds on the fixed 100 tasks drop 
from 283 to under 100, median per task ≤1, and no task that passes today starts 
failing.
   
   ### Are you willing to submit a PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to