Drop & predict — dataset uploads and retention

By default, every prediction sends your dataset inside the inference request itself. Drop & predict decouples the two: the dataset is first uploaded to Neuralk storage, then inference runs by reference — the prediction request carries nothing but a small identifier.

When to use it

  • Large datasets / unstable networks — the upload is a short, retryable transfer; the long-lived inference connection (which waits for a GPU slot) no longer holds your payload, making it far less sensitive to proxies and connection drops.

  • Repeated predictions on the same data — the uploaded dataset can be re-used for several inference calls until it expires, without re-sending anything.

  • Intermediaries (MCP servers, orchestration tools) that should not stream gigabytes through their own memory.

Estimator usage

Pass upload_mode=True to any estimator. Each prediction then uploads the dataset and predicts by reference, transparently:

from neuralk import SeldonClassifier

clf = SeldonClassifier(
    api_key="nk_live_xxxx",
    upload_mode=True,   # drop & predict
    ttl_days=7,         # keep the dataset 7 days (see Retention below)
)
clf.fit(X_train, y_train)
predictions = clf.predict(X_test)

clf.last_dataset_id_    # id of the uploaded dataset, re-usable

The same parameters exist on SeldonRegressor and Seldon.

Note

upload_mode is cloud only — it relies on Neuralk-managed storage and is not available for on-premise hosts.

Low-level API

For full control (for example to upload once and predict several times), use the client resources directly:

from neuralk import NeuralkAPI

client = NeuralkAPI(api_key="nk_live_xxxx")

# 1. Upload — the archive freezes data AND request settings together
upload = client.datasets.create(
    X_train=X_train,
    y_train=y_train,
    X_test=X_test,
    model="seldon-small",
    ttl_days=30,
)

# 2. Predict by reference — no data in the request; repeatable until
#    the dataset expires
result = client.classifications.create(dataset_key=upload["dataset_id"])
print(result["predictions"])

An uploaded dataset is a frozen inference request: training data, test data and settings (model, strategy, …) are packed together, so the dataset_id fully determines the prediction.

Retention (ttl_days)

Every uploaded dataset expires automatically. The retention tier is chosen at upload time:

ttl_days

Behaviour

1, 7, 30, 90

The dataset is automatically deleted from Neuralk storage after that many days.

not set (default)

Server default retention: 90 days.

Details worth knowing:

  • Expiration is day-granular and asynchronous on the storage side — treat it as “at least N days”.

  • After expiry, using the dataset_id returns a 404. In upload_mode the estimator handles this transparently (it re-uploads and retries); with the low-level API, upload again.

  • Any other ttl_days value is rejected with a ValueError before anything is sent.

  • Uploading consumes no credits; credits are only consumed by successful predictions.

Next steps