Skip to content

How it's builtGenerative AI

Copy Writer

Product descriptions, social posts and replies to customers, drafted in your browser by a small open language model from the facts you give it. Every draft's numbers, prices and common claims are checked against those facts, so you know what to look at before you publish.

The problem

Shops and small brands write the same kinds of copy every day: a description for each new product, a post for each offer, a reply to each customer who writes in. It takes time, the voice drifts from one person to the next, and the costly mistakes are small ones: a wrong price, a warranty nobody offers, a delivery date the courier cannot keep.

A language model drafts in seconds and in a steady voice. The risk is that it fills gaps with plausible inventions, so the useful product is a writer and a checker together.

The data

Three sample brands I made up: Kalimann Studio's clay water bottle, Thari Weaves's handloom cotton saree and Sooriya Solar's solar lantern. Each has the facts a shop would have to hand: the product's name, material, size, price in rupees, three to five features and who it is for; a post to write, such as an offer or a launch; and a customer's email with the decision the reply must give.

Every field can be edited, and nothing else reaches the model: no product database, no web search, no earlier conversation.

The model

SmolLM2 360M Instruct, a small open language model that runs in the browser (about 275 to 390 MB depending on the device, shared with my other writing demos). Each request carries the brand's voice and rules, one short worked example about a product none of the samples sells, and the brief's facts as a list.

I tried several prompts on it before settling. A 360-million-parameter model keeps to the facts best when the job is narrow ("turn these facts into one paragraph"), the facts arrive as a list, and the rule names what not to add: no extra uses, places, numbers or promises. A reply gets the points it must make as a list too, so the model can work through them.

Each variant is sampled at a temperature of 0.6, so three variants differ in wording and emphasis; 0.7 wandered further from the facts in my tests, and much lower made the variants near copies. The quick rewrites (shorter, warmer, more formal) send the draft back with the change asked for, under the same rules.

The fact check is plain code, not a model, and it checks a set list of details. It finds every number with its unit and every price; common claims a shop must be able to stand behind, such as warranties, guarantees, free delivery, waterproof or dishwasher-safe; where the product is made or comes from; materials such as steel, plastic or cotton; and time words such as overnight, all day or 24/7. It flags each one the facts do not give: "Possible invented detail: '2-year warranty'". A number must match in value and unit, so "1 litre" does not excuse "1-year"; in a reply, the customer's own numbers may be quoted but cannot back a claim. A claim must also be made the same way: "no free delivery" in the facts does not back "free delivery" in the copy, and facts that say it both ways back neither. Replies are also checked for the name in the greeting and the sign-off, and posts against each platform's limit: 2,200 characters on Instagram, 3,000 characters on LinkedIn and 280 characters on X, counted on X the way X counts them.

What it does not check is tone or meaning. A sentence can use only words from the facts and still say something they do not, so when the check finds nothing to flag, it says how many details it looked at and asks you to read the copy before you publish it.

The pipeline

  1. 01
    Brief

    A sample, or your own: the product's facts, the post's subject, or the customer's email and your decision.

  2. 02
    Prompt

    The brand's voice and rules, a worked example, and the facts as a list.

  3. 03
    Write

    SmolLM2 writes up to three variants in turn, streamed word by word, in your browser.

  4. 04
    Tidy

    Preambles, labels, quotation marks and unwanted hashtags are removed.

  5. 05
    Check

    Numbers, prices, common claims, places, materials and times are compared with the facts; posts with the platform's limit; replies with the greeting and sign-off.

  6. 06
    Polish

    Rewrite shorter, warmer or more formal, edit by hand, then copy.

Results

Variants written
18
three samples, three kinds of copy
With a possible invented detail
8 of 18
12 details flagged in all
Replies with a greeting or sign-off problem
5 of 6
wrong name, or a changed sign-off
Far shorter than asked
1 of 18
posts over the limit: 0 of 6

Measured by tools/copy-writer/sample-runs.ts, which has the model write with this demo's prompts (friendly, medium length) and runs this demo's checks on every variant. The model samples, so each run differs a little. Flags in this run included “overnight”, “two weeks”, “15%”, “80%”: each is a possibility to look at, not proof of a mistake, which is why the copy stays editable.

For a client

For a client I would load the facts from their catalogue or spreadsheet, write their real brand voice into the rules with a handful of approved examples, and use a larger model, hosted or on their own hardware, for copy that needs little editing.

The check grows with the business: their own list of claims they can make (certifications, guarantees they do offer), their units and pricing rules, and a review step so nothing reaches a customer unread.

Stack

PartWhat it does hereLicence
SmolLM2 360M InstructWrites the copy, on your graphics chip (WebGPU) or processorApache 2.0
transformers.jsRuns the model in a Web Worker and streams its wordsApache 2.0
My prompt and checking codeThe prompts, the rewrites, the tidying and the fact check, in TypeScript with unit testsMine
PreactThe interactive demoMIT
AstroThe page, built as static HTMLMIT

Privacy

Everything runs in your browser: the brief, the copy and the checks. Nothing you type is sent anywhere.

The model downloads once from Hugging Face's public host, about 275 to 390 MB depending on the device, and then stays in your browser's cache.

Limits

  • SmolLM2 has 360 million parameters, small enough for a browser tab. Its copy is a draft: it repeats itself, drops a fact or adds a flourish, which is why there are three variants, quick rewrites and an edit box.
  • The check looks for numbers, prices, common claims, places, materials and times, and nothing else. It cannot tell that "perfect for hot showers" is nonsense, or that a reply has invented a returns policy in its own words, so read every draft before it goes out.
  • A negative word just before a claim (no, not, never, without) turns it round. That is a rule of thumb, not an understanding of the sentence, so an unusual wording can be read the wrong way.
  • Posts for X are counted the way X counts them: an emoji, a Chinese, Japanese or Korean character and some symbols, such as the rupee sign, count as two, and every link as 23. Instagram and LinkedIn posts are counted as a reader sees the characters, so a post near their limit may count a little differently there.
  • The rules ask for British English and prices in rupees. Other languages would need their own rules and examples.