Multiple passes, infinite loops

View: New views
6 Messages — Rating Filter:   Alert me  

Multiple passes, infinite loops

by Dirk Scheuring :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

--- In Robitron@..., Noel Bush wrote:

> What's really needed, assuming one is coming from an AIML world,
> is to extend functionality such that you take multiple passes at
> an input, and break it up into individual utterances which are to
> be discarded or handled as appropriate, based not on the flimsy
> evidence of punctuation, but on plain old "content" -- same as
> AIML works now for individual sentences.

I've done some more thinking on this issue, and I guess it's more appropriate to discuss this here than on Robitron. First of all, there exists a way to do /safe/ multiple passes over an input while staying in one <topic>, by using what I call "self-modding words". For instance, what I can do to iterate over several possible interpretations, or "senses", of a word is to prefix the words I want to involve in the multi-pass transform with numbers, and use the numbered versions of the word in the various patterns that include that word in its different "senses".

<category>
 <pattern>* WORD *</pattern>
 <template>
  <srai>
   <star index="1"/> 1WORD <star index="2"/>
  </srai>
 </template>
</category>

<category>
 <pattern>* 1WORD *</pattern>
 <template>
  <srai>
   <star index="1"/> 2WORD <star index="2"/>
  </srai>
 </template>
</category>

<category>
 <pattern>* 2WORD *</pattern>
 <template>
  <srai>
   <star index="1"/> 3WORD <star index="2"/>
  </srai>
 </template>
</category>

<!-- . . . give up at count N . . . -->

<category>
 <pattern>* NWORD *</pattern>
 <template>
  <srai>
   <star index="2"/>
  </srai>
 </template>
</category>

This is easy to generate; no extension of AIML is necessary to do in-topic multi-pass, or multi-topic multi-pass, or even branched multi-topic multi-pass transformations. It's a powerful linguistic tool; I'm a long ways from having explored all of its possibilities, but I know they are there.

As for the question of what an AIML interpreter developer can do to detect the wide varity of infinite loops that I can generate by effing up on tactics like this, in particular once I add nested recursion - I'd rather they wouldn't bother. I just want an interpreter with a simple loop counter that I can configure so that it matches the same category at most m times, and then emits a user-definable string. Loop depth should be set to "1" by default, and the configuration code should be preceded by a comment saying something like "Increase this value at your own risk!"

Please, as an interpreter developer, don't try to out-think me on that regard - let me have the power I need, and don't disturb my loops. As a tool for linguistic exploration, AIML becomes worthless if you can't do "dangerous" things with it. Groping for the cutting edge can't be perfectly safe, but you can always add safety catches written in AIML, once you know, from enough experience, how you can plunge into a particular abyss ;-)

Dirk

--
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10


_______________________________________________
xaiml mailing list
xaiml@...
http://aitools.org/mailman/listinfo/xaiml

Re: Multiple passes, infinite loops

by Noel Bush :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dirk Scheuring wrote:
> This is easy to generate; no extension of AIML is necessary to do in-topic multi-pass, or multi-topic multi-pass, or even branched multi-topic multi-pass transformations. It's a powerful linguistic tool; I'm a long ways from having explored all of its possibilities, but I know they are there.

Of course the implementors of various xAIML dialects may have many
different interests, but for those such as I who are interested in
experimenting with extensions that operate at a fairly "core" level, I
would approach the issue you're describing by trying to offer some
semantics that would enable you to do exactly what you're illustrating
here but with more explicitness about what's going on.  So, for
instance, one thing that seems highly desirable is to separate
attributes that have to be "encoded" in match strings and patterns, into
actual labeled attributes.  One might wish to match not just string
patterns, but attribute patterns.  So your example might become:

<category>
   <pattern>* WORD *</pattern>
   <template>
     <srai>
       <string id="message"><star/> WORD <star index="2"/></string>
       <string id="sense">1</string>
     </srai>
   </template>
</category>

<category>
   <pattern>
     <string id="message">* WORD *</string>
     <string id="sense">1</string>
   </pattern>
   <template>
     <srai>
       <string id="message"><star/> WORD <star index="2"/></string>
       <string id="sense">2</string>
     </srai>
   </template>
</category>

....

<category>
   <pattern>
     <string id="message">* WORD *</string>
     <string id="sense">*</string>
   </pattern>
   <template>
     <srai>
       <string id="message"><star index="2"/></string>
     </srai>
   </template>
</category>

Or something along those lines.  This isn't a new idea -- basically
corresponds to letting the categories have named argument lists.

> As for the question of what an AIML interpreter developer can do to detect the wide varity of infinite loops that I can generate by effing up on tactics like this, in particular once I add nested recursion - I'd rather they wouldn't bother. I just want an interpreter with a simple loop counter that I can configure so that it matches the same category at most m times, and then emits a user-definable string. Loop depth should be set to "1" by default, and the configuration code should be preceded by a comment saying something like "Increase this value at your own risk!"

For some reason in Program D I removed the counting of loops, and just
introduced a timeout.  Since either seems so arbitrary and "magic
numberish", I guess I figured that rather than encouraging people to try
to guess how many times would be too many (a very tough problem), I'd
just let the cut-off be configurable in terms of response time, which is
going to be what really matters pragmatically.  You can do a *lot* of
recursions in a matter of a few milliseconds, but what really counts is
whether you can "ever" come up with the "right" answer -- both "ever"
and "right" being in scare quotes because "ever" almost always means "in
a pretty short time" and "right" means "acceptable within a pretty short
time"...or something like that.

But I fully appreciate what you're saying about not trying to out-think
you.  As a general principle I think it is absolutely right -- *you* are
the AIML wizard, not me.  I guess the question for xAIML is: do you see
some way that the matter of loop detection could become part of the
language spec itself, rather than one of these "left up to the
interpreter" matters?  Are you saying that you would want to be able to
change the loop counter on a per-category basis?  What would that look like?

> Please, as an interpreter developer, don't try to out-think me on that regard - let me have the power I need, and don't disturb my loops. As a tool for linguistic exploration, AIML becomes worthless if you can't do "dangerous" things with it. Groping for the cutting edge can't be perfectly safe, but you can always add safety catches written in AIML, once you know, from enough experience, how you can plunge into a particular abyss ;-)
>
> Dirk
>
_______________________________________________
xaiml mailing list
xaiml@...
http://aitools.org/mailman/listinfo/xaiml

Parent Message unknown Re: Multiple passes, infinite loops

by Dirk Scheuring :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel Bush wrote:

> This isn't a new idea -- basically corresponds to letting the
> categories have named argument lists.

Sorry, I didn't want to imply that this was my idea at all - it's a basic Lisp feature. I just wanted to show the users how to achieve the effect until the interpreter developers get around to implementing this feature formally, and show the interpreter devs that this might be one of the features worth considering.

>
> > As for the question of what an AIML interpreter developer can do
> > to detect the wide varity of infinite loops that I can generate
> > by effing up on tactics like this, in particular once I add
> > nested recursion - I'd rather they wouldn't bother. I just want
> > an interpreter with a simple loop counter that I can configure so
> > that it matches the same category at most m times, and then emits
> > a user-definable string. Loop depth should be set to "1" by
> > default, and the configuration code should be preceded by a
> > comment saying something like "Increase this value at your own
> > risk!"
>
> For some reason in Program D I removed the counting of loops, and just
> introduced a timeout.  Since either seems so arbitrary and "magic
> numberish", I guess I figured that rather than encouraging people to try
> to guess how many times would be too many (a very tough problem), I'd
> just let the cut-off be configurable in terms of response time, which is
> going to be what really matters pragmatically.  You can do a *lot* of
> recursions in a matter of a few milliseconds, but what really counts is
> whether you can "ever" come up with the "right" answer -- both "ever"
> and "right" being in scare quotes because "ever" almost always means "in
> a pretty short time" and "right" means "acceptable within a pretty short
> time"...or something like that.
>
> But I fully appreciate what you're saying about not trying to out-think
> you.  As a general principle I think it is absolutely right -- *you* are
> the AIML wizard, not me.  I guess the question for xAIML is: do you see
> some way that the matter of loop detection could become part of the
> language spec itself, rather than one of these "left up to the
> interpreter" matters?  Are you saying that you would want to be able to
> change the loop counter on a per-category basis?  What would that look like?
>
> > Please, as an interpreter developer, don't try to out-think me on
> > that regard - let me have the power I need, and don't disturb my
> > loops. As a tool for linguistic exploration, AIML becomes
> > worthless if you can't do "dangerous" things with it. Groping for
> > the cutting edge can't be perfectly safe, but you can always add
> > safety catches written in AIML, once you know, from enough
> > experience, how you can plunge into a particular abyss ;-)
> >
> > Dirk
> >
> _______________________________________________
> xaiml mailing list
> xaiml@...
> http://aitools.org/mailman/listinfo/xaiml

>


--
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10


_______________________________________________
xaiml mailing list
xaiml@...
http://aitools.org/mailman/listinfo/xaiml

Parent Message unknown Re: Multiple passes, infinite loops

by Dirk Scheuring :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Noel Bush wrote:

> I guess the question for xAIML is: do you see
> some way that the matter of loop detection could become part of the
> language spec itself, rather than one of these "left up to the
> interpreter" matters?  Are you saying that you would want to be able to
> change the loop counter on a per-category basis?  What would that look like?

I think you're moving too fast :-). Like I said, users of the AAA set and similar sets built after the classic stimulus/response model don't need those loops, and probably shouldn't be encouraged to mess with them. When I started out, I used to write stuff like

<category>
 <pattern>REDUCE _</pattern>
 <template>
  <srai>REDUCE SOMETHING</srai>
 </template>
</category>

If I'd load this into an AIML interpreter and ran it, it would be nice if the interpreter would say something like, "Sorry, you've created an infinite loop which is caused be the category with the pattern 'REDUCE _'", and do it right after the first loop completion. This, I think, might be a useful default behavior, considering what the majority of people is likely to need.

Matching patterns more than once, IMO, only makes sense for the minority of AIML users who experiment with models different from s/r; in particular those of us who write functional programs in AIML. Kim Sullivan does this, I do this, and whoever found inspiration in the examples in the alicebot-style list archives might be doing this. Anybody here doing it? Anyway, at the mo, we should be a small user base. So any interpreter dev will probably consider whether delivering anything more than the bare necessities for those few people is worth their time.

With "bare necessities", I didn't mean "per-category-definable looping", but just a global counter that makes sure that *no* category gets matched more than n times, where n could be whatever a particular application needs (only the writer can determine how often is "more often than my code could possibly need"). The nth+1 recurrence should auto-match a pre-defined category that does *not* contain a srai in its template. This appears to be relativly simple to implement, generally useful, and safe.

Time-outs are another option; instead of fixing for a maximum depth, we'd have to estimate how long it should take to recurse n times. Are there advantages for you in implementing it that way?

Doing anything more will require the interpreter dev to consider the syntax and semantics of the functional languages that we implement using AIML. And this is where things get hairy, because my language is likely to be quite different from anybody else's language.

The general reason to do those loops is to be able to arbitrarily change the order in which the categories get matched, according to some theory or model that differs from the stimulus/response, head-over-tail, model for which the AIML matching algorithm was designed. The problem is that the language I create to do this depends in the content I want to encode, and therefore is different from writer to writer (and might even be different from project to project for one writer). So even though each one of us might be writing correctly terminating programs, most likely those are utterly incompatible, and maybe even incomparable, because they might be encoding very different models of, and assumptions about, natural language and its use by some target audience in the context of some content that is to be communicated. I'm afrais that we're in highly app-specific territory here.

Regrettfully, I don't have the slightest idea at the mo of how to remedy this unfortunate situation - how can we cope with this on the interpreter-development end, without making the devs think about the content we want to encode, and the various ideas about "grammar" and/or "matching prioritiy" that can be implemented using AIML? Anybody else got a hunch?

Dirk

Dirk


--
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10


_______________________________________________
xaiml mailing list
xaiml@...
http://aitools.org/mailman/listinfo/xaiml

Re: Multiple passes, infinite loops

by Noel Bush :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dirk Scheuring wrote:
> Noel Bush wrote:
>
>> This isn't a new idea -- basically corresponds to letting the
>> categories have named argument lists.
>
> Sorry, I didn't want to imply that this was my idea at all - it's a basic Lisp feature. I just wanted to show the users how to achieve the effect until the interpreter developers get around to implementing this feature formally, and show the interpreter devs that this might be one of the features worth considering.

No, no...sorry -- I was trying to stress that the alternate form that I
showed wasn't *my* idea.  Didn't mean to seem to be suggesting that you
were implying that something that wasn't your idea was.  :-)
_______________________________________________
xaiml mailing list
xaiml@...
http://aitools.org/mailman/listinfo/xaiml

Parent Message unknown Re: Multiple passes, infinite loops

by Dirk Scheuring :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I wrote:

> just a global counter that makes sure that *no* category
> gets matched more than n times

And that's still too complicated. Just give me a way to configure an overall maximum of recursions, and I'll figure out whether I need 16, 128, whatever, for a given application.

Dirk

--
_______________________________________________

Search for businesses by name, location, or phone number.  -Lycos Yellow Pages

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10


_______________________________________________
xaiml mailing list
xaiml@...
http://aitools.org/mailman/listinfo/xaiml