- Zero-Shot Classification with Large Language Models (LLM)
- Support Vector Machine, using TD-IDF of n-grams as features.
- Multi-Eurlex and associated paper.
Launch FastAPI using uvicorn main:app with --reload if in testing mode.
Then, the API can be called by using the following instructions:
curl -X 'POST' 'http://127.0.0.1:8000/classification' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"text":"Make decisions 10X more confidently and quickly with AI-powered insights.", \
"labels":["Business","Machine Learning","Sport"], \
"model": "zero-shot"}'
The ouput is a dict with the predicted labels. model is to be chosen in ['svm','zero-shot']. labels is an optional input if the zero-shot model is used (no specification leads to a default list specified in params.py). Note that SVM model only works with the EuraLex Labels (specified in params).
main.pyis the API structure.params.pycontains the main Hyperparameter.test.pyis an inner testing file to to compare performance of models.- For the SVM Model,
svm_classif.pyis the SVM classifier trained on Multi-Eurlex and stored inmodels/svm.- Note that
svm_classif_training.pyallows to train the SVM model on a given dataset (e.g. EuraLex) while performing a Grid Search for Hyperparameter Tunning.
zero_classif.pyis the Zero-Shot NLI Classifier imported from Hugging Face Library (default isfacebook/bart-large-mnli).frontend.pyallows to call a Gradio Frontend to interact with the API.
- (ML) Few-shot Learning adding a last layer of prediction for the label class (i.e. classify embeddings).
- (ML) Mix SVM and Few/zero-shot learning for Long Document Purpose.
- (Soft. Eng.) Dockerize the Python Server, following for instance 1.
- Extend to [Lex Glue Dataset](LexGLUE: A Benchmark Dataset for Legal Language Understanding in English).