• [+] expand all

Stateless model reference

.model files are used in stateless model evaluation. These are files with ranking expressions, located in models / a subdirectory of models, with .model suffix:

├── models
│   └── my_model.model
└── services.xml

.model file format specification

model [name] {

    ([input-argument-name]: [input-argument-type])*

    constants {
        ([constant-name]: [scalar or tensor in literal form])*

    (constant [name] {
        type: [tensor-type-spec]]
        file: [file path relative to this .model file]

    (function [name]([argument-name]*) {
        expression: [ranking expression]


The elements can appear in any order (and number).

.model example

This file must be saved as example.model somewhere in the models directory tree, and the same directory must also contain constant1asLarge.json with a tensor.

model example {

    # All inputs that are not scalar (aka 0-dimensional tensor) must be declared
    input1: tensor(name{}, x[3])
    input2: tensor(x[3])

    constants {
        constant1: tensor(x[3]):{{x:0}:0.5, {x:1}:1.5, {x:2}:2.5}
        constant2: 3.0

    # Constant in a separate file
    constant constant1asLarge {
        type: tensor(x[3])
        file: constant1asLarge.json

    function foo1() {
        expression: reduce(sum(input1 * input2, name) * constant1, max, x) * constant2

    function foo2() {
        expression: reduce(sum(input1 * input2, name) * constant(constant1asLarge), max, x) * constant2


This makes the model example available with the functions foo1 and foo2.