# Raising the Cost of Pasting Annotation Items into Chatbots

Source: https://www.potatoannotator.com/blog/keeping-annotation-items-out-of-chatbots

**Potato 2.14.0 can make pasting an annotation item into a chatbot slower and easier to see, and no Potato setting stops the practice. The `text_as_image` setting leaves the annotator no item text to copy, keystroke logging and page paradata record pastes and copies for a researcher to review, and attention checks fail answers given faster than a set floor. An annotator who retypes the item, runs OCR on a screenshot, or photographs the screen gets past every one of the controls.**

A paid annotator can copy an item into a [large language model](https://en.wikipedia.org/wiki/Large_language_model) (LLM) chat, read the model's reply, and paste the reply back as an answer or click the label the model chose. [Veselovsky, Horta Ribeiro, and West (2023)](https://arxiv.org/abs/2306.07899) reran an abstract summarization task on Amazon Mechanical Turk and combined keystroke detection with a classifier for synthetic text. By the authors' estimate, 33 to 46% of the crowd workers used LLMs on the task, and the authors cautioned that the estimate may not generalize to tasks less suited to LLMs. A label-only task gives a chatbot less to write than a summary, yet the copy-and-ask route works on a label-only task as well.

## Rendering the item as a picture with text_as_image

The [`text_as_image`](/docs/features/text-as-image) setting makes Potato draw each item's text into a PNG on the server and send the picture in place of the words. The annotation page and the JSON endpoints behind the page contain no item text. Potato also switches off text selection, dragging, and the right-click menu on the picture, so select-all, copy, and view-source give the annotator nothing to paste. One line at the top level of the config turns the setting on:

```yaml
text_as_image: true
```

Install Pillow 10.1 or newer with `pip install "pillow>=10.1"` before turning the setting on. A plain `pip install potato-annotation` leaves Pillow out, and without Pillow every annotation page fails with a server error. The picture replaces only Potato's plain item text box. Potato leaves the setting inert and logs a startup warning when the config has an `instance_display` block, an image scheme, an audio or video scheme, or a `tiered_annotation` scheme that plays media.

Seven features in Potato 2.14.0 still send the item text to the browser or to a model, and Potato starts with any of the seven on beside `text_as_image`. The [grid view](/docs/features/grid-view) puts the text of every item on a grid page into its tiles, and a grid page holds 24 items by default and up to 200 through `grid_view.page_size`. [Solo Mode](/docs/features/solo-mode) shows the item as words. The [LLM chat sidebar](/docs/features/chat-support) passes the item text to a model from inside the page. Boundary Lab, the review queue, session-level scoring, and admin keyword highlights each return some item text from an API route. Leave all seven features off in a study that relies on the picture. Potato refuses to start when `text_as_image` is on beside a span scheme, [Pocket Mode](/docs/features/pocket-mode), or [Multiplayer Rooms](/docs/features/multiplayer-rooms). Potato also refuses to start when an audio, video, or media-playing `tiered_annotation` scheme names a media field other than `text_key`, and when any scheme's `*_field` or `*_key` option names a field that `text_as_image` blanks.

## Recording pasted answers with keystroke logging

[Keystroke logging](/docs/features/keystroke-logging) records how each free-text answer was produced without recording the characters. Each event holds a timestamp, an input type, a key class, and a change in field length, and a paste is stored as a length, a source label, and a salted hash. Potato labels a paste `self` when the pasted text already appears in the same field, `instance_text` when the paste quotes the item on the page, `ai_suggestion` when the paste matches an AI suggestion, and `external` for anything else. A cut-and-paste move within the answer is not always labeled `self`. A paste shorter than 12 characters is labeled `unknown`, and every paste is labeled `unknown` when `classify_paste_source` is set to `false`. [Writing-process detection](/docs/features/writing-process-detection) turns the logs into named flags. The `paste_dominant` flag fires when half or more of the final answer arrived by paste, and `offscreen_composition` fires when a session holds 80 or more characters of external insertion and the longest absence before an insertion lasted 10 seconds or more. Potato checks the two conditions separately over the whole session, so the long absence and the large insertion need not come together.

Add this block to an existing config to record every free-text field:

```yaml
keystroke_logging:
  enabled: true
  detection:
    on_external_insert: flag
```

The `flag` value records each paste silently for later review. The `block` value stops every paste and drop into a logged text field, including in-page pastes such as a quote of the item, an AI suggestion, or the annotator's own text. Browser autofill, IME composition, and input into a `contenteditable` element get past the block, and an annotator who meets the block can still retype the chatbot's reply.

Potato does not detect LLM-written annotations. Each flag is a process signal that lists the feature values that fired the flag, and Potato ships no pre-trained classifier. Running `python -m potato.typing_detect calibrate config.yaml` refits three thresholds to a project's own sessions, for typing rhythm, implausible typing speed, and offscreen composition. Calibration needs at least 30 sessions of 80 or more characters, and each refit threshold stays within three times its default. The paste rules are never calibrated. A calibrated threshold flags about 5% of a project's sessions by default, even in a project where no annotator pastes anything. Read flags as evidence for a human reviewer, and never tie a flag to automatic rejection or withheld pay.

With `text_as_image` on, the page has no passage text for keystroke logging to compare a paste against. A quote of the item recovered by OCR is then labeled `external` rather than `instance_text` and can trip `paste_dominant`. Keystroke logging covers free-text fields only, so a task built entirely from radio buttons or Likert scales gives keystroke logging nothing to record.

## Page paradata for label-only items

The [`authenticity`](/docs/features/authenticity) block records content-blind page paradata on every task type, radio buttons and Likert scales included. The browser counts page leaves, copies of the item text, and pastes of outside text, and sends the totals to the server without any text. The `copy_then_away` flag fires when an annotator copies 40 or more characters of the item, leaves the page within 60 seconds of the copy, and stays away 10 seconds or longer. The `copy_then_paste` flag fires when an item copy is followed by a paste of 10 or more words of outside text. The `away_from_task` flag sums the time away across every view of the item and fires on three or more page leaves or on a total absence of 60 seconds or more that takes up at least half the elapsed time on the item. A leave shorter than `min_away_ms` (1 second by default) does not count, and neither does time spent in a page the task itself opened, such as the codebook link. The `authenticity` block is off by default, and one line under the block turns the paradata on:

```yaml
authenticity:
  enabled: true
```

With `text_as_image` on, the two copy rules cannot fire on a real copy of the item. Potato counts a copy as an item copy when the selection starts inside the `.instance-area` element, and the `.instance-area` element around the picture still holds the "Text to Annotate:" heading. A copy of that heading or of other text near the picture can therefore still fire a copy rule, and `copy_then_paste` sets no minimum copy length. The remaining paradata rules keep firing in a study that uses both settings:

- `away_from_task`
- `external_paste`, on a paste of 10 or more words of outside text
- `split_screen`
- `automation`
- `synthetic_input`
- `pointer_teleport`

The tracker holds blank item text when `text_as_image` is on, so a quote of the item recovered by OCR and pasted back counts as outside text and can trip `external_paste`.

## Attention checks and gold items

[Attention checks](/docs/features/quality-control#attention-checks) are items with a known answer mixed into the queue, and [gold items](/docs/features/quality-control#gold-standards) are expert-labeled items that measure each annotator's accuracy. The `min_response_time` key fails an attention-check answer given in fewer than the set number of seconds, even when the answer is correct. Since v2.12.0, the clock starts on the server when the server hands the item over, so a modified browser cannot change the measured time. A floor of 3 seconds fails a check answered faster than an annotator could read a short item:

```yaml
attention_checks:
  enabled: true
  items_file: "data/attention_checks.json"
  frequency: 10
  min_response_time: 3.0
```

Attention checks and gold items measure reading and accuracy. An annotator who gets the right label from a chatbot passes the attention check and matches the gold label. A trip to a chatbot and back usually takes longer than 3 seconds, so the timing floor catches annotators who click without reading and misses annotators who ask a chatbot.

## Routes to a chatbot that stay open

An annotator can retype the item into a chatbot, take a screenshot and run OCR on the screenshot, or point a phone camera at the screen and ask a chatbot on the phone. Each route takes more steps than a paste, and the phone route leaves no trace on the page. Keystroke logging sees a retyped chatbot reply only through typing rhythm. The `transcription_rhythm` flag fires only on answers of 80 or more characters typed at a steady rhythm with almost no deletion. On a label-only item, a phone-camera round trip looks like an annotator who paused before clicking.

## Costs to accessibility and language

Every picture has the same alt text, "The text for this item, shown as an image", and a screen reader can read nothing else of the item. Leave `text_as_image` off for any study whose annotators use a screen reader or another tool that reads page text aloud. Potato 2.14.0 draws the picture in Pillow's built-in font. The built-in font covers the ASCII characters and about 15 other symbols. Accented Latin letters, Cyrillic, Greek, Arabic, Devanagari, and Chinese characters come out as empty boxes, and the em dash and the euro sign come out the same way. Keep `text_as_image` off for items in languages other than English, and check English items for accented names and typographic dashes before turning the setting on.

Writing-process detection misreads some assistive tools. Some dictation software may trip `silent_insertion`, and some assistive technologies produce the script-generated events that fire `synthetic_input`. For a study open to assistive-technology users, drop both rules from the review criteria, or turn detection off and analyze the exported features directly.

## A chat sidebar for studies that allow AI help

A study that accepts AI help as long as the help is recorded can offer a chatbot inside Potato. The [`chat_support`](/docs/features/chat-support) block adds an **Ask AI** sidebar where the annotator asks a model about the item on screen, and Potato saves every message in the annotator's `user_state.json`. The [`ai_support.holdout`](/docs/features/ai-support#a-no-assistance-comparison-group) setting withholds the sidebar from a random share of annotator-item pairs, and comparing the two groups shows how far the chat moves the labels. The sidebar passes the item text to a model, so leave `chat_support` off in a study that turns on `text_as_image`.

## A setup that combines the controls

The five steps below make the paste route as costly as Potato 2.14.0 allows:

1. Set `text_as_image: true`, install Pillow 10.1 or newer, and keep the grid view, Solo Mode, the chat sidebar, and the four API features listed above off.
2. Turn on `keystroke_logging` for free-text answers and `authenticity` for label-only items.
3. Add attention checks with a `min_response_time` floor, and mix gold items into the queue.
4. Tell annotators in the instructions not to use AI tools on the items.
5. Review the flags by hand, alongside the answers.

Before turning on either logger, read [Keystroke Logging Ethics](/docs/features/keystroke-logging-ethics) for the consent language, and set each logger's `phases` key so recording starts after the consent page.

## Further reading

- [Text as Image](/docs/features/text-as-image), for every place the item text still reaches the browser
- [Keystroke Logging](/docs/features/keystroke-logging), for what the logs record and where the logs are stored
- [Writing-Process Detection](/docs/features/writing-process-detection), for the flags, calibration, and false positives
- [Quality Control](/docs/features/quality-control), for attention checks and gold items
- [LLM Chat Sidebar](/docs/features/chat-support), for the `chat_support` block and the chat logs

For the `authenticity` block, see [Authenticity Paradata](/docs/features/authenticity) and the [source documentation](https://github.com/davidjurgens/potato/blob/master/docs/advanced/authenticity_paradata.md).

## References

1. Veselovsky, V., Horta Ribeiro, M., and West, R. (2023). Artificial Artificial Artificial Intelligence: Crowd Workers Widely Use Large Language Models for Text Production Tasks. *arXiv*. https://arxiv.org/abs/2306.07899
