1. Home
  2. Explore
  3. Computer Science
  4. Spark NLP Overview

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Spark NLP Overview

  • 50Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: Library Overview

What type of license does Spark NLP use, and what does it allow?

50 questions

  1. 1

    What type of license does Spark NLP use, and what does it allow?

    Model answer

    Spark NLP uses an Apache 2.0 license, allowing free use for both personal and commercial purposes.

    Explanation

    The Apache 2.0 license is permissive and allows users to freely use, modify, and distribute the software.

  2. 2

    Which programming languages does Spark NLP support?

    Model answer

    Spark NLP supports Python, Java, and Scala.

    Explanation

    It has bindings for these three languages, all with the same API.

  3. 3

    How long has Spark NLP been available and how many releases has it had?

    Model answer

    Spark NLP has been around for three years and has had almost 80 releases.

    Explanation

    The library has been actively developed with frequent updates.

  4. 4

    What is the relationship between Spark NLP and Apache Spark?

    Model answer

    Spark NLP is based on Apache Spark, and every Spark NLP pipeline is also a Spark ML pipeline.

    Explanation

    This means Spark NLP leverages Spark's distributed computing capabilities and ML pipeline framework.

  5. 5

    Can Spark NLP run on a single machine or does it require a cluster?

    Model answer

    Spark NLP can run locally on a single machine without a cluster, but it can also scale to a cluster.

    Explanation

    It is designed to work in any environment, from local to large distributed clusters.

  6. 6

    What unique scaling capability does Spark NLP offer among open-source NLP libraries?

    Model answer

    Spark NLP is the only open-source NLP library that natively scales to a cluster.

    Explanation

    It can leverage Apache Spark clusters on-premise, Databricks, or cloud without code changes.

  7. 7

    Which environments does Spark NLP officially support?

    Model answer

    Spark NLP officially supports on-premise, Databricks, and cloud environments.

    Explanation

    These are tested in every release to ensure compatibility.

  8. 8

    What specialized builds does Spark NLP offer for hardware optimization?

    Model answer

    Spark NLP offers specialized builds for NVIDIA chips and the latest Intel chips.

    Explanation

    These optimizations leverage GPU acceleration and Intel's MKL for deep learning performance.

  9. 9

    According to surveys, how is Spark NLP used in enterprises?

    Model answer

    Spark NLP is the most widely used NLP library by practitioners in enterprise, as per multiple surveys including O'Reilly and an NLP industry survey in September 2020.

    Explanation

    It has a strong adoption in production environments.

  10. 10

    What are the three basic design goals of Spark NLP?

    Model answer

    The three design goals are state-of-the-art accuracy, state-of-the-art performance (speed), and state-of-the-art scalability.

    Explanation

    These goals aim to provide the best possible results, fast execution, and ability to scale across clusters.

  11. 11

    How does Spark NLP define 'state-of-the-art accuracy'?

    Model answer

    Spark NLP defines state-of-the-art accuracy as the best accuracy achieved on academically accepted benchmarks from peer-reviewed papers.

    Explanation

    It aims to provide that level of accuracy out of the box in a production-grade manner.

  12. 12

    What does 'state-of-the-art performance' mean in the context of Spark NLP?

    Model answer

    State-of-the-art performance means optimizing code, pipeline, memory use, and leveraging GPUs or latest Intel chips, as well as using lighter BERT embeddings for speed with nearly the same accuracy.

    Explanation

    It encompasses both algorithmic and hardware optimizations.

  13. 13

    What is the importance of scalability in Spark NLP's design?

    Model answer

    Scalability ensures that pipelines can work on 10, 50, or 500 machines and actually benefit from the added scale.

    Explanation

    It moves beyond single-machine limitations while maintaining performance.

  14. 14

    What basic NLP tasks does Spark NLP support?

    Model answer

    Spark NLP supports document splitting, tokenization, stemming, lemmatization, part-of-speech tagging, dependency parsing, spell checking, named entity recognition, sentiment analysis, emotion analysis, and document classification.

    Explanation

    These cover the full spectrum from basic preprocessing to advanced deep learning tasks.

  15. 15

    What types of embeddings does Spark NLP embed?

    Model answer

    Spark NLP embeds word embeddings, chunk embeddings, and sentence embeddings.

    Explanation

    It includes models like BERT, ALBERT, ELECTRA, XLNet, ELMO, BioBERT, ClinicalBERT, and CovidBERT.

  16. 16

    Does Spark NLP require a separate transformer library for embeddings?

    Model answer

    No, Spark NLP handles loading, caching, and distributing embeddings to the cluster without needing a separate transformer library.

    Explanation

    It provides built-in support for hundreds of pre-trained models.

  17. 17

    What types of text classification does Spark NLP support?

    Model answer

    Spark NLP supports both multi-class and multi-label text classification.

    Explanation

    Multi-class assigns one label per document; multi-label assigns multiple labels.

  18. 18

    Give examples of problems suitable for multi-class classification in Spark NLP.

    Model answer

    Examples include detecting emotions, cyberbullying, fake news, and spam.

    Explanation

    These problems require a single category per input.

  19. 19

    Give examples of problems suitable for multi-label classification in Spark NLP.

    Model answer

    Examples include detecting toxic comments and predicting movie genres.

    Explanation

    These problems may require multiple labels for a single document.

  20. 20

    How many pre-trained word and sentence embeddings can Spark NLP classifiers use?

    Model answer

    Spark NLP classifiers can use over 90 pre-trained word and sentence embeddings.

    Explanation

    This includes state-of-the-art sentence embeddings like BERT and Universal Sentence Encoder.

  21. 21

    What is the accuracy of Spark NLP's language detection model?

    Model answer

    The model achieves 97% accuracy for 32 languages and 99% for 22 languages.

    Explanation

    It was trained on 8 million Wikipedia pages and does not require word embeddings.

  22. 22

    What makes Spark NLP's spell checking model unique?

    Model answer

    It can leverage context, preserve custom patterns, and was initially created to handle bad inputs from OCR.

    Explanation

    It offers flexibility to incorporate custom patterns and corrects based on document context.

  23. 23

    What F1 scores did Spark NLP achieve on the CoNLL 2003 NER benchmark?

    Model answer

    Spark NLP achieved 93.3 F1 on the test dataset and 95.9 F1 on the dev dataset.

    Explanation

    This was achieved using BERT Large case-sensitive and a bi-directional LSTM with CRF.

  24. 24

    In the out-of-box comparison with spaCy, how did Spark NLP perform on NER?

    Model answer

    Spark NLP showed very good accuracy from smaller GloVe embeddings to BERT Large, while spaCy achieved around 92% on a dev dataset.

    Explanation

    Spark NLP provided higher accuracy with default parameters.

  25. 25

    How many word embeddings models does Spark NLP provide out of the box?

    Model answer

    Spark NLP provides 50 word embeddings models.

    Explanation

    In contrast, spaCy only has three pipelines with vectors and four transformer models.

  26. 26

    What architectures does Spark NLP use for multi-class and multi-label classification?

    Model answer

    Spark NLP uses tensorflow with RGUI followed by convolutional neural nets.

    Explanation

    These designs achieve high accuracy while accepting over 90 embeddings and up to 100 classes.

  27. 27

    How many dimensions can the embeddings used in classifiers have?

    Model answer

    They can range from 100 to 1024 dimensions.

    Explanation

    The classifiers support this range without compromising accuracy.

  28. 28

    What improvements were made to Spark NLP in early 2020 regarding speed and accuracy?

    Model answer

    Training speed was improved by over 60% and accuracy for NER by 4% in F1 when moving to TensorFlow 1.15.

    Explanation

    This also added support for Windows, macOS, and Linux.

  29. 29

    By how much did Spark NLP improve BERT embedding memory and performance in its latest release?

    Model answer

    Memory was improved by 30% and performance by more than 70% through implementing dynamic shapes.

    Explanation

    Dynamic shapes optimize memory and computation.

  30. 30

    How many smaller BERT models were added, and what is their advantage?

    Model answer

    24 new smaller models like TinyBERT, MiniBERT, and SmallBERT were added; TinyBERT is 24x smaller and 28x faster than BERT-Base.

    Explanation

    Smaller models are faster to download and load into TensorFlow.

  31. 31

    How easy is it to use GPU acceleration in Spark NLP?

    Model answer

    Using GPU requires setting one parameter, and any task using TensorFlow as backend can be 40-50% faster.

    Explanation

    GPU acceleration is straightforward.

  32. 32

    What performance gains are seen with Intel Cascade Lake processors and MKL optimizations?

    Model answer

    Performance is close to GPU, and training for French NER was 19% faster than GPU and up to 46% cheaper.

    Explanation

    MKL-optimized TensorFlow on Intel hardware can outperform GPU in some cases at lower cost.

  33. 33

    What is required to scale a Spark NLP pipeline on a cluster?

    Model answer

    No code change is needed; it takes advantage of Apache Spark's execution planning, caching, serialization, and data shuffling.

    Explanation

    Scaling is native but not linear; tuning cluster and knowing dataset is advised.

  34. 34

    How does scaling performance depend on task?

    Model answer

    Scaling is not linear; for tokenization, 10 nodes gave more than 10x improvement, while for NER, it was about 5x.

    Explanation

    Deep learning tasks may not scale as linearly due to complexity.

  35. 35

    In the benchmark, what were the tokenization speeds on a single node and on 10 nodes?

    Model answer

    Single node achieved 340,000 words/sec; 10 nodes achieved 7,000,000 words/sec.

    Explanation

    This was on a dataset of 50 million sentences and 255 million tokens.

  36. 36

    In the benchmark, what were the NER speeds on a single node and on 10 nodes?

    Model answer

    Single node achieved 38,000 words/sec; 10 nodes achieved 136,000 words/sec.

    Explanation

    This is for entity extraction using deep learning.

  37. 37

    In the benchmark, what were the BERT-Base embedding speeds on a single node and on 10 nodes?

    Model answer

    Single node achieved 19,000 words/sec; 10 nodes achieved 76,000 words/sec.

    Explanation

    BERT is slower but scales reasonably.

  38. 38

    In the benchmark, what were the BERT-Tiny embedding speeds on a single node and on 10 nodes?

    Model answer

    Single node achieved 170,000 words/sec; 10 nodes achieved almost 500,000 words/sec.

    Explanation

    TinyBERT is much faster and scales well.

  39. 39

    What are the three ways to use Spark NLP?

    Model answer

    Pre-trained pipelines, pre-trained models, and training your own models.

    Explanation

    Pre-trained pipelines are one-liners but less flexible; pre-trained models are flexible; training custom models allows full control.

  40. 40

    How many pre-trained pipelines does Spark NLP offer and in how many languages?

    Model answer

    Over 90 pre-trained pipelines supporting up to 13 languages.

    Explanation

    They work both online and offline.

  41. 41

    What is a limitation of pre-trained pipelines?

    Model answer

    They are not flexible; if a pipeline contains tasks you don't need, you still pay computation time, and if it lacks a task you need, it cannot be added.

    Explanation

    Pipelines come as a whole.

  42. 42

    How many pre-trained models does Spark NLP offer and in how many languages?

    Model answer

    Over 250 pre-trained models supporting up to 46 languages.

    Explanation

    They are flexible and allow custom pipelines.

  43. 43

    What is a caveat of using pre-trained models?

    Model answer

    Some models depend on each other; for example, an NER model trained on a specific BERT model cannot be used with a different BERT of different dimensions.

    Explanation

    Model compatibility must be maintained.

  44. 44

    How easy is it to train a part-of-speech (POS) tagger in Spark NLP?

    Model answer

    It uses a perceptron approach, is language agnostic, and achieves high accuracy in 5-6 iterations.

    Explanation

    Data can be downloaded from Universal Dependencies and converted using a POS class.

  45. 45

    What format is required for training NER models in Spark NLP?

    Model answer

    The CoNLL 2003 format.

    Explanation

    This is a standard format for named entity recognition.

  46. 46

    What did the example NER training on Google Colab achieve?

    Model answer

    Using BERT with 2 layers and 768 dimensions, it reached 91% micro F1 on dev and 90% on conll_eval in 16 minutes.

    Explanation

    This was possible due to improvements in BERT embeddings allowing the full CoNLL dataset to fit on a free GPU.

  47. 47

    How many classes can the multi-class classifier support and how many embeddings?

    Model answer

    It supports up to 100 classes and accepts over 90 word and sentence embedding models.

    Explanation

    Training can be done on CPU or GPU with extended evaluation metrics.

  48. 48

    How many releases has Spark NLP had in its three years?

    Model answer

    Over 73 releases, approximately one every two weeks.

    Explanation

    Frequent releases keep up with NLP trends.

  49. 49

    What community resources are available for Spark NLP?

    Model answer

    An active community on Slack and GitHub.

    Explanation

    Users can join for support and collaboration.

  50. 50

    What is the total number of pre-trained models and pipelines now?

    Model answer

    Over 330 pre-trained models and pipelines.

    Explanation

    This covers a wide range of languages and tasks.

1 of 50
Question 1 of 50

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent