# A Practical Guide to Natural Language-Driven Data Cleaning

    Natural language programming (often called vibe coding) collapses the barrier to execution while widening the barrier to understanding. Using a real case—cleaning a mixed-source spreadsheet into a deduplicated list of valid emails in seconds instead of six hours—this article abstracts the phenomenon into a general engineering problem: how to establish a reliable working method when code is generated by a model and correctness is judged by a human. It covers why data cleaning fits this mode, how to express requirements through five structured elements, four layers of post-generation verification, three levels of review depth for code you cannot read, how to turn one-off scripts into maintainable assets, and governance recommendations around risk boundaries.

    1. The Wake-Up Call from a Real Scenario

    A business analyst receives a routine task: a spreadsheet sourced from mixed origins contains malformed emails, duplicate records, and null values. She needs to produce a clean version that keeps only valid, non-duplicate emails, along with a total count. Following the traditional path, she would filter rows manually, write formulas, and compare results repeatedly—estimated at about six hours.

    Instead, she describes the goal to an AI coding tool in entirely natural language. The tool returns a data-processing script. She copies it, runs it, and the task is done in tens of seconds. Her after-the-fact description is telling: the result is correct, but she has no idea what the script actually does.

    This is the first layer of impact brought by natural language programming (also commonly called vibe coding): the execution barrier is flattened, but the comprehension barrier is amplified. The efficiency gain is real, and so is the risk transfer. This article does not focus on any specific tool. Instead, it abstracts the phenomenon into a general engineering question: when code is generated by a model and judged for correctness by a human, how do you establish a reliable working method?

    2. Why This Kind of Task Is Especially Suited to Natural Language

    Data cleaning became one of the earliest landing scenarios for this mode because the task characteristics align closely:

    • Clear goals, objective acceptance criteria: rules for judging valid emails, the deduplication key, and the expected total are all quantifiable and verifiable.
    • Clear input/output boundaries: input is one spreadsheet file; output is another spreadsheet file plus a statistic.
    • Low cost of trial and error: scripts run locally or in a sandbox, read from copies, and can simply be rerun when wrong.
    • Business side owns the semantics, engineering side owns the implementation: the requester knows best what “dirty” means, and this is exactly where communication loss used to be greatest.

    Natural language reduces the cost of “describing intent” to near zero, so requirements that once needed to be scheduled can be completed immediately. But this also means the responsibility for quality control shifts upstream—from “compiler and tests” to “the person who asks and the person who reviews.”

    3. Stating the Requirement Clearly: Five Elements of Structured Expression

    A vague prompt only yields a vague result. A reusable expression framework contains five elements:

    1. Data shape: file format, encoding, delimiter, whether a header row exists, approximate row count magnitude.
    2. Definition of dirty data: what counts as “wrong format,” which rules apply, how edge cases are handled.
    3. Processing actions: cleaning, deduplication, sorting, aggregation, and the order in which actions execute.
    4. Output contract: artifact form, field list, statistical definitions, whether the total includes the header.
    5. Failure strategy: whether unparseable rows are discarded, isolated, or cause an error abort.

    Illustrative example (a descriptive sample, not a specific product interface):

    1. Input: a UTF-8-encoded CSV with a header row as the first line, about 50,000 rows.
    2. Rules: an email must conform to the basic structure "local-part@domain.tld", and the domain must contain at least one dot.
    3. Actions: first normalize (trim whitespace, unify to lowercase), then filter out invalid ones, and finally deduplicate by entire row.
    4. Output: a new CSV containing only valid, unique emails; also print the number of kept rows and the number of discarded rows.
    5. Exceptions: invalid rows are written to a separate file for manual review, not silently dropped.

    The closer the requirement description is to an “acceptance test case,” the higher the first-pass yield of the generated result.

    4. Four Layers of Verification You Must Do After Generation

    “It ran through” does not equal “it is correct.” Four checkpoints are recommended:

    • Rules layer: sample-check boundary cases, such as mixed casing, double @ signs, missing top-level domain, and overly long local parts.
    • Consistency layer: verify the conservation relationship of totals—input row count = kept rows + invalid rows + duplicate rows.
    • Idempotency layer: rerunning the same input should produce exactly the same output; this exposes hidden nondeterminism such as dependence on set iteration order.
    • Regression layer: keep this run’s input and output as a baseline, and rerun for comparison after the script is changed.

    A minimal self-check skeleton:

    1. assert total_in == kept + invalid + duplicated, "row count not conserved"
    2. assert len(kept) == len(set(kept)), "duplicates still present"
    3. assert rerun_output == first_output, "result is not idempotent"

    5. What to Do When You Can’t Read the Code: Three Levels of Review Depth

    You don’t need the business side to become senior engineers, but they do need the ability to do “risk-tiered review”:

    • Level 1, review behavior: what the script reads, what it writes, whether it accesses the network, whether it deletes the original file. Anything involving overwrite writes, recursive deletion, or external uploads must be confirmed line by line.
    • Level 2, review rules: translate the key decision conditions into natural language and check them one by one against your own business definition.
    • Level 3, review complexity: whether it remains acceptable when the data volume grows tenfold; whether there are whole-table nested traversals that cause time-complexity problems.

    If you cannot complete Level 2, ask the tool to supplement the explanation, or have the script additionally output a “discarded sample list,” verifying correctness with data rather than code.

    6. From One-Off Script to Maintainable Asset

    The biggest hidden risk of a one-off script is “only results, no process.” To let it settle into a team asset, four things need to be completed:

    1. Externalized parameters: input path, output path, and rule thresholds are passed in via configuration or command-line arguments, avoiding hardcoding.
    2. Logging and reporting: output a processing summary including row-count changes at each stage and the distribution of failure reasons.
    3. Test solidification: turn boundary samples into a small dataset with assertions, forming a repeatable verification suite.
    4. Scheduling and permissions: recurring tasks are handled by a container platform or task scheduling capability, raw data is placed in object storage, run logs go to a logging service, anomalies notify the responsible person via monitoring alerts, and the principle of least privilege is followed.

    In the general practice of cloud platforms such as Baidu AI Cloud, the capabilities above are typically provided by a combination of product categories such as object storage, container platform, logging service, and monitoring alerts; refer to the official documentation for specific configuration.

    7. Risk Boundaries and Governance Recommendations

    • Data security: desensitize sensitive data before handing it to the model; prefer a local or dedicated environment that does not upload raw data.
    • Compliance traceability: record the requirement description, generated script version, execution time, and operator, to facilitate audit and tracing.
    • Awareness of capability boundaries: models are good at generating common-pattern code, but may still make mistakes on obscure formats and complex business rules; key conclusions need manual confirmation.
    • Evolution of organizational division of labor: the business side defines “correct,” the technical side underwrites “secure” and “maintainable,” and the middle layer is bridged by a standardized review checklist.

    8. Conclusion

    What natural language programming truly changes is not writing code itself, but the distance between requirement and implementation. The value of compressing six hours into one minute only holds when results can be verified, processes can be traced, and scripts can be reused. Structuring the prompt, moving verification forward, and settling assets—that is the key path for this mode to move from “personal technique” to “team productivity.”