Skip to content

Can click logs be training data? How much information is in thirty million clicks

THE ARGUMENT

Whether a click log can train a ranking model depends on three things being complete: impressions without clicks, position, and how sessions were cut; miss any one and more rows only give you a set of positives, not preference data.

On this page

The vendor sends a behaviour log: thirty million clicks across eight million users and four hundred thousand items, spanning a year, with the line "suitable as training data for recommendation models". You open the first row: user ID, item ID, timestamp, clicked. No impressions, no position, no session ID. Those three absences turn thirty million records from "what users chose" into "what users happened to click", and what a ranking model has to learn is precisely the part that was looked at and not clicked. The question this article answers is what a log has to look like before it deserves to be called training data.

What one click says, and what it does not

A click record says this user took an interest in this item at this moment. It does not say which slot the item occupied, what else was on the same screen, whether the user glanced and clicked or hovered and hesitated, or what they were looking at beforehand. Those are what a ranking model needs, because ranking is a comparison task: choose among candidates, not produce one from nothing.

With clicks only, you can train "given a user's history, predict what they will click", which is a generative problem. The live system has to solve "given a user and a hundred candidates, order them", which is discriminative. The gap between the two is not closed by volume; the shape of the data is wrong. Ten times the clicks still teaches what gets clicked, not that A outranks B.

This is why "thirty million" is hard to judge. Thirty million rows with an impression list and a position per row may be enough. Thirty million rows of clicks alone do not even give you a usable negative set. Information is not a function of row count; it is a function of which fields each row carries.

A more basic question gets skipped: is this all the traffic or a sample. If the vendor drew ten percent of users from the full log, the sessions arrive broken — you see a few days of a user's behaviour, not a continuous record. Sequence models are especially sensitive to that, because they learn transition probabilities, and a break turns one transition into one cold start.

The paper turned one shopping log into four tasks

One line of work takes a large shopping behaviour dataset and organizes it into four separately evaluable tasks: recommend the next item from a user's history (sequential recommendation), find an item from a descriptive query (query-to-item), find items that can substitute for the same need (substitute retrieval), and find items bought together (complement retrieval).[1] All four draw on the same underlying log, and each needs a different supervision signal.

The lesson for a buyer is not about model architecture. It is that "how many tasks can this log support" has to be answered before price. A vendor billing by row count has not told you which tasks the log supports. If you want substitute retrieval, you need comparison signals — the user weighed two items for one need — not a plain click stream. The same log may be sufficient for sequential recommendation and completely insufficient for substitutes.

The evaluation design matters too: it ranks over a large candidate set rather than scoring a small sample of random negatives.[1] That distinction is practical. Sampling negatives makes the task easier, inflates the metric, and makes numbers from different sampling ratios incomparable. To reproduce a vendor's number you need the candidate set and the evaluation script, or part of any difference you measure will come from the sampling policy rather than the model.

One level deeper: constructing four tasks from one raw log is itself a chain of judgments — what counts as the same need, what counts as bought together, how long the time window is. There is no single correct answer, but the choices have to be written down. If the delivery omits them, the four tasks you receive are the vendor's four tasks, not yours.

Three things that eat the information

SymptomWhat it looks like in the logEffect on trainingHow to check
Impressions without clicks missingOnly a click table, no impression table; or an impression table that kept only the rows that were clickedNo negatives, or negatives drawn at random with a distribution unlike production; offline metrics inflateAsk for a separate impression table; if none exists, ask for it to be built, and if it cannot, restrict use to generative tasks
Position biasA position field exists but is unused in training, or was never recordedThe model learns that earlier slots are better, then reinforces that in productionCompute CTR by position bucket; if slot one and slot ten differ far more than item quality does, it is position
Session boundariesNo session ID, or a fixed thirty-minute timeoutSequences are wrongly cut or wrongly merged, and history length distribution is distortedCut at two thresholds and compare session length distributions and next-item hit rates
Repeated impressionsThe same user and item appear repeatedly within a short windowThe same pair is counted several times, skewing loss weightsDeduplicate on the user, item and time window triple before counting
Time spanA year of logs trained together with a random splitThe model has seen the future and the metric is untrustworthySplit by time, and require a statement about timestamp completeness

The first row is the root problem. Impression tables are usually one or two orders of magnitude larger than click tables, storage costs money, and many teams keep only clicks. That is a cost decision, not an oversight. But to a buyer, a log with impressions and a log without them support entirely different work, and should carry different prices. A single unit price for both means the seller has not distinguished them either.

Row two has a recomputable check: CTR bucketed by position. If slot one converts several times better than slot eight, and both slots draw from the same retrieval pool so item quality is comparable, the gap is mostly position rather than item. Train on raw clicks as relevance labels and the model learns that slot one is better. In production it keeps putting things in slot one, closing a loop that looks self-consistent and has learned nothing about relevance.

Row three is usually dismissed as an implementation detail. The session threshold decides where one act of behaviour ends: a thirty-minute timeout merges "looked at phone cases, then looked at chargers" into one session, and also cuts "browsed at noon, came back in the afternoon" in two. No threshold is objectively correct, but every threshold is adjustable. Which value the vendor used, and why, sets the sequence length distribution your model will see.

A one-hour audit

The figures and results below are invented to illustrate the procedure and correspond to no real project. Suppose you receive thirty million clicks, two hundred and forty million impression records, and one year of timestamps. Take one day of the log and do four things, which takes an hour.

  1. Compute overall CTR: thirty million over two hundred and forty million, about twelve and a half percent. The number itself does not matter; whether it matches the vendor's definition does. If they call an impression "entered the viewport" and you call it "returned by the API", the two CTRs are not comparable.
  2. Compute CTR by position bucket. Invented result: twenty-eight percent at slot one, two percent at slot ten. A fourteenfold gap far exceeds item-quality differences, so position effects dominate and raw clicks are a position label in disguise.
  3. Cut sessions at two thresholds, thirty minutes and two hours, and compare median session length. Invented result: thirty minutes yields nine million sessions with a median of four clicks; two hours yields five point two million with a median of six.
  4. Read two hundred sessions by hand and mark whether intent changed. Invented result: under the thirty-minute cut, thirty-seven sessions contain an intent switch — from phone cases to chargers — that never timed out and was merged into one sequence.

Step four is the only one that needs a person and the one most often skipped, yet it produces what the first three cannot: where the cutting rule actually fails. Thirty-seven out of two hundred is eighteen and a half percent of the sample, but if those sessions cluster among long ones the effect on a sequence model is amplified, because long sequences usually carry more weight in training.

Steps three and four together support one conclusion: the log is usable, but sequence tasks need re-cutting first. Re-cutting needs no permission — you have the timestamps and it costs an afternoon. Position bias is different. Re-cutting will not fix it; it needs correction during training or stratified sampling, which is a modelling decision. At the data level the only move is to obtain the position field.

# One-hour audit: three numbers, all computed locally, no GPU needed
def position_ctr(logs):
    # each row: user_id, item_id, ts, position, clicked
    agg = {}
    for r in logs:
        p = r["position"]
        s = agg.setdefault(p, [0, 0])
        s[0] += 1             # impressions
        s[1] += r["clicked"]  # clicks
    return {p: v[1] / v[0] for p, v in agg.items() if v[0]}

def sessionize(logs, gap_seconds):
    # sort by user then time; a gap above the threshold starts a new session
    out, last_user, last_ts = [], None, None
    for r in sorted(logs, key=lambda x: (x["user_id"], x["ts"])):
        if r["user_id"] != last_user or r["ts"] - last_ts > gap_seconds:
            out.append([])
        out[-1].append(r)
        last_user, last_ts = r["user_id"], r["ts"]
    return out

# run the same log twice and compare session counts and median lengths
for gap in (1800, 7200):
    ss = sessionize(logs, gap)
    print(gap, len(ss), median([len(s) for s in ss]))

There is no cleverness in that code; the two functions are under thirty lines together. Its value is that it recomputes: another person on another machine with the same log gets the same numbers. When you and a vendor disagree about whether the batch is good, the side holding recomputable numbers usually wins.

The audit should end as a four-row table: overall CTR, the position curve, session length distributions under both cuts, and the intent-switch rate. That table is far more useful than "thirty million rows", because it describes the shape of the log, and the shape decides what can be trained on it.

What a log cannot give you

The limits of the material: the work cited above organizes a public shopping dataset, and its four task definitions, candidate set sizes and evaluation protocol were set for research.[1] It is a reference, not a specification. "Substitute" in that definition means replaceable for the same need; in your business it may mean same price band and same category, which places different demands on the data. Borrowing the definition wholesale gives you a model with good numbers that does not hold up commercially.

A second limit is time. Preference drifts, and across a year the first half and second half can be two distributions. That is not about volume but about slicing: which months train and which months validate must be stated at delivery. If the vendor supplies "one year of data" without month-level timestamp completeness, you cannot even split by time and are left with a random split, which on behaviour logs almost guarantees future leakage.

A third limit: a log records only behaviour that happened. Items a user never saw, candidates never retrieved, products taken down — none of them appear. So the model you train is valid for things the system has already shown and knows nothing about cold-start items or new supply. That is not a data quality problem; it is an inherent boundary of the material. Any claim that click logs solve recommendation walks straight past it.

One thing to do today: ask for twenty-four hours of the raw log rather than a sampled click table, and compute three numbers yourself — impression-to-click rate, CTR by position, and the median session length when you cut at two thresholds without any session ID. With those three you know whether the log can train a ranking model. If there is no position field at all, stop negotiating it as ranking data and price it as behaviour statistics. The two are an order of magnitude apart.

References

  1. Bridging Language and Items for Retrieval and Recommendation

Read next

All articles

Sign in to Padda

A code in your inbox. No password to remember.

Connecting to sign-in…