Vowpal Wabbit Documentation

repository·master·Indexed 27 days ago

https://github.com/vowpalwabbit/vowpal_wabbit

A fast, scalable online machine learning system specializing in reinforcement learning (contextual bandits), hashing, and large-scale feature interaction. The system supports deployment on non-Hadoop clusters via spanning tree servers and on Hadoop clusters using MapReduce streaming. Key features include low-rank quadratic interactions for sparse data, Probabilistic Label Trees (PLT) for multilabel classification, and Contextual Memory Trees (CMT) for logarithmic time multiclass classification.

Tokens
37K
Snippets
92
Records
251
Agent score
93%

What's inside Vowpal Wabbit

  1. Overview of Vowpal Wabbit features

    master

    Vowpal Wabbit is a high-performance machine learning system designed for online learning. Key capabilities include:

    • Flexible Input Format: Supports free-form text interpreted via bag-of-words and multiple namespaces.
    • Speed: Optimized for fast online learning, with sparse gradient descent (GD) as the baseline.
    • Scalability: Features a bounded memory footprint independent of data size and uses the hashing trick to bound the feature set size.
    • Feature Interaction: Supports internal pairing of feature subsets to enable linear complexity on cross-products, which is particularly useful for ranking problems.
    • Reinforcement Learning: Includes implementations for contextual bandit algorithms.
  2. Identify VowpalWabbit components and binaries

    master

    VowpalWabbit is composed of several components including executables, static libraries, and header-only utilities. Note that some component names have been updated for consistency:

    • vw-bin is now vw_cli_bin
    • vw is now vw_core
    • spanning_tree is now vw_spanning_tree_bin (executable)

    Key Components

    NameTargetTypeDescription
    clivw_cli_binEXECUTABLEPrimary VW command line interface (the vw executable).
    corevw_coreSTATIC_ONLYContains all remaining VW code, reduction implementations, driver, and option handling.
    slimvw_slimSTATIC_ONLYMinimal inference-only runtime.
    allreducevw_allreduceSTATIC_ONLYSupporting library for thread or socket-based distributed learning.
    c_wrappervw_c_wrapperSHARED_ONLYOld C API. Note: Exceptions are thrown across the boundary.
    spanning_treevw_spanning_tree_binEXECUTABLECommand line tool for connecting instances of VW for distributed learning.
  3. Explore Vowpal Wabbit command-line demos

    master
    The demo/ directory contains various command-line experiments and demos that showcase the capabilities of Vowpal Wabbit across different machine learning tasks. You can use these directories to understand how to apply VW to specific domains like classification, bandits, or neural networks.
  4. Understand the Wikipara dataset structure

    master

    The Wikipara dataset is a generation scheme designed to test model performance under varying class counts and training examples per class. It uses Wikipedia pages as classes and paragraphs from those pages as examples.

    Structure:

    • Class: Defined by the Wikipedia page ID.
    • Training Examples: A subset of paragraphs taken from the page.
    • Test Examples: A separate subset of paragraphs taken from the same page.

    This dataset is particularly useful for testing scenarios with high cardinality (e.g., 10,000 classes) and extremely low data availability per class (e.g., 3 training examples and 1 test example).

  5. View Neural Networks and Feature Engineering demos

    master

    Demos covering neural networks and feature engineering include:

    • dna/: DNA sequence classification with feature engineering.
    • normalized/: Demonstrations of feature normalization effects.
    • random-noise/: Robustness experiments using random noise features.
  6. Run the MovieLens low-rank quadratic demo

    master

    The MovieLens demo demonstrates different modeling approaches for the movielens-1M dataset, comparing linear models against various low-rank interaction configurations.

    To run the full comparison suite, use the make shootout command. This will produce results for:

    • linear: A baseline model with only user and item bias (no interactions).
    • lrq: A linear model augmented with rank-7 interactions (e.g., --l2 1.25e-7 --lrq um7).
    • lrqdropout: A linear model with rank-14 interactions and dropout (e.g., --lrq um14 --lrqdropout).
    • lrqdropouthogwild: The lrqdropout configuration trained in parallel on multiple cores without locking (lock-free parallel learning).

    Note: The first run of make shootout produces extensive output; subsequent runs will show cached results.

    make shootout
  7. Set up a local environment to build VW-WASM

    master

    To build VW-WASM locally, you must install and activate the Emscripten SDK (emsdk). Follow these steps to clone, install, and activate the latest version:

    1. Clone the emsdk repository.
    2. Install and activate the latest version.
    3. Source the environment variables.
    git clone https://github.com/emscripten-core/emsdk.git
    cd emsdk
    ./emsdk install latest
    ./emsdk activate latest
    source ./emsdk_env.sh
  8. Run the Entity Relation Recognition demo

    master

    To demonstrate Searn's performance on an entity-relation recognition task, use the provided make command. This command automates the following steps:

    1. Downloads the preprocessed entity-relation dataset.
    2. Trains a joint model for predicting entity and relation types.
    3. Computes statistics on the test set.

    For more information regarding the dataset used in this demo, refer to the CogComp resource page: http://cogcomp.cs.illinois.edu/page/resource_view/43

    make er.perf
  9. Perform OPE with a pre-trained policy using the `--eval` option

    master

    If you have a pre-trained candidate policy (even one trained outside of VW) and want to evaluate it against production bandit data, use the legacy --eval method.

    1. Create an evaluation file (e.g., eval.dat).
    2. For each production data instance, prepend the line with the action your candidate policy would have chosen.
      • Format: <candidate_action> <production_data_line>
      • Example: If production data is 1:2:0.5 | feat_a and candidate chooses action 2, write 2 1:2:0.5 | feat_a.
    3. Run VW with the --eval flag.

    Warning: VW will prevent you from using biased estimators like dm (direct method) with the --eval flag to avoid incorrect results.