ELSEIF
Your brief EB
495 stories from 219 feeds 1271 clusters Refreshed 11 minutes ago next pull 09:49

AI Signal 142

Gemini trained GLiNER to label Reddit comments for $9

A fine-tuned GLiNER model now labels Reddit comments for knife brands, models and steels.

WHY IT MATTERS

This approach reduces the cost of named-entity recognition in text. It is not clear how this approach scales to other domains.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

Gemini labeled 4,290 Reddit comments for $9.

02

GLiNER was fine-tuned on those labels to achieve 0.83 F1 score.

03

The approach failed in five of ten runs, with three failing on configuration.

THE READ

What the cluster adds up to.

ORIGINAL ANALYSIS

The author trained a GLiNER model to label Reddit comments for knife brands, models and steels. The model was fine-tuned on labels that Gemini wrote once, for $9. The trained model achieved an F1 score of 0.83 against Gemini's labels. The training process took 24 minutes on a Tesla T4 GPU. The cost of the training was about $2.50 of GPU time, plus days of debugging. The approach failed in five of ten runs, with three failing on configuration. The other two failed on a tensor called words_mask that the author filled the way you fill an attention mask.

The author used Gemini to label the comments through OpenRouter at temperature 0 in 25 minutes. The prompt decision that mattered most was to never ask the model for character offsets. It counts characters badly and returns spans off by two or three positions. The prompt asks for the exact substring and a label, and TypeScript finds the offsets. If the string is not in the comment, the entity is dropped and logged. The model returns strings. Code computes the offsets.

The author used a regex to keep product names whole and emit every other non-space character as its own token. Spans that still miss a token boundary are dropped rather than guessed. About 30% of the training set is comments that contain a known false-positive trigger and no product, labeled as empty. Before the second run the author set aside 225 comments as a validation set and never touched them again. Training ran on a Tesla T4 on Modal with the HF Trainer.

The author encountered several issues during the training process. For five runs the model learned nothing. The first three failed on configuration, and anyone using the HF Trainer with GLiNER will hit them in an afternoon. The other two failed on a tensor called words_mask. The author had patched GLiNER's tokenize_inputs to handle broken Reddit emoji, and the patch has to fill a tensor called words_mask. It sits next to attention_mask, has the same shape, and every attention mask the author has ever built is ones for real tokens and zeros for padding. The author built it that way.

The author's approach reduces the cost of named-entity recognition in text. It is not clear how this approach scales to other domains. The author's experience shows that fine-tuning a model on labels written by another model can achieve good results, but it requires careful handling of the data and the training process. The author's experience also shows that the training process can fail for various reasons, and it requires careful debugging to fix the issues.

Written by elseif from the cluster below · checked for specifics the sources never contained

THE CLUSTER

Same story, 1 feed.

ORDERED BY FIRST SEEN
petervijeh.com via Hacker News I had Gemini train its own replacement for $9 Open ↗