Releases: tensorflow/ranking
TensorFlow Ranking v0.5.3
This is the 0.5.3 release of TensorFlow Ranking. We release a ranking distillation benchmark called RD-Suite that will accompany a research paper.
We also include a new ranking loss, YetiLogisticLoss: Adapted to neural network models from the Yeti loss implementation for GBDT.
TensorFlow Ranking v0.5.2
This is the 0.5.2 release of TensorFlow Ranking. We fix bugs and make a few improvements to the library. We also update the API reference on www.tensorflow.org/ranking and on Github docs.
TensorFlow Ranking v0.5.1
This is the 0.5.1 release of TensorFlow Ranking. We provide new ranking losses, metrics, layers, and pipeline based on the latest research progresses in Learning to Rank and Unbiased Ranking. We also update the API reference on www.tensorflow.org/ranking and on Github docs. The new changes include:
- Ranking losses added in tfr.keras.losses:
- PairwiseMSELoss: Implement a pairwise mean squared error loss.
- OrdinalLoss: Implement a pointwise multi-head ordinal regression on ordered multilabel.
- MixtureEMLoss: Implement a listwise Expectation-Maximization algorithm on a mixture model, introduced in Revisiting two tower models for unbiased learning to rank.
- Lambda weights for Lambda losses added in tfr.keras.losses:
- NDCGLambdaWeightV2: Implement an NDCG-based lambda weight for lambda losses, introduced in On Optimizing Top-K Metrics for Neural Ranking Models.
- LabelDiffLambdaWeight: Implement a lambda weight based on the absolute difference of two labels.
- Ranking metric added in tfr.keras.metrics:
- HitsMetric: Implement Hits@k metric.
- Ranking layer added in tfr.keras.layers:
- Bilinear: A layer to implement a bilinear interaction of two vectors, used in Revisiting two tower models for unbiased learning to rank.
- Ranking pipeline added in tfr.keras.pipeline:
- MultiObjectivePipeline: A pipeline to apply multi-objective losses, used in Scale Calibration of Deep Ranking Models.
- API reference updated on www.tensorflow.org/ranking and consistently on Github docs.
Dependencies: The following packages will be installed as required when installing tensorflow-ranking
.
tensorflow-serving-api>= 2.0.0, < 3.0.0
tensorflow>=2.7.0
.
TensorFlow Ranking v0.5.0
This is the 0.5.0 release of TensorFlow Ranking. We provide a detailed overview, tutorial notebooks and API reference on www.tensorflow.org/ranking. The new changes are:
- Move task.py and premade tfrbert_task.py to extension.
- Remove RankingNetwork based tfr-bert example. The latest tfr-bert example using native Keras is available at tfrbert_antique_train.py.
- Remove dependency on
tf-models-official
package to reduce install time. Users oftfr.ext.task
or modules that depend on the above package will need to manually install it. - Updated all docstrings to be more detailed. Made several docstrings to be testable.
- Add colab notebooks for quickstart tutorial and distributed ranking tutorial, also available on www.tensorflow.org/ranking.
- Update strategy_utils to support parameter server strategy.
- Add symmetric log1p to tfr.utils.
- Remove references to Estimator/Feature Column related APIs in API reference.
TensorFlow Ranking v0.4.2
This is the 0.4.2 release of TensorFlow Ranking. The main changes are the TFR-BERT module based on the Orbit framework in tf-models, which facilitates users to write customized training loops. The new components are:
TFR-BERT in Orbit
- tfr.keras.task: This module contains the general boilerplate code to train TF-Ranking models in the Orbit framework. Particularly, there are:
RankingDataLoader
, which parses an ELWC formatted data record into tensorsRankingTask
, which specifies the behaviors of each training and evaluation step, as well as the training losses and evaluation metrics.- In addition, there are config data classes like
RankingDataConfig
andRankingTaskConfig
to store configurations for above classes.
- tfr.keras.premade.tfrbert_task: This module contains the TFR-BERT specification of the TF-Ranking Orbit task.
TFRBertDataLoader
, which subclasses theRankingDataLoader
and further specifies the feature specs of a TFR-BERT model.TFRBertScorer
andTFRBertModelBuilder
, which defines a model builder that can create a TFR-BERT ranking model as a Keras model, based on tf-models’ implementation of BERT encoder.TFRBertTask
, which is a subclass ofRankingTask
. It defines thebuild_model
behavior. It also defines theinitialization
method which would load an pretrained BERT checkpoint to initialize the encoder. It also provides the function to output the prediction results along with query ids and document ids.- In addition, there are config data classes like
TFRBertDataConfig
,TFRBertModelConfig
andTFRBertConfig
which stores configurations for above classes.
- examples/keras/tfrbert_antique_train.py: This file provides an example of training a TFR-BERT model on the Antique data set. There is also an .yaml file where users can specify parameter configurations.
Dependencies: The following packages will be installed as required when installing tensorflow-ranking
.
tf-models-official >= 2.5.0
tensorflow-serving-api>= 2.0.0, < 3.0.0
tensorflow==2.5.0
.
TensorFlow Ranking v0.4.0
This release is one of the major releases for TF-Ranking. It provides full support to build and train a native Keras model for ranking problems. It includes necessary Keras layers for a ranking model, a module to construct a model in a flexible manner, and a pipeline to train a model with minimal boilerplate. To get started, please follow the example here. In addition, the new release adds RaggedTensor
support in losses and metrics and we provide a handy example to show how to use it in a ranking model.
The new components are listed below:
-
Keras Layers:
- Use input packing for layer signatures for SavedModel compatibility.
create_tower
function to create a feedforward neural network with batch normalization and dropout.GAMLayer
, a Keras layer which implements the neural generalized additive ranking model.- Update build method of
DocumentInteractionAttention
layer to ensure SavedModel is restored correctly.
-
ModelBuilder to build
tf.keras.Model
using Functional API:AbstractModelBuilder
class for users to inherit.ModelBuilder
class that wraps the boilerplate code to buildtf.keras.Model
for a ranking model.InputCreator
abstract class to implementcreate_inputs
inModelBuilder
.FeatureSpecInputCreator
class to create inputs fromfeature_spec
s.TypeSpecInputCreator
class to create inputs fromtype_spec
s.
Preprocessor
abstract class to implementpreprocess
inModelBuilder
.PreprocessorWithSpec
class to do Keras preprocessing or feature transformations with functions specified in Specs.
Scorer
abstract class to implementscore
inModelBuilder
.UnivariateScorer
class to implement univariate scoring functions.DNNScorer
class to implement fully connected DNN univariate scoring.GAMScorer
class to implement feature based GAM univariate scoring.
-
Pipeline to wrap the boilerplate codes for training:
AbstractDatasetBuilder
abstract class to build and serve the dataset for training.BaseDatasetBuilder
class to build training and validation datasets and signatures for SavedModel fromfeature_spec
s.SimpleDatasetBuilder
class to build datasets with a single label feature spec.MultiLabelDatasetBuilder
class to build datasets for multi-task learning.
DatasetHparams
dataclass to specify all hyper-parameters used inBaseDatasetBuilder
class.AbstractPipeline
abstract class to train and validate the rankingtf.keras.Model
.ModelFitPipeline
class to train the ranking models usingmodel.fit()
compatible with distribution strategies.SimplePipeline
class for single-task training.MultiTaskPipeline
class for multi-task training.- An example client to showcase training a deep neural network model with a distribution strategy using
SimplePipeline
.
PipelineHparams
dataclass to specify all hyper-parameters used inModelFitPipeline
class.strategy_utils
helper module to supporttf.distribute
strategies.
-
RaggedTensor support in losses and metrics:
- Losses in
tfr.keras.losses
and metrics intfr.keras.metrics
support to act ontf.RaggedTensor
inputs. To do so, set argumentragged=True
when defining the loss and metric objects:- E.g.:
loss = tf.keras.losses.SoftmaxLoss(name=’softmax_loss’, ragged=True)
- Add this argument in
get
to get the losses and metrics support ragged tensors:loss = tf.keras.losses.get(‘softmax_loss’, ragged=True)
- An example client to showcase training a deep neural network model using
model.fit()
with ragged inputs and outputs.
- E.g.:
- Losses in
Dependencies: The following packages will be installed as required when installing tensorflow-ranking
.
tf-models-official >= 2.5.0
tensorflow-serving-api>= 2.0.0, < 3.0.0
tensorflow==2.5.0
.
TensorFlow Ranking v0.3.3
This is the 0.3.3 release of TensorFlow Ranking. It depends on tf-models-official >= 2.4.0
and tensorflow-serving-api>= 2.0.0, < 3.0.0
. It is compatible with tensorflow==2.4.1
. All of these packages will be installed as required packages when installing tensorflow-ranking
.
The main changes in this release contain the Document Interaction Network (DIN) layer and layers for training Keras models using Functional API. The new components are listed below:
-
Document Interaction Network: See paper.
- Building Keras ranking models for DIN using Keras Preprocessing Layers.
tfr.keras.layers.DocumentInteractionAttention
: A keras layer to model cross-document interactions. Applies cross-document attention across valid examples identified using a mask.
-
Keras Layers: for easy transformation of context and example features and related utilities.
tfr.keras.layers.FlattenList
: Flattens thebatch_size
dimension and thelist_size
dimension for theexample_features
and expandslist_size
times for thecontext_features
.tfr.keras.layers.ConcatFeatures
: Concatenates context features and example features in a listwise manner.tfr.keras.layers.RestoreList
: Output layer to restorebatch_size
dimension andlist_size
dimension for the output shape of logits.
-
Others
tfr.keras.metrics.get(metric_key)
: Add aget
metric factory for keras metrics.- Masking support in tfr.data: Add support for parsing a boolean
mask
tensor which indicates number of valid examples viamask_feature_name
argument intfr.data._RankingDataParser
and all associated input data parsing andserving_input_fn
builders.
TensorFlow Ranking v0.3.2
In the latest release of TensorFlow Ranking v0.3.2, we introduce TFR-BERT extension to better support ranking models for text data based on BERT. BERT is a pre-trained language representation model which has achieved substantial improvement over numerous NLP tasks. We find that fine-tuning BERT with ranking losses further improve the ranking performance (arXiv). You can read detailed information about what is included in TFR-BERT extension here. There is also an example showing how to use TFR-BERT here.
TensorFlow Ranking v0.3.1
This is the 0.3.1 release of TensorFlow Ranking. It depends on tensorflow-serving-api==2.1.0
and is fully compatible with tensorflow==2.2.0
. Both will be installed as required packages when installing tensorflow-ranking
.
The main changes in this release are canned Neural RankGAM estimator, canned DNN estimators, canned Neural RankGAM keras models and their examples. The new components are:
-
Neural RankGAM
-
make_gam_ranking_estimator
, which makes a canned estimator of a neural ranking generalized additive model. An example client to showcase the usage ofmake_gam_ranking_estimator
. -
make_dnn_ranking_estimator
, which makes a canned estimator of a feed-forward neural network for ranking. An example client to showcase the usage ofmake_dnn_ranking_estimator
. -
GAMRankingNetwork
, which encapsulates Neural RankGAM models in a keras ranking network. An example client to showcase the usage ofGAMRankingNetwork
.
-
-
Keras
- Add serialization and deserialization support for feature columns via
tfr.keras.feature.serialize_feature_columns
andtfr.keras.feature.deserialize_feature_columns
. RankingNetwork’sget_config
andfrom_config
methods rely on this.
- Add serialization and deserialization support for feature columns via
TensorFlow Ranking v0.3.0
This is the 0.3.0 release of TensorFlow Ranking. It depends on tensorflow-serving-api==2.1.0
and is fully compatible with tensorflow==2.1.0
. Both will be installed as required packages when installing tensorflow-ranking
.
The main changes in this release are related to the DNN Estimator Builder and Keras APIs.
A DNN Estimator Builder is available at tfr.estimator.make_dnn_ranking_estimator()
.
For Keras, we provide an example to showcase the use of Keras APIs to build ranking models , and a documentation providing step-by-step user instructions outlining the Keras user journey.
The new Keras components are:
-
Losses: Ranking losses in Keras object oriented loss format, along with a base class and a factory method. The APIs are:
tfr.keras.losses.get(loss_key)
- Base class:
tfr.keras.losses._RankingLoss
- Losses under
tfr.keras.losses.*
-
Metrics: Ranking metrics in Keras object oriented metric format, along with a base class and a default metrics getter method. The APIs are:
-
Feature Transformations: tfr.keras.feature.EncodeListwiseFeatures, to convert sparse ranking features to dense. The APIs are:
-
Ranking Network: Base classes for building Ranking Networks, which define scoring logic. The APIs are:
-
Premade Networks: We support premade architectures users can access out-of-the-box. The APIs are:
-
Keras Model : Ranking models can be built using Keras Functional Model API. The APIs are:
-
Integration with Estimators and RankingPipeline: Keras model can be converted to Estimator to use Estimator’s training utilities and is compatible with RankingPipeline. The APIs for conversion are: