Giter VIP home page Giter VIP logo

Comments (4)

rsoika avatar rsoika commented on August 11, 2024

Hi @JasonIsaac , I am also working with Mistral-7B-Instruct-v0.2 and have also a lot of questions about the prompt format. But I can't find answers - and sorry I can't answer your question too.

But maybe we can discuss the topic a little bit more? Do you use the chat-template?

The problem for me is that this link seems to be the only source of documentation about how to define a prompt. But the documentation is very poor. It only tells us that the prompt format is very important and that <s> is the begin and </s> the end of a string. But it does not explain the difference about a string and "regular strings". This makes it - at least for me - impossible to construct complex prompts.

I also got an answer from another discussion that newlines are also very important inside a prompt. Are you using the line breaks in your example deliberately?

from cookbook.

JasonIsaac avatar JasonIsaac commented on August 11, 2024

Hi @rsoika ,

Thanks for you reply.

Yes, I came to know we can use the llama2 format which uses <s></s> and [INST][/INST] tags from a different discussion discussion after posting this question. Currently my prompt looks likes this:

<s>[INST] <<SYS>>
You are an assistant to users who have queries about {topic} .
Only USE the following pieces of contexts under **Contexts** to answer. Do not use any external knowledge or information. If the answer cannot be determined from the context, respond with "I don't have enough information to answer that"

**Contexts**:
{contexts}
<</SYS>>

{user_message_1} [/INST] {model_answer_1}</s>

With the above prompt, the model is able to:

  • Generate response from contexts
  • maintain the chat history

Restricting answers to out of scope questions is still an unknown.

Can you give an example of a complex prompt?.

Yes, line breaks are deliberate, even I read about it somewhere else.

from cookbook.

rsoika avatar rsoika commented on August 11, 2024

Hi @JasonIsaac , yes you prompt template is very very interesting too :-)

In the early beginning I also started with the <</SYS>> tags, but than I removed them, because I thought they are not supported by mistra7b....

I show you my current prompt, that I use to analyze/summarize the content of business documents. (e.g. an Invoice Document

<s>[INST] You are a clerk in a logistics company and your job is to check incoming invoices.[/INST]

<FILECONTEXT>^.+\.([pP][dD][fF])$</FILECONTEXT>

</s>
[INST] Briefly summarize this invoice document in the the following 3 data blocks:

** Company Data **
List all relevant information about the company, like the company name, general tax information, the address and contact information.

** Payment Data **
List all the necessary information to be able to make the payment, like the invoice date and total amount, the bank information including IBAN, BIC or SWIFT code and also information about the payment terms.

** Invoice Items **
Create a table with the data of the invoice items or services listed in the invoice. This table can include the description, the quantity, price and tax information for each item. 

Don't calculate any amounts yourself, but only take amounts that actually appear in the invoice document!

[/INST]

<FILECONTEXT is replaced by our application with the content of a OCR parsed document - and this content is extremely unformatted with lot of newlines, spaces and tabs. But this works now very well now.
You can see that I close the <s> very early.

Have you seen this discussion which brings up - at least for me - now new insights.

from cookbook.

rsoika avatar rsoika commented on August 11, 2024

One more question: how long is your final prompt? In my case it can be more the 8KB

from cookbook.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.