AI Wiki中文/EN

Cold start: which side has no history?

冷启动问题

Audit four user/item groups, fit a metadata baseline and test what happens when new-user attributes disappear.

On this pageIntuitionMathematics & methodImplementationLimitationsExercisesResearch connections

A new pair does not necessarily contain a new user

A test file contains a user–item pair absent from training. That does not tell us whether the user is new, the item is new, both are new, or both already have substantial histories. Reporting all four cases as one “cold-start score” can hide which problem a system has solved.

Cold start concerns missing evidence for newly encountered users or items. Content attributes can supply another route, but only if they are available at decision time and their meanings were learned from earlier data. Pazzani and Billsus describe attribute-based profiles and their representation limits. Recorded profile sections Kula’s LightFM model represents a user or item by sums of feature embeddings, allowing known shared attributes to contribute even when an identity lacks interactions. PDF 2

This engineering article builds an evaluation split and a transparent baseline. It does not reimplement LightFM: our fitted models are an identity-bias ridge baseline and the same baseline augmented with explicit user–item attribute crosses.

Four test groups compare identity-bias and attribute-cross baselines under an explicitly favorable synthetic generator.
Four test groups compare identity-bias and attribute-cross baselines under an explicitly favorable synthetic generator.

Define “new” relative to a frozen training set

Let U_tr and I_tr be the identities that occur in training interactions. Classify each evaluation pair by:

G(u,i)=(1[u∈Utr],1[i∈Itr]).G(u,i)=\big(\mathbf1[u\in U_{\rm tr}],\mathbf1[i\in I_{\rm tr}]\big).

The four values mean warm/warm, new-user/warm, warm/new-item and new-user/new-item. “Warm” here means at least one training interaction, not abundant evidence. An unseen pair can fall into the warm/warm group; random interaction splitting alone does not establish new-user or new-item performance.

Suppose a user has p metadata attributes a_u and an item has q attributes b_i. Our simple predictor combines an intercept, indicators for identities seen in training, and all p q attribute products:

y^ui=β0+βu⊤eu+βi⊤ei+γ⊤vec⁡(aubi⊤).\widehat y_{ui}=\beta_0+\beta_u^\top e_u+\beta_i^\top e_i+\gamma^\top\operatorname{vec}(a_u b_i^\top).

The vector e_u has one column per known training user; it is all zero for a new user. The item indicators behave similarly. An arbitrary new ID does not obtain a fitted coefficient by reserving an unused column. The attribute crosses can contribute if their values exist and the corresponding relationships were learnable from training.

This is a linear regression over explicit crosses, not a factorized embedding model. LightFM instead learns feature vectors and sums them to form each side’s representation before a dot product and biases. Both constructions can share evidence through attributes, but their parameterization, capacity and training loss differ. LightFM, PDF 2, sections 2.2–2.3

Stack the training pair features into X and ratings into y. We fit:

L(β)=∥Xβ−y∥22+λ∑j=1D−1βj2,λ>0.L(\beta)=\|X\beta-y\|_2^2+\lambda\sum_{j=1}^{D-1}\beta_j^2,\qquad\lambda>0.

Column zero is the constant intercept and remains unpenalized. The design has D=1+|U_tr|+|I_tr|+p q columns with metadata; the identity-only baseline omits the p q cross columns. Differentiation gives:

(X⊤X+diag⁡(0,λ,…,λ))β=X⊤y.\left(X^\top X+\operatorname{diag}(0,\lambda,\ldots,\lambda)\right)\beta=X^\top y.

Positive ridge and at least one training row with intercept one give a unique solution. All preprocessing decisions, vocabularies and parameter fitting use training evidence. Metadata for a future ID may be supplied at prediction time, but must not incorporate later outcomes such as eventual popularity or future reviews.

Report both sample count and error separately for each nonempty group g:

RMSE⁡g=1∣Tg∣∑(u,i)∈Tg(y^ui−yui)2.\operatorname{RMSE}_g=\sqrt{\frac1{|T_g|}\sum_{(u,i)\in T_g}(\widehat y_{ui}-y_{ui})^2}.

An empty group has no measured RMSE. Return None rather than zero, and do not treat an absent failure case as success. If groups have different label ranges or item populations, their errors need not be directly comparable as measures of intrinsic difficulty.

Keep all four groups visible

Run the complete original program with Python 3.12 and NumPy 1.26.4. Seed 31 creates two numeric attributes for each of eight users and eight items. The true ratings equal 2 plus a fixed bilinear function of those attributes. This generating process deliberately favors an attribute-cross predictor; the attributes are assumed available before interactions.

Only users 0–5 and items 0–5 can appear in training. A deterministic mask holds out some of their pairs as well. The result is 27 training pairs and 37 test pairs. Lambda is fixed at 0.1; the test labels are not used to choose it.

"""Original four-quadrant cold-start audit with a ridge feature-cross baseline."""
import json
import numpy as np


def features(pairs,user_attributes,item_attributes,known_users,known_items,metadata=True):
    users=np.asarray(user_attributes,float);items=np.asarray(item_attributes,float);pairs=np.asarray(pairs)
    if users.ndim!=2 or items.ndim!=2 or not np.isfinite(users).all() or not np.isfinite(items).all() or pairs.ndim!=2 or pairs.shape[1]!=2 or pairs.dtype.kind not in 'iu':raise ValueError('finite attributes and integer pairs required')
    if (pairs<0).any() or (pairs[:,0]>=len(users)).any() or (pairs[:,1]>=len(items)).any():raise ValueError('pair outside attribute table')
    ku=tuple(sorted(set(known_users)));ki=tuple(sorted(set(known_items)))
    if any(not isinstance(u,(int,np.integer)) or u<0 or u>=len(users) for u in ku) or any(not isinstance(i,(int,np.integer)) or i<0 or i>=len(items) for i in ki):raise ValueError('known IDs outside tables')
    rows=[]
    for u,i in pairs:
        row=[1.]+[float(u==v) for v in ku]+[float(i==j) for j in ki]
        if metadata:row+=np.outer(users[u],items[i]).ravel().tolist()
        rows.append(row)
    width=1+len(ku)+len(ki)+(users.shape[1]*items.shape[1] if metadata else 0)
    return np.asarray(rows,float).reshape(len(pairs),width)


def fit(x,y,regularization=.1):
    x=np.asarray(x,float);y=np.asarray(y,float)
    if x.ndim!=2 or min(x.shape)==0 or y.shape!=(len(x),) or not np.isfinite(x).all() or not np.isfinite(y).all() or not np.isfinite(regularization) or regularization<=0:raise ValueError('nonempty finite design and positive ridge required')
    penalty=regularization*np.eye(x.shape[1]);penalty[0,0]=0
    if not np.all(x[:,0]==1):raise ValueError('first column must be an intercept')
    return np.linalg.solve(x.T@x+penalty,x.T@y)


def quadrant(pair,known_users,known_items):
    u,i=pair;return ('warm' if u in known_users else 'new-user')+'/'+('warm' if i in known_items else 'new-item')


def audit(pairs,truth,prediction,known_users,known_items):
    pairs=np.asarray(pairs);truth=np.asarray(truth,float);prediction=np.asarray(prediction,float)
    if pairs.ndim!=2 or pairs.shape[1]!=2 or truth.shape!=(len(pairs),) or prediction.shape!=truth.shape or not np.isfinite(truth).all() or not np.isfinite(prediction).all():raise ValueError('aligned finite evaluation arrays required')
    rows={}
    for label in ['warm/warm','new-user/warm','warm/new-item','new-user/new-item']:
        mask=np.array([quadrant(p,known_users,known_items)==label for p in pairs]);n=int(mask.sum())
        rows[label]=dict(count=n,rmse=float(np.sqrt(np.mean((truth[mask]-prediction[mask])**2))) if n else None)
    return rows


def fixture():
    rng=np.random.default_rng(31);u=rng.uniform(-1,1,(8,2));i=rng.uniform(-1,1,(8,2));truth=2+u@np.array([[.8,.1],[-.2,.6]])@i.T
    pairs=np.array([(a,b) for a in range(8) for b in range(8)]);train=np.array([a<6 and b<6 and (a+b)%4!=0 for a,b in pairs])
    return u,i,pairs,truth[pairs[:,0],pairs[:,1]],train


def demo():
    users,items,pairs,y,train=fixture();ku=set(pairs[train,0]);ki=set(pairs[train,1]);rows={}
    for metadata in [False,True]:
        x=features(pairs,users,items,ku,ki,metadata);w=fit(x[train],y[train]);rows['hybrid' if metadata else 'id-only']=audit(pairs[~train],y[~train],(x@w)[~train],ku,ki)
    x=features(pairs,users,items,ku,ki,True);w=fit(x[train],y[train]);missing=users.copy();missing[6:]=0
    lost=features(pairs,missing,items,ku,ki,True)@w
    return dict(training_pairs=int(train.sum()),test_pairs=int((~train).sum()),known_users=sorted(map(int,ku)),known_items=sorted(map(int,ki)),
                metrics=rows,missing_user_metadata=audit(pairs[~train],y[~train],lost[~train],ku,ki),
                both_cold_features=features(np.array([[6,6]]),users,items,ku,ki,True)[0].tolist(),
                coefficients=w.tolist(),scope='Synthetic metadata available before interaction; identity-only and linear-cross ridge baselines, not LightFM.')


if __name__=='__main__':print(json.dumps(demo(),allow_nan=False))

The four test groups contain 9, 12, 12 and 4 pairs. Their RMSE values are:

GroupIdentity-bias baselineWith attribute crosses
Warm user / warm item0.4627030.024508
New user / warm item0.1988450.009427
Warm user / new item0.2259100.011197
New user / new item0.1557930.007472

These are exact consequences of the disclosed synthetic fixture, not evidence that cold cases are universally easier or that metadata always helps. The both-new group happens to have lower errors than warm/warm; its population and four-example size differ.

Now remove attributes for new users by setting their vectors to zero, without retraining. New-user/warm-item RMSE rises to 0.305653, and both-new error to 0.155500. The warm-user groups stay unchanged. This is a missing-input stress test; zero is not automatically the appropriate encoding for missing metadata in a real system. A system should explicitly distinguish missing values from genuinely zero-valued attributes.

Tests check the normal equations, disjoint group counts, zero identity indicators for new IDs, and that changing held-out labels cannot alter fitted weights. They also verify JSON outputs and return an undefined metric for a group with no examples.

For T training pairs and D dense columns, this baseline forms a Gram matrix in O(T D²) and solves in O(D³), storing O(T D + D²). The example also materializes features for all 64 pairs; scoring E evaluation pairs costs O(E D). Dense identity columns scale poorly. A larger system needs sparse representations, iterative fitting or an appropriate factorized model, plus a separate retrieval and eligibility design.

Metadata must exist before the recommendation

An item description written by its creator may be available at launch. A “number of purchases this month” field is not available before that month has unfolded. User-supplied preferences may be useful, while a profile inferred from future interactions leaks the outcome. Availability is a data contract, not a property guaranteed by the word “metadata.” Kula’s formulation explicitly assumes known features; that assumption needs checking in each product. PDF 2

When user history and usable user attributes are both absent, start with a declared nonpersonalized fallback such as eligible popularity or an editorial list, or ask for a small amount of preference information. A fallback’s behavior should be measured separately from personalized quality. Item content also cannot distinguish two items whose represented attributes are identical. Representation limits, PDF 16

This split isolates identity novelty; it is not a time-based deployment simulation. For a temporal evaluation, freeze identities, interactions and features as of each decision cutoff and retain the four-group report. More detailed analyses can subdivide “warm” by history length rather than treating one interaction and a thousand as equivalent.

Identify the missing evidence

  1. A held-out pair contains a user and item both seen in training. Which group is it? Answer: Warm/warm. The pair is new, but neither identity is new under this definition.
  2. How many test examples are genuinely new on at least one side here? Answer: 28: 12 new-user/warm, 12 warm/new-item and 4 both-new. The other 9 are warm/warm.
  3. Why is a nonexistent group’s RMSE not reported as zero? Answer: No examples means no measured error. Zero would misleadingly suggest perfect predictions.
  4. Can future review counts be used as launch-time item metadata? Answer: No. They were unavailable at the decision. Use launch-time information or change the evaluated decision time explicitly.

A model route and an evaluation route are different

The LightFM method page motivates shared features as one response to identity cold start; the content-based chapter supplies attributes and their limits. The four-group split, ridge-cross baseline and missing-attribute experiment are original. The CEUR download failed, so the cited model source is explicitly arXiv v1 dated July 30, 2015. No LightFM training run, public dataset or user study is claimed. Extend the baseline by hiding item attributes too and report which groups lose usable information.

Make a prediction, then check

Can a random interaction split alone establish performance on entirely new users?

Choose one answer

Learning objectives

  • Design a split that separates unseen users from unseen items and prevents target leakage.
  • Run the original computation and explain a counterexample without claiming a public benchmark result.

Prerequisites & connections

Explore related knowledge →

References

  1. Metadata Embeddings for User and Item Cold-start Recommendations — arXiv v1
    Maciej Kula · 2015
  2. Content-based Recommendation Systems
    Michael J. Pazzani; Daniel Billsus · 2007

Version1 · Editorial status: Recorded technical checks completed

View technical check record (AI)

Codex · 2026-09-23 · Single AI author. Scoped reading: Read PDF 1 identity/date (30 July 2015), page 2 method and viewed page 2. Sum of feature embeddings, metadata availability and identity-only MF relation. CEUR URL failed; v1 used explicitly. Physical PDF 1 identity and 2–3, 5–7, 10–12, 16 text: item features, profiles, linear regression, Rocchio and limits. Figures not visually reviewed. 5 paired equations and four explained exercises. Checked four disjoint groups, training-only identity indicators, ridge normal equations, held-out-label invariance and missing attributes.27 training/37 test pairs from attribute-cross truth; linear-cross baseline, not LightFM.

  • Checked four disjoint groups, training-only identity indicators, ridge normal equations, held-out-label invariance and missing attributes.27 training/37 test pairs from attribute-cross truth; linear-cross baseline, not LightFM.
  • Four computed SVG variants per topic;10 numeric/geometry tests and30 responsive cases passed. Ten selected final captures directly viewed. Full article acceptance recorded separately.

Source locations checked:

Related topics

No matches. Try a synonym or acronym.

0 results shown

Wrap the whole query in double quotes for a phrase match.