How Sliding-Window Scoring Lets Detectors Highlight AI Passages Inside Long Documents
20 Jul 2025
Open up an AI-detection report on a long essay and you’ll often see something oddly specific: paragraph three glowing red, paragraph four clean, a single sentence in the middle of page two flagged on its own. How does a tool that spits out one percentage decide which slice of a 4,000-word document to point at? The short answer is that it doesn’t score the whole thing at once. It scores it in pieces, using a technique called sliding-window scoring.
Once you understand how that window moves, a lot of confusing detector behavior starts to make sense.
Key takeaways
- A detector can’t read a long document as one number and still point at one paragraph, so it slides a fixed-size window across the text and scores each window separately.
- Windows usually overlap, which is why a single sentence can sit inside several scored chunks and end up with a blended color.
- The highlighted spans are an aggregation of many local scores, not a per-word verdict.
- Window size and stride explain odd behavior: tiny edits moving highlights, two tools disagreeing on the same paragraph, boundaries landing mid-thought.
- Knowing the mechanism lets you read a report calmly instead of treating a red block as proof.
The problem with scoring a whole document at once
Most AI detectors are classifiers. You feed them text, they hand back a probability that the text is machine-generated. That works fine for a tweet or a single paragraph. It breaks down for a dissertation.
There are two practical reasons. First, models have a fixed context limit — they can only look at so many tokens at a time, and a long paper can blow right past it. Second, even if a model could swallow 5,000 words whole, a single score for the whole thing tells you almost nothing useful. Picture a student who wrote 90% of an essay by hand and pasted one AI-generated paragraph into the middle. A document-level score might land at “20% likely AI” and leave everyone guessing. Was the whole thing mildly suspicious, or was one chunk very suspicious and the rest clean? One number can’t say.
Sliding windows solve both problems at once.
How the window actually moves
The mechanic is simple. The detector picks a window size — usually measured in tokens, often something in the range of 128, 256, or 512. It scores the text inside that window. Then it slides the window forward by a fixed step, called the stride, and scores again. It keeps going until the window reaches the end.
If the window is 256 tokens and the stride is 128, each new window shares half its content with the one before it. That overlap is on purpose. It means no single sentence rides entirely on one arbitrary cut point, and it smooths the scores so a passage doesn’t flip from green to red just because a boundary happened to fall in an awkward spot.
Here’s a tiny worked example. Say a paragraph runs 600 tokens, the window is 256, and the stride is 128. The detector scores roughly these spans:
- Tokens 0–256
- Tokens 128–384
- Tokens 256–512
- Tokens 384–600
That’s four local scores for one paragraph. The middle of the paragraph (around tokens 256–384) sits inside three of those four windows. The edges sit inside fewer. So the detector ends up with a *sequence* of scores layered across the text, not one verdict.
Turning many scores into one highlight
The detector still has to decide what color to paint each sentence. This is the aggregation step, and tools handle it differently. A common approach: for any given token or sentence, average the scores of every window that contained it. Some tools take the maximum instead, which makes highlights more aggressive — one hot window is enough to light up the region. Others weight windows by how centered the text was inside them.
The result is a heatmap. Sentences where the overlapping windows agreed “this reads machine-like” get a strong color. Sentences where windows disagreed land somewhere in between. That blending is exactly why you sometimes see a faintly tinted sentence that’s neither clearly flagged nor clearly clean — it’s the average of windows that didn’t agree.
What’s the window measuring inside each chunk? Broadly, the same statistical signals a detector leans on everywhere: how predictable the next word is, and how much that predictability varies. If you want the underlying math, we covered perplexity and burstiness separately. Sliding windows are the delivery mechanism; perplexity-style features are the cargo.
A mini-scenario: the pasted paragraph
Picture Maya, a grad student. She drafts a 12-page literature review by hand over two weeks. Crunched for time on the conclusion, she has a chatbot draft three paragraphs and pastes them in with light edits.
She runs the finished document through a detector. The report comes back at 31% overall — not damning on its own. But the passage view tells the real story: pages 1 through 10 are clean green, and the conclusion is a solid block of red. The windows that landed inside her handwritten sections scored low and stayed low. The windows covering the pasted conclusion scored high, and because several overlapping windows all agreed, the aggregation painted that region with confidence.
That’s the value of windowing, and also its trap. It correctly localized the machine-written section. But notice what it *can’t* do: it can’t prove Maya pasted that text, and it can’t tell her light edits apart as a separate thing. All it reports is that those windows read as low-variety and predictable. The highlight is a nudge to look closer, not a confession.
Why this explains so much weird behavior
Once you know windows slide and overlap, several common complaints stop being mysterious.
Highlights shift after a tiny edit. Change two words near the start of a paragraph and you change the token sequence. Every window boundary downstream shifts position, and the content of several overlapping windows changes with it. The detector recomputes those windows, and the colors move — sometimes in passages you never touched. You didn’t “trick” anything. You moved the grid.
Two detectors flag different paragraphs. One tool might use 256-token windows with heavy overlap; another uses 512-token windows and a max-pooling aggregation. A paragraph that sits comfortably inside one tool’s window gets split across two windows in the other, producing different local scores. Add different underlying models and you get genuine disagreement on the same text.
A boundary cuts a thought in half. Windows are sized in tokens, not ideas. A window can start mid-sentence and end mid-sentence. That’s why detectors overlap windows, and why no single window’s score gets the final word — the overlap is there precisely to stop an unlucky cut from dominating.
Short documents behave erratically. If your text is shorter than one window, there’s no sliding at all — it’s a single chunk, and the score can swing hard on very little evidence. Long documents are where windowing actually shines, because averaging across many windows gives the heatmap something to lean on.
How to read a passage-level report sanely
Treat the highlights as a map of *where to look*, not a list of charges.
- Start with the strongly colored regions and read them out loud. Do they actually sound flat, generic, evenly paced? Or are they just dense and technical? Detectors can mistake clean, formal prose for machine output.
- Ignore faint single-sentence tints in isolation. Those are often just one window’s noise leaking through the average.
- Don’t chase the highlights word by word. Because of overlap, a flagged sentence might be colored by its neighbors, not itself. Revise the passage as a whole.
- Remember the scores are probabilities. Detectors output likelihoods, not proof — OpenAI even retired its own classifier in July 2023, citing a low rate of accuracy, and a 2023 Stanford study (Liang et al.) found several detectors disproportionately flagged essays by non-native English writers. Window mechanics make the output more granular, not more certain.
Curious what a passage view costs before you commit? Here’s what a check costs. For deeper background on the moving parts, there’s more on how detection works.
Frequently asked questions
What is a sliding window in AI detection?
It’s a fixed-size chunk of text — say 256 tokens — that the detector scores on its own, then moves forward by a set step and scores the next chunk. Doing this across a long document produces a sequence of local scores instead of one global number, which is what lets the tool color individual passages.
Why does the same paragraph get a different score in two detectors?
Different tools use different window sizes, strides, and aggregation rules. A paragraph that lands neatly inside one tool’s window might be split across two windows in another, and the underlying models differ too. Window mechanics are one of several reasons detectors disagree on the same text.
Does a highlighted sentence mean that exact sentence is AI?
Not literally. The highlight reflects the scores of every window that overlapped that sentence, blended together. A sentence can be colored because its neighbors pulled the local average up, not because it alone looked machine-written.
Why do highlights shift when I make a small edit?
Editing changes the token sequence, which shifts where window boundaries fall and what each window contains. A two-word change near a boundary can move several overlapping windows enough to recompute their scores, so the colored regions move even in passages you didn’t touch.
Can I trust passage-level highlights to find the AI parts of my draft?
Treat them as a starting map, not a ruling. They help you spot sections that read as low-variety or generic, but the scores are probabilistic and sensitive to window placement. Read the flagged passages yourself and judge whether they actually sound flat.
Closing
Sliding-window scoring is the unglamorous plumbing that turns a single classifier into something that can point at one paragraph in a 4,000-word document. It’s clever, useful, and easy to over-read. The colors are an aggregation of many overlapping local guesses — a heatmap, not a verdict. Read them that way and you’ll make better decisions about your own writing. Want to see which passages of your draft read as machine-like before anyone else does? Run it through PaperBleach and look at the map for yourself.
Try it on your own text
Paste your draft into PaperBleach to humanize AI text so it reads naturally — then check your score against built-in AI detection. Free on your first run.


