DEV Community

Cover image for RuleFit: an open model rewrites messy product titles, and plain code decides if they pass
Encrypted
Encrypted

Posted on Fully Autonomous

RuleFit: an open model rewrites messy product titles, and plain code decides if they pass

Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle Submission 💸

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 2: Side Hustle

What I Built

RuleFit cleans up messy product titles so they follow a store platform's rules. You upload a CSV, pick the title column, and download a CSV with a rewritten title, a status (PASS, FIXED or FLAGGED) and the reasons for any failure.

The first rule pack is Google Shopping titles. Google's title docs set a 150 character limit and say products can be disapproved for things like promotional text or all-caps titles. A store with hundreds of messy titles would otherwise fix them by hand.

The open model rewrites each title. Then plain Python checks the rewrite: max 150 characters, one line, no promotional phrases, no ALL-CAPS words unless they were in the original, not mostly capitals, no emoji, symbols or HTML, and no new numbers or sizes. A failing row gets one retry with the exact reasons. If it still fails, it is flagged and your original is kept. The model never decides what passes. The code does.

Who would pay? I think small store owners, or freelancers who clean product feeds for them. That is a guess. I have not found a paying customer, and I did not check whether people already sell this on freelance sites. Bigger feed tools like Feedonomics exist, and I did not compare prices.

Demo

There is no live link. I tried Render's free tier and the service kept restarting (details below). This screenshots is from RuleFit running on my laptop with the real model. The header shows Engine: Tinker / Qwen/Qwen3-8B.

RuleFit results page: 3 titles rewritten by Qwen3-8B, all PASS

Real output:

  • NIKE AIR ZOOM PEGASUS 40 RUNNING SHOES MENS SIZE 10 FREE SHIPPING!!! became Nike Air Zoom Pegasus 40 Running Shoes Men's Size 10 (PASS)
  • Cotton Bath Towels 6 Pack Soft Absorbent Quick Dry 50% off Today Only became Cotton Bath Towels 6 Pack Soft Absorbent Quick Dry (PASS)
  • Blue Denim Shirt Size M Slim Fit Long Sleeve stayed the same (PASS)

All three passed on the first try, so the retry and FLAGGED paths did not run in this test.

Code

RuleFit

RuleFit rewrites e-commerce product titles to adhere to catalog rules using a dual-engine architecture: an open language model hosted by Tinker generates candidate rewrites, and deterministic Python validators enforce the rules.

How It Works

  1. Model Draft: The model drafts an initial rewrite of each title.
  2. Deterministic Check: Plain code checks the draft against catalog rules.
  3. One Retry Loop: If any rule check fails, the model is invoked once more with the specific failure reasons.
  4. Safety Fallback: Rows that still fail after retry are marked as FLAGGED, and your original title is kept.

Rules (packs/google_shopping_titles.json)

  • max_chars: Maximum 150 characters.
  • not_empty_single_line: Title must be a single non-empty line.
  • banned_phrases: No promotional phrases ("free shipping", "sale", "best price", "buy now", "limited time", "discount", "cheap", "% off", "today only", "limited offer", "clearance", "hot deal").
  • no_caps_words: No ALL-CAPS words (4+ letters) unless already present in the original…

MIT licensed, with 67 automated tests. The tests use a stub in place of the model, so they never call it.

How I Built It

  • Model: Qwen/Qwen3-8B through Tinker's sampling client (inference only). Thinking is turned off with the qwen3_disable_thinking renderer.
  • Rule packs: each platform is one JSON file, so a new niche means a new file.
  • App: Flask. Each upload runs as a background job that the page polls. Results live in memory and expire after 15 minutes.
  • Design: Google Stitch. Code: Antigravity (Gemini).
  • AI disclosure: Claude helped me plan the project, wrote the prompts I gave Antigravity, and drafted this post. Antigravity wrote the code. I ran the app, checked its outputs and reports, and fixed what they showed.

What went wrong

  • Antigravity first passed enable_thinking=False to SamplingParams. The SDK shows only one generic data field there, and Tinker picks thinking through the renderer. I found it by inspecting the SDK before trusting the report.
  • Two threads importing tinker at once caused a circular-import crash. Top-level imports fixed it.
  • My rules had a loophole: an unchanged ALL-CAPS title would pass, because caps words were allowed if they appeared in the original. I added a "mostly caps" rule.
  • Stitch invented a "zero data retention guarantee" badge, an account icon and other fake features. I removed them and added tests that fail if those words come back.
  • Twice, Antigravity gave me two different versions of the same test run in one report. After that I only trusted output I could check.
  • My first API key never saved because I closed the editor without pressing Ctrl+S.
  • On Render's free tier (512 MB) the service restarted about every two minutes, starting shortly after the model warm-up. I suspect memory, but I did not confirm it in Render's metrics, so I can't say that is the cause.

What I did not do

  • I have no paying customer and no first user.
  • I did not compare against a closed model.
  • The rules check form, not meaning. In a test with a fake mock engine, a title cut off mid-word still passed.
  • I only tested English product titles.
  • RuleFit does not certify anything for Google. The page says "passes RuleFit checks" and nothing stronger.

Why Does Open Innovation Matter?

Because the rules live in code, I don't need the smartest model. I need a cheap one I can call twice on a bad row. An open 8B model fits that. The model name is a single setting, though a different model family would also need its own renderer, so swapping is not completely free. Later I could fine-tune on rows that failed the rules, but I have not done that.

I did not benchmark a closed API, so I can't say it would do worse. One honest limit: rows go to Tinker, so nothing stays on the user's machine. Open weights would let a store run the same model locally, but I have not built or tested that.

My Agent Session

I did not save a DevRelay session. Antigravity (Gemini) wrote the code from prompts I wrote with Claude's help, and I checked each of its reports against raw test output before moving on.

My First User

I don't have a first user. Nobody but me has run RuleFit, and nobody has paid for it.

Prize Categories

Tinker, for the inference behind Qwen/Qwen3-8B.

Top comments (0)