Representation learning

Separate Input Cleaning from Catalogue Truncation

Use one data foundation to distinguish adding activity evidence, removing controlled template noise and discarding context. The interventions produce different errors.

Banking & PaymentsIndependent technical study

Source case: Square. The article separates the published design from the data, methods and observations in this local experiment.

A complete catalogue can reinforce the wrong activity

A payments analyst groups merchants for portfolio reporting. A business name suggests one activity; a catalogue contains something else. Some entries describe actual offerings, while others are unchanged starter content generated from an onboarding choice. Simply adding the whole catalogue can make the original mistake appear independently confirmed.

Square’s March 2025 account identifies the starting problem:

“merchant self-selection is highly susceptible to miscategorization”

It describes reviewed labels, post-onboarding information and a RoBERTa classifier. Preprocessing removes unchanged auto-created entries and ranks retained items by purchase frequency. Original engineering article

The useful experiment is therefore not simply names versus names-plus-catalogue. It should separate additional information, source cleaning and input-budget choices so their effects remain distinguishable.

Read the workflow as a division of responsibility

Square’s published workflow separates business context, feature development, reviewed labels, training and evaluation, followed by monitoring and manual intervention.Open full-size diagram (opens in a new tab)

Square’s original workflow. Input construction and the target label require different evidence and review.

Source: Square Engineering · 10 March 2025

The separate feature and label branches are consequential. Removing a misleading starter service cannot repair a target copied from the same unreliable onboarding choice. Likewise, an improved target cannot recover a relevant activity excluded from the input.

My proposed review process would first define what activity is being classified, which evidence supports it and how mixed businesses are handled. Reviewers could inspect descriptions without the existing category to reduce anchoring. An operational override would record whether it corrects a prediction, expresses a policy exception or compensates for missing information before entering a later training set.

The new experiment uses a narrower version of that separation. I authored training labels and summaries. A separate model agent reviewed name-masked diagnostic descriptions before predictions, without seeing model outputs. Its reference file is frozen with the reviewed-text and taxonomy hashes. This is second-model-agent development review, with no human industry annotation or independent population estimate.

Make the contaminating evidence explicit

The corpus contains selected public facts about twenty-four companies: sixteen training entities and eight different diagnostic entities. Four additional diagnostics isolate negation, mixed activities and missing information. Each public observation has an official source URL and observation date. The short descriptions are my paraphrases, not company catalogue telemetry or complete legal-entity profiles.

For example, the Landor observation summarises brand strategy and visual, verbal, sonic and motion expression from its official site. Its experimental record also contains this separate input:

Input componentOrigin and role
Brand-strategy and expression observationsSelected public facts, paraphrased by the author
Printed shirts and business cardsControlled starter-template overlay; not a Landor offering claim
Frequency 1,000 on that overlayAuthored ordering metadata; not observed sales or word weighting

The raw arm retains that overlay. The clean arm removes only entries marked auto-created and unedited. Other entries retain the same text and ordering. The Landor prediction changes from C2 to C1, agreeing with the review reference after cleaning. This illustrates the intervention; it does not prove that the exact source of a model error has been causally identified.

Actual projection: filtering and top-one truncation are separate branchesPython5 lines
def selected_items(row, arm):
    items = sorted(row["catalog"], key=lambda item: (-item["frequency"], item["id"]))
    if arm in ("clean", "truncated"):
        items = [item for item in items if not item["auto_created"] or item["edited"]]
    return items[:1] if arm == "truncated" else items

Frequency controls which clean entry survives top-one selection. It does not duplicate or weight words. Raw and clean naive Bayes inputs are bags of words, so their ordering alone cannot change a prediction. This tests retaining different content under an authored policy, not the value of real purchase-frequency data.

Origin and edit flags are supplied fields, not model discoveries. One diagnostic also contains an explicit author scope clarification, which is marked separately from public facts. These curation choices matter: a real deployment would need evidence that its metadata reliably distinguishes starter content from genuine activity.

Change one input condition at a time

All four arms use multinomial naive Bayes, the same sixteen training entities, training labels and Laplace smoothing. Each representation is fitted separately because its vocabulary changes. This is a representation-pipeline ablation across training and diagnosis, not a frozen model receiving different inference inputs.

ArmInput changeLeaf agreementParent agreement
NameCompany name alone2 / 84 / 8
RawAdd all catalogue entries5 / 86 / 8
CleanRemove only unchanged starter entries6 / 87 / 8
TruncatedKeep only the first clean entry by authored frequency2 / 84 / 8
Observed leaf agreement on eight determinate development references: name two, raw five, clean six and truncated two. Four review references are reported separately.Open full-size figure (opens in a new tab)
Actual CPU results. The bars compare representation policies on the same small diagnostic set, not population accuracy or Square’s model performance.

The raw-to-clean contrast isolates the removal policy. The clean-to-truncated contrast isolates retaining less information. The total lexical word-token count across twelve clean diagnostics falls from 267 to 96 after truncation. Those are this tokenizer’s counts, not encoder tokens or API charges. Every clean record has three entries, so the truncation actually discards two entries rather than merely claiming a token-budget intervention.

For FreeAgent, keeping only the opening statement about entering statements, invoices and expenses loses the subsequent application behaviour. The prediction changes from accounting software to managed accounting. Frequency is a proxy for relevance, and this deliberately tight budget removes the distinction the task needs.

More context helps here without establishing semantic robustness

The model distinguishes eight teaching leaves in four parent families: food, personal care, business support and creative work. A parent-level match preserves useful diagnostic information without making a wrong leaf correct. These labels describe the supplied activity; they are not MCCs or NAICS assignments.

Cleaning is not a monotone accuracy operation. The negation diagnostic denies performing bookkeeping and instead describes browser tools customers use themselves. The clean bag-of-words model still assigns managed accounting. Its raw counterpart happens to select software. Vocabulary and likelihood changes can move a small fitted model in either direction; a correct raw label does not validate its contaminating template.

All four CPU arms also force a category on all four review references. There is no validated uncertainty threshold. One real-company observation mentions custom production and fulfillment but omits printing-specific evidence; the reviewer therefore retained REVIEW. The test does not silently convert public brand familiarity into missing activity evidence.

The next modelling comparison should add a stronger linear text baseline before an encoder. Negation, paraphrases and relationships between services are reasons an encoder might help; the current evidence does not establish that it would. Two training entities per leaf and author-curated wording remain substantial limitations. Merchant-separated examples reduce direct entity reuse, while the selection and wording of the corpus still influence the outcome.

Inspect all input arms, source references and retained diagnostic errors

Recorded experiment

What the experiment actually shows

One controlled input condition changes at each step; the fitting algorithm, training entities, labels and smoothing stay fixed.

Data and comparison boundary

Methods compared

name
Company name only
raw
Name plus all catalogue entries
clean
Remove only unchanged auto-created entries
truncated
Keep only the highest-frequency clean entry

Recorded findings

name
2 / 8

Leaf agreement; parent agreement 4/8; 4 forced assignments on review references.

raw
5 / 8

Leaf agreement; parent agreement 6/8; 4 forced assignments on review references.

clean
6 / 8

Leaf agreement; parent agreement 7/8; 4 forced assignments on review references.

truncated
2 / 8

Leaf agreement; parent agreement 4/8; 4 forced assignments on review references.

Inspect a recorded example

D01 · Sweetgreen
Input

Sweetgreen | Offering: A browser application for invoicing.; Customers choose seasonal ingredients for a meal.; This location offers salads, warm bowls and wraps.; Guests can order food for pickup.

Baseline output

Name: B1 Raw: F1

Candidate output

Clean: F1 Truncated: C2 Truncated input: Sweetgreen | Offering: Customers choose seasonal ingredients for a meal.

These are saved results. Switching examples runs no model or external service.

Limits of this experiment

  • Paraphrases are author-curated observations, not complete company profiles or naturally sampled merchant logs.
  • The multinomial model has only two training entities per leaf. All four models force a class; no calibrated review threshold is claimed.
  • Controlled overlays let us isolate interventions but cannot estimate a real template-contamination rate.
Inspect the recorded provenance
{
  "calls_sha256": "28a8ec63cffb3fb0aa65b37ff0c2c59f5c49e148a7dda8adb4c339b026cdd584",
  "corpus_sha256": "acd2d0abbc8001114d56dd2de69535a01006df455666f17ea746fc8d234a4b26",
  "cpu_code_sha256": "e43da0368fb32d502c85c881d064c342cf685284c5bfc4e93b1e2e1c4d8fdf44",
  "evaluation_code_sha256": "b74376be594e4e39eae52f87c10637ec49fc3d45c982cc7a197a5cc447d2ed9a",
  "initial_infrastructure_trial": {
    "file": "calls.json",
    "http_requests": 36,
    "model": {
      "details": {
        "families": [
          "qwen3vl",
          "clip"
        ],
        "family": "qwen3vl",
        "format": "gguf",
        "parameter_size": "4.0B",
        "parent_model": "",
        "quantization_level": "Q4_K_M"
      },
      "digest": "8708ab6acc5eed95c57d3d4b68c08f85eb197840827c097c7d9ed49f2a030c6e",
      "model": "qwen3-vl:4b-instruct-q4_K_M",
      "modified_at": "2026-11-25T21:56:46.663784614+01:00",
      "name": "qwen3-vl:4b-instruct-q4_K_M",
      "size": 3337226771
    },
    "reason": "Runtime 0.17.7 runner failures; the separately recorded compatible trial also reports a different API model identity. Identical request bodies do not make this a controlled runtime-only comparison.",
    "runtime": {
      "version": "0.17.7"
    },
    "sha256": "6a3cade5caa2e40d3c881878ca0e08ef67062bf711f2716fc8038dbea9ebdaeb",
    "successful_generations": 0
  },
  "model": {
    "capabilities": [
      "completion",
      "vision",
      "tools"
    ],
    "details": {
      "context_length": 262144,
      "embedding_length": 2560,
      "families": [
        "qwen3vl",
        "clip"
      ],
      "family": "qwen3vl",
      "format": "gguf",
      "parameter_size": "4.0B",
      "parent_model": "dhiltgen/qwen3-vl:4b-instruct-q4_K_M-llamacpp",
      "quantization_level": "Q4_K_M",
      "runner": "llamacpp"
    },
    "digest": "84f7ed8042fa7cdbd902f7dcb7d0370e032095047cc3244179f263b77b5bc318",
    "model": "qwen3-vl:4b-instruct-q4_K_M",
    "modified_at": "2026-11-25T21:56:46.65935228+01:00",
    "name": "qwen3-vl:4b-instruct-q4_K_M",
    "size": 3337225651
  },
  "model_counts_sha256": "66dfd8df9a4ffd1560a1b6cac41b912f5573c38261c1b289fc069804353a3310",
  "recording_basis": {
    "blind-review.json": "cb7640961bf72159202cd0a0ce3ff7157f66d97cd5ba811fb539e062f434fcdf",
    "core.py": "e43da0368fb32d502c85c881d064c342cf685284c5bfc4e93b1e2e1c4d8fdf44",
    "corpus.json": "acd2d0abbc8001114d56dd2de69535a01006df455666f17ea746fc8d234a4b26",
    "reference.json": "2f2e816462abeb8b10d87c414a7e2433b22215c8c42295a6d1a5df6f11e184ab",
    "run_compatible_model.py": "26f6988e7fdf106aa92a544e90a3172f29348aba557caa59120f62786b26e070",
    "run_model.py": "3a91a34d5e3f3280e0ba5eccc8122bf0c756f8cfc47cd4712d1ea671b0b74f92",
    "taxonomy.json": "5971417e205c466d5de873f3616498cb5271e67ed3333c9d95e02568bf2e1737"
  },
  "reference_sha256": "2f2e816462abeb8b10d87c414a7e2433b22215c8c42295a6d1a5df6f11e184ab",
  "reviewer": "Second model agent, separate from the source/data author; not a human industry annotation or independent population test",
  "runtime": {
    "version": "0.40.18"
  },
  "selected_trial": "calls-compatible.json",
  "source_manifest_sha256": "81a769e36044ad32931d66c78a2a863846d5131082af485dbb0ad85d54015740",
  "taxonomy_sha256": "5971417e205c466d5de873f3616498cb5271e67ed3333c9d95e02568bf2e1737",
  "token_note": "API counters are retained literally, including cache counters. These are not invoices, a latency benchmark or a complete provider-cost comparison."
}
The same input wrapper is used for every representation-specific fitPython4 lines
def model_text(row, arm):
    if arm == "name":
        return row["name"]
    return row["name"] + " | Offering: " + "; ".join(item["text"] for item in selected_items(row, arm))

A reusable prediction needs more than an unchanged merchant name

Square describes daily predictions and reusing earlier predictions for unchanged inputs. Source: inference section

My proposed cached assignment would bind canonical input, preprocessing version, model/tokenizer version and taxonomy policy. A new category policy may require inference even when the seller changed nothing. Conversely, an unrelated profile field should not automatically trigger expensive work.

Keep historical predictions separate from current accepted assignments. A reviewed override should retain its reason and applicability; a new model should not silently erase it. Those are operational design requirements, not implemented services in this CPU study.

Keep the evidence policy, then decide whether a model earns deployment

For a merchant-data workflow, the present decision is to retain full cleaned activity context for further work and reject this aggressive top-one budget. The six-of-eight classifier is not ready to set eligibility, fees or externally governed payment codes. A segmentation label, its review policy and a payment-code decision are different contracts.

The Ramp companion uses the same diagnostic descriptions but tests definition retrieval and a name-masked selector. It asks a different question: can a model decide among candidate meanings or recognise that none is sufficiently supported? Treating these articles as two views of one data foundation makes their reuse visible rather than inflating the number of independent experiments.

Sources, earlier experiment and offline reproduction

The unchanged workflow figure credits Square’s article, published 10 March 2025, CSV row 47. Official company URLs and author-scope notes are in the new corpus and source manifest. Controlled templates and frequency fields remain explicitly authored.

The earlier 24-training/12-diagnostic fictional study and its recorded calls remain unchanged in engineering-lab/classification. The revision adds engineering-lab/merchant-study; it does not replace those artifacts. In the new standalone directory, run python3 run.py, python3 verify_recording.py and python3 smoke.py. Reproduction refits CPU baselines and rechecks saved responses without model calls.