0% found this document useful (0 votes)
4 views2 pages

Programming Assignment 5 Hands On - Advanced Deep Learning

The document provides important instructions for programming assignments, emphasizing the need to adhere strictly to the provided skeleton code and input/output structures. It outlines the objective of the assignment, which involves using the bert-base-uncased model to generate sentence representations and compute cosine similarity between them. Sample test cases are included to illustrate the expected input and output format.

Uploaded by

Suchifriend
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Programming Assignment 5 Hands On - Advanced Deep Learning

The document provides important instructions for programming assignments, emphasizing the need to adhere strictly to the provided skeleton code and input/output structures. It outlines the objective of the assignment, which involves using the bert-base-uncased model to generate sentence representations and compute cosine similarity between them. Sample test cases are included to illustrate the expected input and output format.

Uploaded by

Suchifriend
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Important Instructions about Programming Assignments

1. Programming assignments will be evaluated automatically. Do not change the


skeleton code provided to you.

2. Write your code only in the designated places in the skeleton code, and process
the input data provided to you in the designated variables. Do not alter the input
output structure in the skeleton code.

3. Do not import any additional libraries. Do not use any additional files for the
processing other than those mentioned in the skeleton code. Failure to comply with
these instructions may lead to you getting zero marks for the assignment, even if
the solution is largely correct.

Question:
Objective: The objective of this assignment is to investigate the performance of
two different types of sentence-level representations as well as understand the
type of information encoded in these representations as produced by the bert-base-
uncased model.
There are usually two ways of aggregating sentence-level representation from the
bert model.
I. Using the CLS token
II. Applying some transformation on the hidden state output of the model One such
transformation is the application of max pooling.
In this assignment, you will be given a set of two sentences that will be taken as
input from
the system arguments with the sentences being separated " , ". You will have to use
the pre-trained bert-base-uncased model to generate two different representations
(as described above) for each sentence. You will then apply cosine similarity
between the respective representations of each sentence and report the two values
rounded off to the 2nd decimal.
The output of the assignment can be represented as,

Where f(-) is the bert-base-uncased model, S1 and S2 are the two sentences, y1 and
y2 are

the CLS and max-pooling representations of the output of the bert-base-uncased


model and lastly, cos (-,�) is the cosine similarity score.

Bonus: The input cases have been provided such that the sentence similarities range
from paraphrase to contradiction. Looking at the scores, try to understand which
type of vector representation works best. Also, based on the last test case, do you
think that the bert-base� uncase model is able to understand semantic information?

Sample Test Cases:


"input": "The cat is sitting on the mat, A cat rests on a mat\n", "output": "0.84
0.97"

"input": "The restaurant offers a variety of vegan dishes , There are many plant�
based options on the menu at the cafe\n",
"output": "0.64 0.74"
"input": "The new iPhone has an improved camera , Android phones are known for
their customizability\n",
"output": "0.64 0.91"

"input": "She loves painting landscapes during the summer , Quantum computing is
expected to revolutionize technology",
"output": "0.57 0.9"

"input": "The fox jumped over the well , The fox did not jump over the well",
"output": "0.86 0.96"

You might also like